04 February 2015

In my last post Adventures with Arduino part 1 I discussed some of the options of wiring up and getting metrics with Arduino. Here is the work in progress

Arduino Wiring image

It includes a DHT11 humidity temperature sensor, water sensor and a reid switch. The way things are set up is that it polls the sensors periodically e.g.

  • Reid switch (to see if door is open or closed) every 2-10 seconds
  • Humidity and temperature every minute

It then sends those values as a simple comma separated file. Data format I’m using is

device uptime,device name,metric_name=value

with multiple metric values possibly sent in the same packet. On the receiving side I have a Raspberry Pi that follows this work flow.

  • Uses a modified raspberryfriends daemon from nrf24pihub
  • Daemon receives and parses the payload and ships it off to Statsd - using a gauge data type
  • Statsd rolls up any metrics and sends them over to Ganglia. Ganglia is used for trending and data collection e.g. this shows temperature and humidity in one of my bedrooms. You can notice the effect of a room humidifer on humidity in the room :-)

Arduino metrics

  • I can also see if I left my garage door open :-)

Arduino metrics

Arduino metrics

  • In this particular instance that alert has dual meaning since this particular Arduino is driven by one of those “lip-stick” USB battery packs and Ganglia will expire a particular metric if it hasn’t been reported for a defined amount of time (in my case 1 minute). In this particular case alert state UNKNOWN tells me that most likely battery is out I need to recharge it.