Drink Responsibly with a Smart Coaster Written by: Jason Segarra Published: August 25, 2023 Projects Tags: IoT devices | Prototypes | Retail The phone in your pocket. The watch on your wrist. The lights in your kitchen and even your refrigerator. IoT devices are growing more omnipresent by the day. At this year’s Soracom Discovery, our marquee annual event showcasing the latest and greatest IoT technology, one of our developers presented a new connected device that may find its way into your home, your favorite restaurant, or wherever you enjoy a cold beverage – the smart coaster. Initially developed during the ideation period of the prototyping booth at Soracom Discovery 2023, the smart coaster project was born out of a desire to meet the growing interest in avoiding overconsumption. The developer said that he enjoyed a beer or two now and then, but wanted to find a way to stay mindful of his drinking and avoid hangovers. From there, the concept of a small device that allows users to monitor how much they are drinking– and to send notifications if they start to go overboard– resulted in a smart coaster prototype. Disclaimer: The products introduced in this article (concepts, circuits, system implementations, etc.) are concept implementations prototyped by employees. Soracom does not recommend the composition of this product. Any attempt to recreate these results is done at your own risk. Configuring the Smart Coasters Now in refinement as a concept, the coaster-like device is equipped with an analog pressure sensor for detecting weight, as well as a full-color LED for displaying accumulated data and notifications. The build for this project as detailed by our developer: Materials The Coaster Body We used the exterior of a light-up coaster purchased at a local shop that can react to the weight of a drink by illuminating an LED. The Pressure Sensor We used a simple analog sensor with variable resistance up to 4lbs (2kg) that was purchased on Amazon. 3 full-color LEDs Seeeduino XIAO ESP32S3 (Used for control) Lithium polymer battery (300mAh) Other resistors, wires, universal substrates The Interior and Casing The end result of our smart coaster prototype looks like this. The wiring, as pictured, is more complicated than it may need to be because the construction utilized a number of ready-made products, but the configuration is as follows. Disassembled the ready-made coaster. We cut the molded plastic where necessary to accommodate additional components, then arranged the parts to fit the space. Affixed the pressure sensor (seen on the left side of the photo above) behind the hole where the coaster’s push button switch was exposed (on the battery on the right side of the photo) Weight detection is enabled by inserting the cut tip of a disposable chopstick through the hole and pushing in the pressure sensor. The part where the Seeeduino XIAO ESP32S3 is exposed was the original location of the device’s battery. This does mean that the lid just barely closed, though the prototype was used in an open state during the exhibition to enable charging and debugging; for our initial-build purposes, this was acceptable. Creating the Smart Coaster System The overall system configuration for the Smart Coaster is shown below. Operational Overview Connected to Soracom via Soracom Arc using the Seeeduino XIAO (ESP32S3) Wi-Fi and WireGuard-ESP32-Arduino Data is sent to HTTP entry point and accumulate in Soracom Harvest Data The sensor value of the pressure sensor is visualized using Soracom Lagoon, with notifications handled by Slack Slack notifies users of events such as milestones or thresholds reached (i.e. drinks finished) Metadata service manages the threshold for sending data and the lighting color of the LED when there is no load Program Click here for implementation. Smart coasters need to perform communication and LED output while also acquiring and sampling sensor data. In order to utilize the high performance of ESP32 and run multiple tasks in parallel at the same time, we have adopted a multitasking configuration using FreeRTOS. Specifically, the following four tasks are executed: Acquisition and filtering of pressure sensor data Full color LED control Sending data to Soracom Harvest Acquisition of setting values by Metadata Service Queues are used for some of the task-to-task communications to separate implementation responsibilities and improve the efficiency of schedule execution. A particular point devised in this implementation was the use of a metadata service that allows information to be linked to a SIM. In fact, the circuit built on the breadboard and the one that comes pre-cased should have the same components and configuration, but for some reason, the pressure sensor values are output differently. By saving parameters such as thresholds in the metadata service, and making the program configured to retrieve them from the device side, however, it becomes possible to arbitrarily change the setting values from the user console for each individual (SIM or SIM group). Using this setup, our team was able to get the firmware on the hardware side to work with almost identical programs. Conclusion When we debuted the Smart Coaster concept at the prototyping corner, it was a popular stop for inquisitive customers. In particular, the prevailing heatwave defining this summer through much of the world sparked a high level of interest among those who are considering managing their water intake. We actually exhibited two versions at Soracom Discovery: one with a casing and the other with a circuit built on a breadboard (as in this prototyping). Though it is not quite a finished product, that’s not to say someone couldn’t take the example and create one! As a prototype, the Smart Coaster is still a work in progress. The weight measurements can fluctuate wildly; weight has large fluctuations depending on the place where pressure is applied and the material, so we had to give up on converting it to a physical quantity due to time constraints. Through the implementation of the smart coaster concept this time, personally, it has become easier to obtain a small Wi-Fi compatible microcomputer, so small devices can be connected to SORACOM and used, and the recognition and utilization of the metadata service is spread. ―Note: This piece is based on this post originally created by Soracom CRE Hisaya Okada …………………….. Creating your own prototype IoT device? We can help! Speak with our team of specialists today and see why Soracom helps power over 5 million IoT devices across the globe. Click here.