It is probably the most obvious and straight-forward IoT project there is but for me it was a chance to try some technology I haven’t had a chance to use – the ‘ol ‘monitor the temperature and display some pretty graphs’ project. Much of what I have used is overkill for the need but provides a good base of knowledge for something bigger.
Monitor the temperature of up to 20 reptile enclosures, logging the data to ensure an optimal environment, particularly during the winter cooling period and correlate successful breeding with winter temperatures.
Using every buzz-word in one project… IoT, “the cloud”, AWS, Python.
I’ll go in to more detail on each part in future posts to set the scene this is how it went.
Part 1. Sensors
I need around 20 sensors spread over two sides of a room so the DS18B20 sensors in a waterproof housing are a good option. Cheap (on ebay) and communicate via digitial signal over a 3 wire bus (incl. power & ground) so less wiring and no noise/voltage drop issues from an analog sensor.
Part 2. Arduino / Particle Photon
Two of a number of options for wifi connected micro-controllers. Read the sensors from the bus on a digital input and broadcast through MQTT. The use of MQTT means any number of devices can be connected to any number (within reason) of sensors without the upstream processing needing to know or care. JSON allows data to be encoded in a human readable and easy to integrate in python format. Sure the payload is larger than a binary message, but in this case, who cares?
Sneak-peek : The Photon is much better than the arduino in this context. The new raspberry pi zero W would also do the job with a 5 line shell script at AUD$15.
Side-note: Am I old for realising the Pi Zero W is more powerful than the first $10k I spent on computers?
Part 3. MQTT Broker
Handy gateway to “the cloud”, down-sampling data, adding sensor -> location mapping plus security and buffering to the MQTT connection to the cloud.
Part 4. Storage
A database as you expect. NoSQL and in the cloud : because I can… And so I can access the data outside my network without opening up my ports.
Part 5. Display
On the web, using python and one of the many charting libraries, hosted in the cloud. If 100,000 people want to view the temperature I keep my S. ciliaris at they can, if I pay for the capacity…. And again, I don’t need to open my ports.
This was an opportunity to try flask and bokeh python libraries for web-framework and charting respectively. Django and google charts would be fine too.
I haven’t put much effort in to the display so far so it is pretty basic and clunky but works as a proof of concept.
Check it out for yourself live : YarraRiverReptiles Live!
This is still a work in progress, things to clean up and features to add but it is a start. If you are interested in more details, check out the follow up posts over the next few weeks or get in touch.