DHT Support for Loguino

The DHT range of sensors provide a cheap way to grab temperature and humidity information. The sensors are not fast, (250ms per query) but have a good price and require only a single digital pin to use.  Kyle had a few sitting around, so I added loguino support for them.

Loguino support for DS18B20 temperature sensors

The Maxim DS18B20 digital thermometer provides 9-bit to 12-bit Celsius temperature measurements over a 1-Wire interface providing accurate and inexpensive temperature readings.

Kyle Gordon contributed some code that builds on Jim Studt‘s 1-Wire library and Jordan Hochenbaum’s DallasTemperature implementation to integrate into Loguino.

Now you can enable the DS18B20Poller and loguino will capture temperatures from any attached DS180 series sensors.


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.

Automotive Arduino Power Regulator

Jonathon Oxer and Hugh Blemings describe an excellent power regulator for Arduino in automotive applications in their book “Practical Arduino Projects”. Loguino doesnt need to be notified about a power failure, but it did seem sensible to be able to provide a buffer which may help when the car is being started.

Parts List

  • IC1: LM294OCT-5 – An automotive grade 5v regulator
  • D1: 1N4001 Diode
  • F1: 3A Fuse
  • C1: 100uf Capacitor
  • C2: 47uf electrolytic capacitor ideally rated to 16v max
  • C3: 47000uf capactor, rated to at least 60v


Loguino Data Aquisition for Arduino

I’ve been interested in capturing data from the seven since the moment I could drive it. I’ve looked at commercial data loggers, and there are plenty of good options, I use the ETB Digidash on the Fury, and it’s very competent, not least in the analysis software.

For the seven though, I didn’t feel there was a good fit for a number of reasons:

  • not many data logging tools support reading data from the megasquirt ECU, which is critical to get any information about the engine at runtime.
  • Many data loggers are geared towards providing an in car display system, but I already have a working dashboard that I like.
  • Usually they are limited to a number of channels, each channel having a predefined function or purpose.
So I decided one day to make my own, my first step was the bifferboard, this is a 486pc on a chip, it was easy to program since it runs linux, but it wasn’t the right tool for the job.  I’d hear lots of good things about Arduino, an embedded platform, and once I got my head around the API, it was clear this was the perfect solution, and shortly thereafter loguino was born.
Loguino itself is a generic logging platform, it functions a little bit like log4perl/java/etc in that you have a logging class that accepts log messages, and logger outputs that take those messages and do something meaningful with them.  Most of the time this is simply write the message to a disk, or output it over the serial line, but it could be used to control shift lights or any other task too.
Data is generated by pollers, pollers are polled periodically and generate messages which are picked up by the loggers.  The first task was to write one for the megasquirt, this allows me to pull engine data directly into the logging tool. The next step was gps speed and positioning, and then support for accelerometers and gyroscopes.
I chose a very simple logging format, rather than use columns, I decided to use key value pairs, this means the tool can be completely agnostic about formatting, time, and everything else.  My view is that once data is downloaded of the loguino, it will go into a database and be queried.  Having seen google chart, and flot, I decided there was no real need to use excel or write complex software, instead it should be a case of adding and removing series, and scaling them.  This spawned metriflot, a data visualization package, and was a great way for me to learn some Ajax and django.
Having tested loguino over the summer, I’ll be doing a permanent install over the winter with wheel speed sensors, brake temperature, pressure, and all sorts of other sensors, and generally tidying up the packaging.  Next year I’ll be able to concentrate on the analysis where I want to have more intelligent data trending, for example:
  • Is the engine temperature hot because of the outside temperature, speed, or a fault?
  • Is the oil pump failing or was i just not driving hard enough?
There is a lot of potential here, as well as a good chance for me to learn more about electronics and data analysis, and hopefully it will benefit others too.
Loguino was released under the GPL license, and is hosted on google code.