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

Loguino 1.0

I’ve been working on Loguino for a few months now, and the first stable release is now available.  Loguino is a data-logging solution based around commodity(Arduino) hardware. Underneath is a powerful data-logging framework that can be adapted to log just about anything. Loguino focuses on data capture, rather than analysis or visualization. It was born out of the need to capture data from a Microsquirt ecu without a laptop connected, but has evolved into a more generic tool. 

Loguino can log from the following inputs:

  • Megasquirt Automotive Engine Control Units
  • LIS331 Accelerometers
  • ITG3200 3 Axis Gyro
  • NMEA Compatible GPS Devices
  • Analog Pins (Voltage)
  • Digital Inputs (High/Low)

Loguino writes output to the following outputs:

  • SD Cards
  • Serial Devices

Each poller and logger is optional, enabling and disabling features is easy using a configuration file at build time.

Loguino is built using cmake, and is designed around the arduino mega, although other boards will work just fine.

There are a few of us using it now, and I feel its stable enough that others might also find it useful. 

I have a few code improvements I want to roll out in the coming weeks to make things more pluggable as per the design, then I’ll focus on the following features:

  • Download from SD via Serial
  • Add a lifetime to metrics
  • Add throttling
  • CANBUS Support

Loguino is hosted on google code at: http://code.google.com/p/loguino/

I hope some of you find it useful, and I’d be delighted to hear from anybody who is interested in using loguino.