Environmental Monitoring with Loguino

Whilst I originally designed Loguino to pull data from the MegaSquirt ECU in one of my cars, as a tool its grown way beyond that. Something I always wonder (Usually just after I’ve checked in on the ferry, or crossed into spain…) is ‘did I close the garage door?’ the door is electric, and its easy to forget to close it properly as depending on the state of the door, pressing the close button doesn’t always mean the door will close fully. To quench my paranoia I installed a web cam and used a 3G router and VPN to connect back to my private network. This means I can visually check the state of the garage door from anywhere, whilst I rarely leave the door open, the peace of mind is a wonderful thing.

Looking out of the garage via the webcam

Now that I also have a network connection to the garage, it gave me an opportunity to add some additional monitoring, whilst security is important, there are easier things to rob in the neighborhood, and that’s what locks, alarms, and security guards are for, however with the various leaks, fires, and other disasters that can happen in a garage, I thought it interesting to be able to monitor the temperature, (too cold – I need to turn off the water, too hot – I need to call the fire brigade) humidity, (leaky pipes?) and gas. (Interesting to know what I’m breathing in.)

Arduino Ethernet Board with POE supportUp until now I’ve been relying on the Arduino Mega, this is great for standalone logging as it has many pins, lots of memory, and is very forgiving, however for monitoring a remote site with a few sensors, it is somewhat overkill and lacks an ethernet controller built in. I could of used an Ethernet Shield, however since I don’t need the pins, the Arduino Ethernet makes much more sense, its relatively cheap, small, and has more than enough pins as well as a built in Ethernet controller.

HS1101 Sensor forms an RC circuit to measure relative humidityThis meant doing some work for Loguino, as whilst its modular and doesn’t assume anything in the code about the board, it always had the Arduino mega in mind, since I recently moved to CMake from ARSCons, I decided to get to grips with dependencies a little, and made it easier to use different boards, features which require a specific board are no longer included for other boards. This means selecting Arduino Ethernet as the target will disable things that require second serial ports etc.

From there it was onto the sensors, Antratek are based nearby, so I decided to give them a shot, they had a bunch of interesting sensors mainly from Parallax, for humidity I used a HS1101 which forms an RC circuit and is very easy to use, a CO2, and CO sensor which I haven’t got working yet, TMP102 temperature sensor, and BMP085 barometric pressure sensor, which also has a built in temperature sensor, together making a very nice package. In addition I added a motion sensor.

For the temperature, pressure and humidity sensors it was easy to write a simple poller plugin for each of them, the motion sensor was already supported by the Digital Poller, so required no extra code, however I added the ability to name the output from the digital poller to my todo list.

The ethernet controller required some work too, I made the decision that this would be a server rather than a client, and simply open a socket and print the metric values down the wire to any connected clients, this was easy to code, and works in the same way as the Serial Output Logger, only over a TCP connection. It would be fairly easy to write a client that pushes data to a server using a web service call, but this fits my immediate needs.

Soldering it together was also fairly simple, the BMP085 and TMP105 use I2C and just require a few wires, and the HS1101 uses a simple RC circuit. Once built, it looked like this:Connecting to the device gives the usual loguino CSV output, I wrote a small script that polls the data and puts it into a database which can then be queried with flot.  The TMP102 reads over temperature, so i need to do some work there but its consistent and has been up for about a week in the living room now.

Looking out of the garage via the webcam

2 thoughts on “Environmental Monitoring with Loguino

  1. Hi david,

    This kit looks very interesting. What us the sampling rate for the sensor measurements? I have been working on this recently and we have deployed temperature sensors within people’s homes for diagnosing the thermal properties of their homes and developed algorithms to do so. Give me a shout. I can think of quite a few neat things which we can do with this kit. Sid

    1. Hi Sid,

      The sampling rate is configurable, I’ve set it to a maximum of 2Hz in this case, it also depends on the number of sensors, with this setup, I can poll up to about 30Hz, after which point I think the bottleneck becomes the network or the Serial output drivers as they are both blocking. At the back end I calculate the average of the values over the space of a few seconds to give a smoother value, in the near future I shall update the HS1101 poller to output a smoother value at sample time too.

Leave a Reply

Your email address will not be published. Required fields are marked *