Building a temperature display and alarm by SMS
using the Industruino PROTO platform
A friend asked me to build an alarm system for a cool room in a seafood restaurant. It uses a standard DS18B20 temperature sensor, and a simple SIM800L module with serial communication. I chose the Leonardo style 32u4 topboard, because 32kB is sufficient for this simple application, even using the relatively large U8G display library.
- measure the temperature and display the current temperature on the home screen
- display the minimum and maximum of the allowed temperature range on the home screen
- send test SMS from the home screen
- enter a setup screen to change the above min/max settings with the membrane buttons, and save to EEPROM
- when receiving a incoming call, hang up and send an SMS to the designated phone number with temperature
- sound alarm (piezo buzzer) when the temperature is outside the allowed range, and send an alarm SMS to the designated number
- repeat the alarm SMS every 10min if still outside the allowed range
After unpacking the Industruino PROTO kit, i made a first prototype, using the screw connectors to connect the componets that i had on the breadboard, with no need to solder anything yet. The version of the SIM800L module that i got works on 5V, which is more convenient that other versions that take max 4V.
I used the SoftwareSerial library to communicate with the SIM800, which allowed me to use the hardware serial for the usual uploading and debugging, without having to change any wiring.
The DS18B20 temperature sensor requires the OneWire library, and a pull-up resistor.
For the display i used the U8G library over the standard SPI interface.
As i'm using 2 different size fonts (large and small), and have quite a few screens, i quickly got to the 28kB max sketch size. At the end i decided not to use the tone(pin, freq) command to drive my passive piezo buzzer, but rather use an active buzzer and simply do a digitalWrite(pin, HIGH) to switch it on, that seems to save several kB's in compiled code.
As soon as this prototype was working, i soldered the components on the PROTO baseboard. Plenty of space on the board.
I added a large capacitor, and the active buzzer in the front.
I used a female pin header to be able to remove the SIM800 module, for inserting the SIM card.
3 wires in the bottom are the DS18B20 temperature sensor, with the pull-up resistor on the baseboard.
This is the bottom side of the PROTO baseboard with the above components installed.
Testing the system with my fridge.