Some years ago my mother was ill with Leukemia & I was told by her doctor she could “go at any time” – not nice. I developed Pi HG to help watch over her & it proved to be very useful. Pi HG is flexible sensor solution that can help monitor your family or your property. One visual feature is the Virtual Cottage where current activity at your property is displayed on a single virtual image which can easily be added as an active widget to your mobile device – see more about this on PiHG features.
Pi HomeGuard (Pi HG)
Pi HG is a cheap flexible Raspberry Pi (model B, B+ and Zero) wireless sensor add-on to help monitor your family or property.
What can it do ?
Intruders – be alerted if your home has unexpected visitors, are your kids at school ?
Relatives – check if an elderly relative is up and about making their breakfast.
- Frost – get an early alert of low outside temperatures.
- Flood – get an early warning of flooding before your property & possessions are damaged.
- High Power use – get alerted if your cooker or oven has been left on !
- Footfall analysis – find out what areas of your shop floor are busy at particular times.
Pi HG sensors and features:
|Power kWatts usage *||current & average power|
|PiR motion detection *||range of 7m|
|Door Open/Close *||once triggered will transmit a series cycle of multiple pulses|
|Toilet Flush *||useful to detect if someone is up and about|
|Flood *||place sensor in basement or building foundations for early flood warning|
|Ext Temperature & Humidity *||only uses a single channel|
|Pi HG Temperature *||on board temp, can be used to detect room temperature|
|Rain Gauge *||uses Maplins N25FR Rain Bin|
Wind speed *
|uses Maplins N25FR Anemometer|
|Lan connectivity||Yes **|
|WiFi connectivity||Yes **|
|3g connectivity||Yes ***|
|Power costs||Yes *|
|Low Battery Indication||Yes *|
|Sensor Battery Life||1 – 2 years using AA batteries|
|Sensor Data hosting||Internally to Pi or selected external clouds.|
* Custom notification alerting on all sensors with real-time chart analysis.
** Requires Raspberry Pi for full functionality.
*** Requires an e220 modem dongle with suitable sim for 3g connectivity.
With the right sensors and configuration the following timely alert situations can be detected by Pi HG and sent direct to your mobile device in seconds.
- High power use after 5.30pm – Cooker left ON !
- Front door left OPEN !
- No Kitchen activity by 9am, is your relative ok ?
- Property activity detected when you are at work or on Holiday !
- Flood or Rain alert !
- Hot water tank temperature cold, forget that hot bath !
- 6am Frost alert – outside temp below freezing !
- High wind speed – possible damage to property !
- Heavy rainfall – possible flooding !
- Sensor X battery voltage low !
The software will be provided for a nominal admin charge initially on SD card and I am now in a position to share the hardware platform to every Raspberry Pi user for an incredibly low price.
What we need & What do I get ?
For a successful campaign and to make initial production viable I need sufficient funds to manufacture 500 PiHG boards. Many campaigns stall and fail by the initial high manufacture costs but because all boards are ready to go and with sensors being sold in DIY format – this will not happen. The Raspberry Pi was built and sold to improve learning & education and Pi HomeGuard will continue with this theme. All sensors will initially be self build following a set of simple instructions. The complexity is now handled by the sensor board firmware making the construction possible with only a few cheap component modules.
As an example when a door opens, to ensure detection, the open event has to be held ON for several transmit cycles. On my first version I needed a 555 timer delay circuit to hold the signal ON for at least 30 seconds. This added cost and complexity and the 555 circuit was not easy to build. This is now all handled in the firmware and we now only need two components, a 9901 sensor board and the magnetic door switch !
As a default Pi Homeguard monitors power usage on sensor 0 and board temperature on sensor 10. Up to nine other sensors can be added, but the humidity/temperature sensor only uses one channel.
Basic HG System:
Power clamp Transmitter, Power clamp and the Pi HomeGuard board.
Note: small header to connect Pi or PL2303 has still to be added.
After selecting the basic system you then decide what additional wireless sensors you want to add to your system. Only minor soldering skills are necessary, they are all very easy to build and use minimal components, but please remember to select the correct sensor board firmware (990x) for the sensor being built.
All sensors use the same wireless board transmitter to send data to the Pi and the sensor battery condition is also transmitted meaning you can spot batteries getting flat before they fail. This can of course be added as a sensor alert when the voltage of sensor# falls to a determined value.
Sensor firmware ref and build components used:
9901 Door Open/Close – Sensor board and Magnetic door switch
9901 can also be used for Toilet Flush – Sensor board and float sensor
9902 Humidity/Temperature – Sensor board, DHT22/11 sensor & 10k resistor
9903 Not allocated……………………………………………
9904 PiR movement – Sensor board, HC-SR501 sensor, 5v power board
9905 Wind speed – Sensor board, Maplins N25FR Anemometer
9906 Rain Gauge – Sensor board, Maplins N25FR Rain Gauge
9907 Flood – Sensor board, Flood level sensor
Building the most complex 9904 PiR movement sensor
PiR SR501 0.75p
5v Step up 0.99p
Sensor 9904 £10.00
Total cost £15.42
Note: a comprehensive build document is sent with each sensor type.
9904 – PiR movement sensor using an RS 373-2362 enclosure (£0.89p).
Sensor Battery Life:
The battery life greatly depends upon sensor activity, as an example see the below video which estimates the door sensor having a life of three years, this is even with the door being left open for an excessive 1 hour in 24.
The battery life of the humidity/temp sensor is however much less and a life of around 9 months can be expected. The life of a PiR sensor depends on activity in the area being monitored. One option as used in the door sensor video is to use “sleep mode” which only transmits data when triggered. The down side is you only get a battery voltage reading when the sensor is triggered, but for most situations this should be ok, the choice is yours.
The sensor data can be hosted internally on the Pi which is stored in a Round Robin Database (rrd) format and is sized for ten years. But other options are available to store the data externally with CurrentCare, Xively or with EmonCMS. The external options are triggered by adding the appropriate API key to the config file.
How does it all work?
- First get your Pi HomeGuard hardware with SD card
- Follow the self build sensor instructions
- Load the SD card into your Raspberry Pi, connect to your network and apply power
- Using your browser load http://Pi-Local-IP (Pi-Local-IP? see Faq’s)
- Pair all your sensors to their respective channels
- Edit the sensor config file and change labels & colours as necessary
- Load the Pi Local address (eg: 192.168.1.xx ) in your browser and watch the data appear
- If necessary amend the graph layout or amend your alerts at: http://Pi-Local-IP/editor
- To host your Pi data on the internet see Faq’s
- To send your data to external hosts see Faq’s
Depending on your requirements the software is totally flexible and can be used in several different ways. The default config has your Pi running, data collection, processing, raw data hosting and data alerting. The internal Pi data is stored in a Round Robin Database (rrd) format and is sized for ten years. I’ve been running the default Pi hosting software on my Pi for nearly three years, the presentation is a little primitive but it does work and has proved to be very useful and reliable. Each raw chart take about one second to generate which is amazing considering all the other stuff the Pi is running.
The top header block shows the current power usage & temperature as at timestamp.
The next block shows nine labeled sensors with the last reading and battery voltage. The colours help identify each sensor on the following charts.
If necessary click the left magnify icon to expand last timestamp list.
Activity charts then give a timeline presentation which show which sensor has been triggered recently and the colours help identify room activity.
The Power usage chart shows the 3kW kettle spikes at 6am.
We also have charts for temperature & humidity.
You can see a working live example at: http://www.pihomeguard.com
But you could have the data hosted elsewhere, at for example Emoncms. All you do is add your API key to the config file and see the same data presented as on the below dashboard link:
Or using a different API key in the config have the data hosted to the Current Care dashboard:
Yet another way to present the same data is to use the internal virtual cottage, all current main sensor data is presented on the one virtual icon;
The chimney smoke, windows and door all change depending on sensor activity. No room activity for 15mins & one panel grey, 30mins two panels grey, no activity for over one hour and curtains close. Image can be displayed on your mobile device and gets updated every 5 mins.
View a live presentation at: http://www.pihomeguard.com/cottage
One powerful feature is to have full control of any alerting on any sensor with the ability to have multiple alerts for the same sensor.
- Any Day 1730-1930 High power use – Cooker left ON !
- Any Day anytime – Front door left OPEN for >5mins !
- Any Day No Kitchen activity by 9am, Is Mum Ok ?
- Mon-Fri 0900-1700 Property Activity when you are at Work !
- Any Day at 0900 – Battery Voltage of sensor# is below 2.2v !
Once a sensor alert has triggered you can decide when to repeat any further alerts. Sensor alerts currently have the option to use “IFTTT” or “Pushover”, again configured by adding the appropriate API key to the config file.
Ye another internal option is to use Cacti which has the ability to drill-down to a particular date and time and view any sensor data using your browser.
Q and A
Best way is to use a $6 IC Keypad Plate display, but with no display the Pi local IP can be found a number of ways:
- using a port scanner software like http://www.advanced-port-scanner.com
- or a mobile App called “Fing” for Android & iOS.
This may happen eventually but the cost for sensor molds would hold back the launch. The final cost would also have to add sufficient margin to make the business risk worthwhile making most sensors cost double the kit price.
I don’t have broadband but do get a good 3g signal, can I still use HomeGuard?
Yes the Pi software is configured to run as cable network, WiFi or even a 3g dongle.
( Note: Recommended 3g dongle is the e220 )
How can I host my Pi data on the internet?
PiHG is currently pre-configured to post data to; Emoncms, Xivley and CurrentCare
They all follow the same process where you register on their site and get an API key code. This code is then added to the PiHG config file and data will be automatically posted to your chosen external cloud.
Unless someone knows your site name eg: MyNiceName.duckdns.org it is unlikely to be found by anyone. But even if found the name and information will not mean anything to anybody. If someone found your site and tried to hack the site the utility Fail2ban has been installed to ban any further activity from the hacker IP. But if you are concerned PiHomeGuard can be configured to just post data to the local Catci or external clouds like EmonCMS which all have their own userid & password control.
I want PiHG but cant solder, can you provide ready made sensors?
The initial goal is to raise enough funds to manufacture the PiHG board. If the campaign is successful providing ready made sensors could become an option. But you could buy a simple $10 soldering kit and learn yourself. Who knows, it could be the first step to a new career and open other opportunities.
Is it possible to add a display?
Yes and this is recommended. For an additional $6 you can add your own IC2 Keypad Plate direct to the Pi header. Note: also works with Pi Zero.
- Up – Check your IP address
- Hold Right – Shutdown & Restart
- Hold Down – Shutdown & Halt
- Select – Display last sensor readings and help with sensor pairing.
- Left – not used (yet)
Yes. The initial Pi HG board was configured as:
Anyone who still needs Pi USB connectivity will simply use the below PL2303 cable.
This gives the maximum flexibility for the cheapest cost.
How did all this start ?
This is me and my Mum, taken before she took ill. We all have something we care about in life but the most important thing we value is usually our family and friends.
About 3 years ago mum, then a widow, aged 89 was told by her doctor she could “go” at anytime and she was told to give up driving. Mum had Leukemia and her blood cell count levels had dropped sharply prompting her doctor to take action. Luckily I live nearby and although I visited her regularly I still wondered if I could do more to monitor her well being. Just by chance I’d been working on a power monitoring system at home using the Raspberry Pi and a Current Cost monitor. One of the first things I noticed when using this was the large 3kW kettle spike it gave when someone turned on their kettle, which shows the person is up and about making their breakfast. I thought this was ideal for checking that mum was all right. I decided to take things further and developed sensors for motion detection (PiR) and a door sensor to detect open/close activity. Using the internet on my mobile I could then interrogate the system from home, at work and even when on holiday abroad and view mum as she went about her normal busy schedule.
An early version was called HomeCare Guardian;
The vivid colours on the timeline identify movement in each room and the red line flags Front Door activity as mums heads out on her normal busy schedule. I ran this system for 18 months before mum sadly passed away. She died peacefully with her family at her side. She was very brave. After some months I thought maybe more people might have a similar need. My sister and I certainly found HomeGuard a great comfort and it helped alert us to several worrying situations.
PiHomeGuard is a low risk fixed funding project all we need is to sell enough boards to cover the manufacture costs, no heavy investment is needed.
Other Ways You Can Help
- Please get the word out and make your friends aware of the PiHG campaign.
Many thanks and I look forward to your support,