This tutorial will guide you through the steps to setup an IoT Smart Kitchen application on scriptr.io using a Nebula 2.0 board. The Nebula board can be installed on a kitchen appliance and, equipped with the Weather click board by MikroElektronika, it will detect humidity, pressure, and temperature, and send the readings to scriptr.io by going through the IBM Watson IoT DMP (Data Management Platform).
You can also watch the video tutorial to make sure you don’t miss any step: https://youtu.be/klr0l6FeOB8

Prerequisites

Hardware

  • Nebula 2.0: make sure you connect your Nebula board to your PC using the USB cable before you start. This is needed to install the nebula20-watson app on it using WICED Studio.
  • Weather click: install the Weather click board on your Nebula board. The Weather click from MikroElektronika is used in this tutorial to read environmental data. If you use a different sensor board, make sure you modify the Nebula application accordingly using WICED Studio.

Software

  • WICED Studio: you need to download and install the WICED Studio by Cypress, and use the 43xxx_WiFi project to build the Nebula 2.0 application as described later in this guide.
  • You need to install a terminal tool such as Tera Term or CuteCom (baud rate 115,200, data 8 bit, parity none, stop 1 bit, flow control none) in order to connect to your Nebula device and see the output.
  • Preconfigured scriptr.io account, loaded with the Nebula 2.0 smart kitchens app, created using the following registration link: https://www.scriptr.io/register?promocode=nebula-2.0

Step by Step Instructions

  1. Registering for a free scriptr.io account with the nebula-2.0 promo code

    Navigate to https://www.scriptr.io/register?promocode=nebula-2.0 and follow the registration instructions to register to scriptr.io using the nebula-2.0 promotion code. This will automatically install the Nebula Smart Kitchen app on your account.

  2. Installing the Nebula 2.0 Smart Kitchen app using WICED Studio

    In this step, you will install the nebula20-watson app on your Nebula board so that it can send the Weather click sensors data to IBM Watson IoT.

    1. Clone the nebula20-watson repository.
    2. Copy the cloned repository code into your 43xxx_Wi-Fi WICED Studio project so that the files from the repository would replace the existing files. This repository already contains the NEB1DX_02 platform and the BME280 sensor libraries, which means that you don’t have to worry about importing them into your project.
    3. Configure your Nebula board to connect to your local WiFi network as follows:
      1. Open the apps/nebula/watson/wifi_config_dct.h file
      2. Set the CLIENT_AP_SSID constant to your WiFi SSID
      3. Set the CLIENT_AP_PASSPHRASE constant to your WiFi Network Security Key
      4. Save
    4. Now you need to set the MQTT topic and Client ID to be used with IBM Watson IoT Quickstart. For that, follow the below steps:
      1. Log in to your scriptr.io Workspace using the credentials you used to register in step #1 above
      2. Copy the Token provided to you in your landing page
      3. Go back to WICED Studio, and open the file apps/nebula/watson/watson.h
      4. Replace <TOKEN> in the PUB_TOPIC constant value with the Token you copied from your scriptr.io Workspace
      5. Replace <TOKEN> in the CLIENT_ID constant value with the Token you copied from your scriptr.io Workspace
      6. Save
    5. Generate a new build target as follows:
      1. Right-click the 43xxx_Wif-Fi project folder
      2. Select Make Targets > Create…
      3. Set the Target name to “nebula.watson-NEB1DX_02 download download_apps run”
      4. Click OK
    6. In the Make Target window, double-click the new make target you created in the previous step in order to build it. This will install the app on your Nebula board.

    Check your terminal program (baud rate 115,200, data 8 bit, parity none, stop 1 bit, flow control none) to the results.

  3. Sending data to IBM Watson IoT

    Now that you’re all set, let’s start sending the data to IBM Watson IoT:

    1. On your Nebula board, press Button 1, this will trigger a message to be sent to IBM Watson IoT. The message will have a payload similar to the one below:
      {"parameters": {"p": 94465.42,"h_unit": "%","p_unit": "Pa","t": 28.41,"h": 52.71,"t_unit": "°C"}}
    2. If you would like to check the data on IBM Watson IoT Quickstart, follow the below steps:
      1. Navigate to the IBM Watson IoT Platform Quickstart page: https://quickstart.internetofthings.ibmcloud.com
      2. In the Device ID, enter the Token as retrieved from your scriptr.io Workspace above, prefixed by the word device
      3. Click Go

    You should now be able to see the data packets on Watson IoT Quickstart.

  4. Running your IoT application in scriptr.io

    To run your application, all you need to do is:

    1. Go to your scriptr.io Workspace
    2. From the tree on the left, navigate to smartkitchen/index.html and double-click it open it in the editor
    3. Click View to view it in your browser
    4. Log in using the credentials demo / demo
    5. Press the Button 1 on the device every time you need to trigger a message to be sent to scriptr.io with the sensors’ readings

    You should now see your device on the map (it will be shown in a predefined location since the device doesn’t send a GPS location). Zoom in on the device and click its marker/pin to see the sensors’ readings. This data is updated in real-time, i.e. every time the device sends a new message to scriptr.io, you can see it on the terminal window if you’re connected to the device, and you will also see the new values reflected in the app as well:

    map

    You can click View Dashboard to go to a dashboard showing several charts, including time series charts showing the variations over time. This view is updated in real-time as well:

    dashboard

    You can also click View Alerts in order to see the warnings logged whenever a value exceeds a certain preset threshold:

    alerts

    Thresholds are set as rules in the Rules Designer which  you can access from the left side bar:

    rules

    Here you can set several rules for each of the sensors values, i.e. temperature, humidity and pressure, which are listed in the first column of the rules designer. As you can see, in the “Rule 1” column, the first row (temperature row) reads “>8”, meaning that whenever the temperature is great than 8, an email notification is sent to the user, as indicated in the sendEmail row, and an alert is logged, as indicated in the last row corresponding to the isAlert row when set to true. Similarly, “Rule 2” means than an email alert is sent to the user whenever the humidity is greater than 30; and so on…

    In order to set the recipients of the alerts, click on the user icon on the top right corner of the screen and select Notification Settings. This will open a form allowing you to enter a comma-separated list of email addresses to receive the email alerts:

    notification-settings

  5. Going Forward

    Scriptr.io allows you to reduce the time to market of your IoT applications by accelerating your development pace, thanks to a plethora of API and visual development tools, such as our dashboard builder, our decision table editor, and the multitude of tools at your disposal in the Workspace. You can also find a long list of demo applications / modules / connectors under our GitHub account.

    This app’s code can be found in your Workspace under the smartkitchen folder, so you can modify it as you see fit. You can check out the Readme file under the app folder to learn more about it.

    For a deeper dive in scriptr.io, we suggest to check our one-page documentation and our how-to guides.

    Finally, if you have any questions or feedback, we’d love to hear from you at support@scriptr.io.