Food waste is a colossal social, environmental, and economic issue. The United States Environmental Protection Agency estimates that as much as 40% of the food that is grown and processed in the United States will never be consumed.
FOOD waste isn’t just a big picture problem. When your business model relies on fresh, delicious, and safe to eat food, optimizing your entire cold chain to keep things at the right temperature is your first priority. All it takes is an open freezer door forgotten by a distracted employee—we’re looking at you, Adrian—and you’ve lost product, and that means profit.
You’re the manager of an ice cream factory. Today is the first day you could call the weather “sizzling”. It’s ice cream season. As you survey your factory floor you smile with satisfaction at the contrasting hues of freshly packed pints of pistachio, coffee toffee crunch, and cherry cheesecake.
Tomorrow you’ll discover that one of your state-of-the-art commercial freezers died peacefully in the night while you were sleeping and didn’t bother to utter any last words. An entire shipment of decadent ice cream is ruined.
But what if it could text you at 2 AM to let you know it was running hot? Or that Adrian had, yet again, left the door open too long? And what if you had temperature logs you could refer to when you need to investigate a freezer malfunction?
A texting, data-logging commercial freezer? We can build that with Temboo.
We designed a simple commercial freezer monitor application that reduces food waste and profit loss. How did we do it?
Most of the heavy lifting of our freezer monitor is done virtually in the cloud, enabling a low-cost microcontroller to run complex applications unhindered by its limited RAM and processing power.
With Temboo’s Profiles feature, we can reprogram parts of our application right in the web browser without writing a single line of code or disconnecting our hardware.
This application sends text message alerts via Temboo's Twilio SendSMS Choreo to a designated phone number whenever the freezer’s door is open too long, or if its temperature edges outside the acceptable range.
This freezer monitor application regularly logs timestamped temperature data to Amazon’s DynamoDB, a NoSQL database service, and Temboo's newest Choreo release. We add a new item to our database table with the DynamoDB PutItem Choreo.
An Arduino Yún provides the brain power and WiFi connectivity.
A magnetic contact switch to determine whether the door is open
A TI LMT84 analog temperature sensor, which we selected for its low cost and accuracy over a broad temperature range.
For more details on working with temperature data, refer to this practical guide to selecting the right temperature sensor for your IoT application.
A 10KΩ resistor and a breadboard
Step 1: Hooking Up Power Connect the Arduino’s GND pin to the breadboard’s ground bus strip. Connect the 3.3v pin to the voltage supply bus strip.
Step 2: Connecting the Temperature Sensor Connect the left leg of the TI LMT84 to voltage, and the right leg to ground. Next, connect the middle leg to the analog A0 pin.
Step 3: Connecting the Door Sensor On the breadboard, connect one leg of the door sensor to digital pin 7 through a 10KΩ resistor . Connect the other leg of the door sensor to ground.
Be sure your Yún’s WiFi is properly configured, or that it is connected to the Internet via Ethernet.
1. Follow the Twilio setup instructions to use Twilio Choreos
- Follow the DynamoDB setup instructions to use DynamoDB Choreos.
- In the DynamoDB Console, click Create Table to create a new DynamoDB database table for logging your freezer data. Name your table whatever you like. For the Primary key, in the Partition key field, type “Timestamp”. Set the data type to String.
- Download the freezerMonitor example code from GitHub.
- At the top of the example code in lines 50 and 51, replace “myDynamoDBProfile” and “myTwilioProfile” with the names of the Temboo profiles you created for DynamoDB and Twilio.
- Enter your Temboo account information in the TembooAccount.h header file. You can find this information on your account page if you’re logged in to Temboo.
Upload the code to your Yún, mount your hardware, and start getting text alerts right from your commercial freezer.
- We wouldn’t recommend putting your microcontroller board inside the freezer, so be sure to use wires long enough to connect the breadboard to a microcontroller board mounted somewhere outside the freezer.
- When determining placement for the temperature sensor, be sure to put it in a location that is representative of the average temperature of the commercial freezer. Somewhere in the middle of the freezer is generally best. If the sensor is too close to the door, its readings may be significantly warmer than the average temperature of the freezer. Conversely, placing the sensor too close to the discharge air stream coming from the freezer’s compressor can give readings that are significantly colder.
- Determine the temperature range suited to your application. The Arduino code contains variables you may set for the safe range of freezer temperatures. Anything outside this range will trigger an alert. Your optimal temperature range depends on your particular usage. For instance, the commercial ice cream freezer in this story would require a different temperature range than a vaccine refrigerator.
- Don’t make the temperature range to trigger alerts too narrow. Keep the thermostat cycles of your freezer’s compressor in mind. For example, if a refrigerator’s compressor has a cut in point of 4.4ºC and a cut out point of 2.7ºC, setting a range of 3–4ºC will result in unnecessary alerts. Test out the temperature range settings in the code to be sure they will reflect normal operating conditions for the particular equipment you’re monitoring.
- Observe the freezer’s usage patterns in order to determine the best setting for receiving open door alerts for your application. The code includes variables for setting the maximum amount of time the freezer may be open before an alert is triggered. The ideal setting will depend on the sensitivity of the freezer contents and the day-to-day activity around the freezer. For example, in normal usage of a commercial freezer, it might be open for several minutes while it is being stocked with freshly made product waiting to ship.
- If the timestamps generated by your device yield unexpected results, you may need to set the date and time on your board. The Yún’s configuration settings, including WiFi, can be set from its local webpage.
Temboo provides official support for several microcontrollers, including Texas Instruments’ LaunchPad and the Samsung ARTIK.
Our combination of Twilio and Amazon DynamoDB is just one of many possibilities. What else could you use?
- Send an SMS via Nexmo
- Make an automated phone call via Nexmo
- Send a direct message from a Twitter account
- Send an email from a Gmail account
- Send an email from any email server
- Create a new Zendesk ticket
Want to use an API that doesn’t have Choreos yet? Simplify it with Temboo's HTTP Utilities.
It’s not just commercial freezers that store valuable assets in need of a watchful eye. This example code can easily be adapted to create a door and temperature monitor for a range of applications across industries.
Medical and life sciences
- Laboratory sample cold storage
- Pharmacy and vaccine refrigerators
Food & beverage
- Commercial refrigerators
- Walk-in freezers
- Data centers
- Server rooms
With the addition of a humidity sensor, this monitor could be adapted for even more applications. With the right temperature range settings, it would be suitable for storage cabinets containing rare books and antiques or other sensitive materials, or for manufacturing and storage environments where environmental precision is key, such as in a brewery or distillery fermentation room or a wine cellar.
If you use this commercial freezer monitor for yourself, or find it to be a useful reference in building your own IoT application, the folks at Temboo would love to know and they may even feature your solution in an upcoming blog post.