Image 1: DELOS INC. PCB
Image 2: Full Setup : Left - Node-RED Architecture, Center Screen - Dashboard, Center - Device Setup, Right - CLI Control and Logging
Image 3: Design Overview
Image 4: Node-RED Flow
Image 5: PCB Schematic
Image 6: PCB 2D trace profile
Image 7: PCB 3D profile
Image 8: Fabricated PCB
Image 9: Image of a Hot coffee mug captured on Thermal Camera (reproduced on MATLAB)
Image 10: Testing Thermal Camera with multiple objects at varying distances from the camera
Image 11: Solid works assembly for the Setup
Image 12: The Actual Setup of our application
Image 13: Delos PCB on the setup
Image 14: Prototyping on ATSAMW25 Xplained Pro board
Image 15: The team : Mohith
Image 16: The team : Tushar
Most of us wish to get back home from a long day at school or work and have some hot, freshly cooked food. But this rarely happens because most of us have no energy to cook after a long tiring day. Thus, we end up cooking the food before we leave to work/school and microwave it whenever we get back home. The food doesn’t taste that good anymore and we all hate it! How do we solve this problem! We recently observed that most of the traditional kitchen stoves have knobs that are removable and replaceable. We wondered if we could have smart knobs that could be controlled remotely thus, enabling us to schedule or plan our cooking even if we are not home. Moreover, a remotely controllable knob would help us avoid so many fire related disasters caused in kitchens due to our forgetfulness to turn off the stoves..
What it does
- An interactive UI allows the user to check status of the controllable stoves and allows control of the knobs.
- The user can set up different heat levels and cook times for the knob and schedule the cooking tasks.
- The communication between the user device and the knob happens over MQTT and the user makes different control requests over different MQTT topics.
- While the cooking is in progress, a thermal camera reads a thermal image of the stove and streams live temperature data onto the interactive UI.
- A servo feedback is also used to determine exact position of the knob. The data can be viewed on the UI using the motor gauge.
- The user can check for device details using an interactive CLI. Upon running the application, pressing SW0 triggers the entry into CLI.
- The user has the provision to trigger an Over the air firmware update request from the interactive UI.
How we built it
The project has been implemented on a custom PCB that houses the Atmel SAMD21G18A MCU and is designed using Altium Studio . The MCU is powered by both the USB port and the external LiPo battery supply (Battery option for remote operation). The PCB also comprises of a power management circuit, an FTDI chip for the USB drivers and a thermal camera sensor interfaced over I2C.
The bootloader was one of the most important design aspects that the team undertook. The bootloader has been successfully implemented to handle firmware updates through SD card as well as a remote HTTP server. The bootloader decides to either update the NVM with a new firmware image or continue to use an existing image based on the version number present in the bootloader metadata. Once a new image is written onto the NVM, we read the image to calculate CRC32 and verify the same with the CRC available as a part of the file metadata.
The bootloader jumps to the application on seeing an app at the designated NVM address (0x9C00 for our implementation) or when it successfully writes the new firmware to the aforementioned NVM block.
Command line interface
The command line interface in the application code, gives the user options to explore lighter functions available on the device. The CLI "help" command lists the available commands that the user can call. The available commands on the device are as follows:
- ver_bl : To check the bootloader version
- ver_app : To check the application version
- mac : To check the device MAC address
- ip : To check the device IP address
- setDeviceName : To set a device name
- getDeviceName : To fetch the device name
- otafu : To trigger an Over the air firmware update
The Over the Air Firmware Update module is integral to the application code. The module polls for user input from the dashboard and the same triggers the OTAFU logic. First, the incoming version and the current versions are checked, if they are same, the module exits. On realizing that the incoming version is greater than the previous version, the device triggers a firmware download from the HTTP server and stores it in the SD card. Once these operations are complete, a software reset is made to restart the device and run the bootloader to update the new image in the NVM.
Thermal Camera Interaction
The thermal camera interfacing allows the user to monitor the stoves as well as receive live data about the stove temperatures on Node-Red dashboard. The implementation has been done in the following manner
- The MCU first queries for the sensor over I2C, based on the sensors pre-defined address.
- Upon successful handshaking, the sensor sends the captured data in 128 bytes with 2 bytes representing individual pixel (64 pixels).
- This data is filtered from the received stream and parsed into a 8*8 matrix.
- A thermal image is constructed from the pixel data by mapping different temperature values to different colors (Image 9 and 10).
- The region of interest is localized and the pixel values are averaged to determine the value to be published. Before publishing, an error correction is done to ensure that the values are accurate.
Analog Feedback Servo Motor Actuation
- The analog feedback motor is used to turn the knob to different angles by sending PWM signals. The servo motor requires a PWM signal that has a period of 20ms with the duty cycle varying from 1ms to 2ms.
- TCC1 timer module is used with a prescalar value of 16 for generating the required signlas
- Further, in order to ensure that the motor has turned to an expected angle, we use an analog feedback line from the motor.
- Using ADC, we fetch the motor feedback and calculate a moving average to smoothen the values received.
- The motor angle is then published to the Node-red dashboard over MQTT.
The Node-red architecture acts as a backend to our interactive UI. Our Node-red flow constitutes the following modules(Image 4):
- Buttons to control the Stove selection, Heat level selection, Cook Time selection, Start/Stop, Firmware update request
- A Big timer module to time the cooking
- MQTT subscribers and publishers for various topics
- Gauges to display the temperature as well as the motor feedback status
- Function blocks to perform various logical operations
- LED's to display the status of various operations
- Notification API to display the notifications on UI
- twilio module to send text messages to the users whenever the temperature goes beyond a certain limit
Challenges we ran into
- Verifying that the PCB design did not have any errors was very important. The PCB that we received did not work initially. So, we had to debug the various components and traverse the circuit to determine the the problems. We finally unearthed some issues with the connections and the soldering to get the board working.
- Figuring out the way to download multiple files from the HTTP server and then multiplex between using the HTTP and the MQTT sockets was challenging.
- Interfacing the thermal camera and determining how communication between the sensor and the MCU is working was not easy. This was because the stream was differently structured every time and we had to visually investigate the stream to find the data we were interested in.
- Whenever we tried to connect to WiFi, our board used to reset. We figured that the issue was with the power delivered by the USB and had to resolve it by giving an external power supply.
Accomplishments that we're proud of
- We were successful in getting our custom PCB up and be able to run our application on it.
- We were able to interface the MCU with the thermal camera to get the pixel information and construct the required image from it.
- We were able to test the end to end functionality to ensure that all the corner scenarios were covered and the overall firmware design was robust.
- We were able to get the Over the air firmware update working and were also able to download multiple files at a time from the remote HTTP server
- The design of the setup was done using Solidworks and fabricated at the laser cutting lab. Both these aspects were very new to us and we are proud that we were able to pull off an aesthetically pleasing setup.
- We experimented with some new API's on Nodered such as the twilio messaging service, the Big timer and the heatmap generator to make our system more cooler!
What we learned
- Altium Designer for the PCB design
- Various API's available on Atmel Studio to utilize the modules such as Timers, ADC's, WINC1500, 12C Communication, SPI Communication, MQTT based communication etc.
- Understanding the ways and means to deal with the NVM and how to debug issues at the hardware level.
- How to use Nore-red dashboard and its API's to create an interactive application.
- Solid Works for Setup Design
- How to build an IOT application!!!
What's next for IOT Smart Kitchen Knob
- Design an easy to plug-in knob that can replace traditional kitchen knobs.
- Leverage the application by adding a camera to determine the kind of objects placed on stove, using image processing
- Optimize the board size and decrease its form factor
- Stream the image of the stove onto the Node-Red dashboard
- Optimize the overall design to attain better battery efficiency