Connected Kitchens
Connected kitchen appliances have earned some attention over the past few years. Interesting potential applications have emerged, such as for example, using analytics and machine learning to analyze the content of fridges and identify consumption patterns, in order to refine the supply chain and better match demand to supply.
At a lesser sophistication degree, there are also many use cases where connected kitchens bring value, such as preserving food safety, monitoring cooking processes or controlling power consumption.
In this blog, we describe the implementation of a connected kitchen prototype specifically addressing food safety and the monitoring of the cooking process, by connecting a fridge and an oven to an application built and ran on scriptr. For this prototype, we will be specifically using the following components:
- A Nebula 2.0 Development Board,
- An STM32 (B-L475E-IOT01A) development board,
- scriptr’s Connected Kitchen demo application
Solution overview
- The Nebula board collects fridge temperature and humidity measurements as well as door status. It publishes them through mqtt to scriptr. The board also receives instructions via mqtt (close/open door, turn maintenance signal on) sent by the application
- The STM32 board collects oven temperature and humidity measurements as well as door status. It publishes them to a Watson IoT topic, to which the connected kitchen application running on scriptr is subscribed, which allows it to immediately receive any published message
- The connected kitchen application is implemented with, and runs on, the scritpr platform. It provides the following features:
-
- Monitor the status of the fridge and oven and display current and historical data in both a dashboard and an event log
-
- Define and apply business rules on the received data and trigger alerts via SMS and email whenever rules are verified
-
- Allow the user to schedule maintenance requests, resulting in the creation of tickets in Zoho desk SaaS
-
Configuring the connected Kitchen application
First, deploy the application into your scriptr account by fetching it from Github
(if you do not know how to deploy the content of a Github repository in your scriptr account, read this short tutorial)
Prerequisites
This application requires you to have an online redis service, a zoho desk account and a twilio account. If you don’t:
- Sign-up for a free tier account on Redis Lab (or any other provider)
- Sign-up for a free tier account on Zoho
- Sign-up for a free account on Twilio
You also need to install scriptr’s UIComponent library in your account. Check this short tutorial to learn how to do that.
Customize the installation and configuration scripts
Open the “smartkitchens/install/install.auto.script” script and apply the following changes:
- Scroll to “//SETUP THE connection to the REDIS instance to use” and set the value of the “url” property to your redis endpoint (as specified by your provider)
- Scroll to the section related to the creation of an stmicro device (/** Create the stmicro device **/) :
replace the values of the “id” and “name” property with the identifier that you provide when configuring the STM32
board (see “STM32 B-L475E-IOT01A” paragraph below) - Scroll to “//Setup the mqtt connection instance (ibm free tier)” and replace “stm32iot01a1” in the “topic” property with the id you’ve chosen for your stm device. Also replace the value after “type” withe the type you’ve specified when configuring the device. Example: ‘topic’: ‘iot-2/type/stm32/id/stm32iot01a1/evt/+/fmt/json’ –> iot-2/type/sometype/id/mydeviuce1234/evt/+/fmt/json’,
- Scroll to “//Link the bridge to the channel for publishing messages” and replace “stmicro” in “devices.get(“stmicro”)” with the the id you’ve chosen for your stm device
Open the “smartkitchens/entities/config” script and apply the following changes:
– configure twilio –
- Scroll to the “twilio” variable and change the following:
- set the “accountSID” and “authToken” properties to the corresponding values obtained from twilio
- set the “supportAuthToken” property to your own token (to generate a token, read this doc)
- set the “from” property to your mobile phone number
– configure zoho –
- Scroll to the “zoho” variable and change change the following:
- set the “TO_EMAIL” property to your email address
- set the “supportAuthToken” property to your own token (to generate a token, read this doc)
- set the “department” property to the name of a department you have created in zoho
Once you’re done customizing these two scripts, run the “smartkitchens/install/install.auto.script” from the scriptr workspace.
Installing the boards
Nebula 2.0
In our demo, the Nebula 2.0 device is directly sending and receiving data to/from scriptr, which requires installing the scriptr client that takes care of the back and forth communication with the application on our platform (via mqtt). Just follow the instructions to configure the device to connect to scriptr.
NOTE – when reading the “Scriptr.io configuration” section of the instruction file mentioned above, apply the following changes:
- Skip steps 1 to 4
- In steps 5 and 6, the channel to use is “nebulaDigest” (as created by the installation script) not “nebula-demo”
STM32 B-L475E-IOT01A
As mentioned, the STM32 board publishes data to a topic hosted on IBM Watson IoT. You can refer to STMicroelectronics’ standard documentation on the subject to configure your board. Note that you also need to download ST’s software kit.
NOTE – During the configuration procedure, the board will ask you to specify if your wish to use the Watson IoT quickstart mqtt, or registration. Select 1 (quickstart)
Enter Registration Mode (1 - Quickstart, 2 - Simple):
The device will then ask you to provide a connection adopting the following template: DeviceType=xxx;DeviceId=xxx
You have selected the Quickstart registration mode. Enter the Bluemix connection string of your device:
Enter a type (e.g. STM32) and a name (try to come up with a unique name). Write them down as you will need them when customizing the installation script (see the “Customize the installation and configuration scripts” paragraph)
Operate the system
Monitoring the kichen
The connected kitchen application lands on a map with markers of the kitchens managed by the logged in user (1 in our case)
- Clicking of the kitchen market will display the following live data: location, type, building, last reading date, oven data (temperature, humidity, door status) and fridge data (temperature, humidity, door status)
- Clicking on view dashboard button from the info window on the map, or from the menu dashboard > real time and selecting the kitchen displays a live dashboard. Current values are displayed in gauges whereas historical data are available in a line chart
- Clicking on the “Schedule Fridge Service” button from the info window on the map, sends a command to the fridge nebula board leading to lighting up LED 2 won the board. The button is disabled with a label “Fridge Service Scheduled” and a zoho ticket is automatically created on Zoho desk account in the “open”state
Using the fridge (nebula device)
Button 1
- Enable periodic publish mode by double clicking “button 1” (led 1 will be turned on)
- Disable periodic publish mode by double clicking “button 1” again (led 1 will be turned off)
- Led 3 is turned on when the device receives a mesage
Button 2
When the user clicks button 2 on the nebula board:
- LED 2 is turned off
- On the application’s side, it is possible again to schedule for Fridge service
- The ticket status is set to closed
Using the oven (STM32 device)
- Enable periodic publish mode by double clicking the user button
- Disable periodic publish mode by double clicking user button again