Maketober Day 2: Remote temperature monitoring
/I’d rather like to be able to monitor the temperature around the house. The heating system tells me the temperature but I’m not sure what this means when I’m sitting in the living room several feet away from the radiator. I’m also keen to test something I got a while back. It’s called a Cricket and it is tiny microcontroller that is specifically designed to do just what I want, which is read the temperature every now and then and send it onto the network. I want to have a battery powered sensor and want the batteries to last forever-ish.
Previously I’d be looking at LoRa (Low Powered Radio) devices to do this but they are a bit complicated to set up. The Cricket claims to give you LoRa style battery life with WiFi connectivity. I should be able to power it from a pair of AA batteries for a good long time. The Cricket achieves this by optimising the time that it takes to connect to the network and send a data packet. It seems to take around four seconds to do this, which is pretty impressive. It has one input for sensing data and another for triggering a transmission. It also has a real time clock which can be used to trigger updates. And there is an onboard temperature sensor which I can use to get my readings.
Once you’ve soldered (badly in my case) the battery pack to the Cricket you then have to attach it to your WiFi. This is done in the “traditional” way of WiFi devices. Hold down a button to trigger Access Point mode, browse to the WiFi hotspot that the device has just created, open up a web page there and enter your WiFi SSID and password. Then you have to configure your device to tell it what data to gather and where to send it. You might think that you’d do this on the device but no, you do it via a browser. Each Cricket has an unique ID on a label on the back. You log into the developer portal, find your device by its name and then use a web interface to configure it.
You can configure the real time clock to wake up the sensor in time measured in hours, minutes or seconds. You can also use a digital or analogue input to wake the sensor up and make it send a reading. The reading can be sent as an HTTP Post to a web address or you can use MQTT. Things On Edge provide their own MQTT server or you can use your own. I’m going to use theirs.
The idea is that you enter your settings into the web page, press Save and then press the button on the sensor to make it connect to the server, upload a value and then check for new settings. This took a bit of fiddling for me, but eventually I made a sensor that wakes up every five minutes and sends a temperature reading.
Above you can see the display from the MQTTBox program on the PC showing that temperature readings are being sent up to the server. Next I need a device to get those values and display them. But that’s a job for tomorrow.