Home Monitoring System Details

A geek's Attempt at Home monitoring

This is my attempt at an home monitoring system, in true geek fashion, its not off the shelf, its assembled from reasonably cheap and recycled stuff. At its heart is an Arduino microcontroller and a Raspberry Pi running the Raspdian operating system. This page is not intended as an 'Howto' but as a catalyst for your own ideas. It may give you insights into what you're trying to achieve.

This is my meter cupboard with all the gear used in my setup, or most of the relevent bits anyhow. I have PV solar panels on the roof and I'm keen on knowing what they are doing and how much they are saving me, so I have 4 Electric Meters. The meter labelled [2] is the Generation meter, this is fitted by the company who put the panels in. Its what is used to keep track of how much Electric the panels have generated and you give the reading to your feed in tariff provider to get your FIT payments, everyone with PV panels has one. The meter labelled [4] is the Elecrtric meter that is fitted by your Electric company, everyone has one, without generation capability its how much electric youv'e consumed and the reading you give (or the meter reader comes round to read) to determine how much your bills will be. When you have PV, its how much electric you've imported from the grid. In the UK, these are the meters you have as standard when you have PV, the big problem is that you lose how much you've actually used, part of what you've genarated with the panels is used by the household and the rest is imported and you've no real way of knowing how much you've used, except an educated guess based on what you used before you had the panels. This is why I fitted meters marked [3] and [5]. [3] is my Usage meter, its wired just before the consumer unit and meters how much we're using irrespective of whether the electric has come from the panels or from the grid through the import meter. [4] is the export meter, you can have an "official" export meter which is used in calculating your FIT, but in the UK, its not a requirement and you're deemed to export 50% of what the panels generate. Mine is unofficial, and entirely for my information. The 4 meters means I know much I use and how much the panels save and also give me the ability to check the accuracy of the meters using a bit of maths. For the terminally sad, how much the panels save you can be worked out 2 ways each using 2 of the 4 meters (Generation - Export and Use - Import).


[1] is a Microsoft VX800 USB webcam which can read the meters and the pictures can be stored for future reference [6] is the consumer Unit with all the switches, breakers, ECD etc, all pretty standard unless you've got an old one with old-school fuses. [7] is the Raspberry Pi which hosts this site and does the heavy lifting of drawing the pretty graphs and reading the information from [8] the Arduino which does the information gathering. There is a second identical camera looking at the Gas meter. More furher down......


This the technical bit pulled out from its hidy hole on top of the consumer Unit. Top is the Raspberry Pi, absolutely standard Revision 2 Model B in a fairlly standard headless configuration. You can see the Micro USB power lead on its lower edge next to the SD Card. These are the only power and the only storage used in the system. On the opposite side are the yellow Ethernet lead which runs away to my broadband router and the leads from the two Microsoft VX 800 USB webcams plugged directly into the 2 USB ports.


Pi power supply, pretty standard Micro USB Smart phone charger, please note the Pi can be tetchy about its power supply and some Phone chargers can't provide enough clean power for the Pi. This is the sole power supply for the Pi, The Arduino. the 2 Microsoft VX 800 webcams, the 16*2 display and 5 white LEDS used to illuminate the Meters for the webcams. I bought this one off ebay, and it was sold as a Pi power supply. It works reliably

This is the Arduino, this is the microcontroller that does much of the work in getting the readings from various sensors onto the aforementioned Raspberry Pi, its open source, reasonably cheap and very flexible, just the thing for small robots apparently. In this case its connected to the Pi by a 4 core lead to the GPIO pins on the Raspberry Pi. This serves both to power the little beast and to transfer its readings back to the Pi. The connections to the Pi GPIO are 5V, GND, TX and RX. The TX uses a voltage divider to shift the voltage to 3.3V for the Pi. The Arduino is illustrated alongside a standard USB memory stick for a size comparison.


This unholy mess is a homebrew 'shield' made from a piece of 'Veroboard' type stripboard,some 0.1" connectors and numerous electronic bits to interface the Arduino to the Pi [4], The numerous sensors and relay [1] and [2] ,the 16 *2 LCD display [3] and a power takeoff [5] for the 5 white LEDS used for illumination of the meters. The sensors include the Generation meter that has a built in open-emitter interface to keep track of the PV Panels output, an IR phototransistor stuck over the 'Blinker' on the Usage meter, several DS18S20 'one wire' thermometers, 2 LDRs used as light sensors and a reed switch stuck to the gas meter to track the rotation of the last dial conveniently fitted with a magnet internally for just such a purpose. There is a connection to a home brew 'Solid state relay' to turn the CH bolier on and off


The 16 X 2 character LCD display, shows 6 useful pieces of information without having to start up a computer to look at a web page. Top line, left to right: Present electricty use in Watts,PV Panel Generation in Watts , Central heating set temperature. Bottom line, left to right: Dining room temperature, Living room temperature, Outside Temperature. Apologies for lousy picture, but these panels have to be the worst things to get a clear picture of. Its the practially universal HD44780 compatible, this one 16X2 white on blue background, a few quid on ebay.......


This is the code running on the arduino, Its far from model programming, its got quite a few unused variables and messy bits, but it does work.

This is the bash script running on the Raspberry Pi that is called by a 1 minute interval cron job. Most of it is standard BASH calling standard linux programs. The specials are "nmap" for scanning the network and "rrdtool" to hold the databases and plot the graphs. "rrdtool update" writes varaibles to the round robin databases and "rrdrool graph" plots the graphs from the databases

On its own the above doesn't deal with the arduino, it calls the following BASH script which does that. It communicates with the arduino via ttyUSB0 which is the USB interface to the Arduino. It uses tty to set up the serial interface to suit the arduino.

This is whats transferred from the arduino to the Raspberry Pi(with the exception of the first line which is done by the Pi itself), the arduino actually sends it once every few seconds, but the Pi listens for it once a minute. This avoids timing conflicts between the two.