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 tiny server running a Ubuntu Linux 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 the centre of the operation, Its an old computer desk I built years ago and this is the 'cupboard' that held the Tower Unit (keeps the messy bits out of view), The white thing at the right hand side, is an ISP provided ADSL router (Its the 'Livebox' provided by Orange in the UK if you want specifics). Its what provides me with an internet connection and you with a means of reading this, since its hosted on the little black box near the front of the cupboard. Its a Viglen MPC-L, which is a Geode 'Computer on a chip' system sold by Viglen in the UK at very reasonable money (79 GBP if you twist their arm). Its about the size of 3 CD cases stacked together and has 256Mb RAM, 80 Gb laptop drive and the 400Mhz Geode processor. Its running Ubuntu 8.04 server which runs reasonably well after some messing about with the installation, the troublesome bits revolve around it having a crude BIOS with no PNP or ACPI support and the processor is effectively a 486 and Ubuntu expects it to be installed on something a little more recent. Its big attraction other than its price is its power consumption, my plug in Power meter makes it running between 8 and 11 watts depending on load (Power consumption is probably something of a concern if you're here in the first place). Since the supplied power supply (in the mess at the back) is 40W I made up a DC adapter to also feed the router and a network switch from the same power brick (They all use regulated 12volts, The router pulls around 6 or 7 watts and the switch around 1 watt) - the less power supplies with their inherant inefficiencies the better. Despite what Viglen might say, its a hopeless case in my opinion for trying to run a desktop computer, its performance is decidedly slug like with a GUI installed. Its fine for a low use webserver/firewall/home monitoring box as here.


Box


Google is your friend, theres a whole pile of information out there on installing Ubuntu on one of these little Viglens.

Google

For the Arduino ignorant, this is the microcontroller that does much of the work in getting the readings from various sensors onto the aforementioned server, its open source, reasonably cheap and very flexible, just the thing for small robots apparently. In this case its connected to the server with a standard A-B USB lead (AKA printer lead). This serves both to power the little beast and to transfer its readings back to the server. The USB is actually masquerading as an RS232 serial interface which is as old as the hills, its well supported in Linux and all other operating systems. The development environment (the programming bit) runs under Java and works on practically anything. In this case most of the work is done with its analogue to digital converters since most of the sensors on my system are analogue. Its illustrated alongside a standard USB memory stick for a size comparison (its small, you can hide it in the palm of your hand)


Arduino

I use a 'bash' script running from crontab to get the readings every minute. (more on this later)


This unholy mess is MK1 of the 'shield' that connects all the sensors to the arduino. Its a commercial prototyping shield with some passive components (resistors in voltage dividers mostly) to form the ciruits with the sensors at the far end of the wires. The Arduino board with its USB connection is underneath.


Shield

The much tidier MKII. This is made from a piece of 'Veroboard' type stripboard, far cheaper than commercial protyping boards but requires making. The capacitors are part of the circuit to the current transformer along with most of the resistors around them. The LEDs and the button are the same as the LEDs on the Arduino (Power, Pin 13 and Reset button). The other resistors are mostly voltage dividers for the Light sensors. The Resistors for the optical sensors on the meters are on the sensors themselves. The white cables (one marked with black tape) are 6 core burgler alarm cable I had to hand. They run to the burgler alarm junction boxes in the next picture


Shield

MKIII. Actually its MKII with some additions. New is the grey cat 5 cable which connects to the 16 X 2 LCD screen and the onboard piezo buzzer, used for reminders for me.


Shield

The new 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, Rolling average electricity use 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.......


Display


These are the junction boxes used to connect the sensors to the white cables from the Stripboard shield. They are at the RH side of the RH box. The LH box top feeds the Electric Meter Sensor (White) and the Dining room Digital Thermometer. LH Box bottom Feeds the living Room Thermometer and Light sensor and the outside Thermometer. The RH Box Top, Green is the Dining room Light Sensor and blue is an output to the central heating boiler relay (since the arduino contols the heating). RH Bottom is the Gas meter sensor and the current transformer


Junction Boxes


Current Transformer, bought off ebay for a few pounds. Stuff like this is a chance find as its fairly obscure and you don't find people selling it regularly. They tend to be used in industrial type applications. This one is a type FCT29 and is 100/5 amp and 2.5VA rating. The white lump on top is a 0.33 ohm 7 watt resistor (it's 'burden'). All things being equal with 100 amps running through the meter cable it gives 1.66 volts across the resistor. But that is above the CT's VA rating. Its within its rating up to around 54 Amps (13 kW ish at 240 volts) which is more than I've seen the household use. (The main supply fuse is 80 Amp). I have the aref on the arduino at around 1 volt. It works nicely. The CT voltage 'floats' with a voltage divider holding one side at around 0.5 volts relative to ground (buffered with the capacitors on the 'shield'). The other side is connected to an analogue pin and the AC pushes the voltage to values between 0 and 1 Volts.


Current Transformer

The AC waveform produces this graph, usually a spikey mess, but cleans up into a nice sine wave when heavy usage appliances with a low reactive element are turned on (eg Kettle, Shower, Toaster etc). The values on the Y axis are the actual ADC outputs from the arduino. I have the resistor values a little screwy on the board hence the centre is at around 550 rather than 512.


Waveform

MK I Version of the Electric Meter sensor, consists of a Optek OPB702 'Reflective Object Sensor' (Photo Transistor and Infra Red LED in plastic housing) and a 600 ohm resistor for the LED and a 160K resistor for the photo transistor. Its stuck onto the meter glass with hot melt glue. (I tried Bluetak, but it kept falling off...). It proved to be not very good as its got a quite wide field of view and the aluminium disk its looking at is very narrow


Electric Meter MK1

MK II Version of the Electric Meter sensor, Optek OPB705 with the same resistors. This has a fixing hole for a screw so I made a bracket out of a flattened piece of copper tube I had and screwed it to the Wooden back plate of the meter. This is much better as its a much narrower field of view and I get a much better definition between the shiney disk and its black mark. (It should look less suspicious to the meter reader too.......). Ultimately it produces the green line on the graph below.


Electric Meter MK1


1 hour


Gas meter sensor, electrically identical to the MK1 Electric Meter, although its looking at a reflective patch on the last rotor (1000ths of a Cubic metre) of an odometer type meter, tricky to use a bracket as its not positively fixed to anything. Since the reflective patch is a good size, the wider view of this sensor hasn't been a problem.


Gas Meter

It produces this graph (if there isn't anything on it, its because I'm not burning gas at the moment)


1 hour


This graph is produced by the reading generated by Dallas DS18S20 digital thermometers. Not much to photograph, they are tiny and hidden away. They look exactly like small transistors in a plastic housing. They are all wired to the same digital pin on the arduino. The link below is for illustration, I actually bought mine on ebay for quite a lot less.....


1 hour


This graph is produced by LDRs (light dependant resistors) wired with 10k resistors in a voltage divider circuit each connected to an analogue pin on the arduino. Again they are tiny and hidden away. They give clues to the occupancy of our two main rooms. (The Dining room is open plan with the kitchen and with the living room, forms the whole downstairs.)


1 hour


The following graphs are produced without reference to the Arduino.

This is the bandwidth used by the computers on our home network, its produced by using the linux ifconfig program to determine the traffic being routed by the internet connected network interface.


1 hour

This is the computers turned on on the network. Its a number between 0 and 7 from which can be determied which are turned on (binary 4 + 2 + 1). It works by the server scanning the network with software called 'nmap' to see which machines are alive.


1 hour

This is the temperature of the hard drive in the Viglen, It doesn't have any other sensors I can read.


1 hour


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 Viglen 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 server (with the exception of the first line which is done by the server), the arduino actually sends it once a second, but the server only listens for it once a minute. This avoids timing conflicts between the two.