Home Automation - Collecting Data
As part of my home automation system I need to collect data about the environment, I have been doing this for sometime with a system I had previously built around the NRF24L01 wireless device. I was using the RF24Network library which creates a basic mesh network, a single master device would collect data relayed in through various other devices.
The Old
I liked this system and spent sometime building dedicated hardware for it, I ended up with low powered battery nodes which could run for a couple of months while sending temperature readings every minute. I ended up with 3 or 4 temperature sensors scattered around along with a movement sensor which did end up catching the exact time of a breakin! In addition to the temperature and movement sensors I had my AtHome detection system feeding into it, this used the Bluetooth transmission of my FitBit to detect if I was at home. At the core of this system was a hub, this had an internet connection and would relay all incoming data out to the data store.
This setup worked well for quite some time, I would occasionally get period of time when sensors would stop working but they eventually came back. Over time this seemed to get worse, possibly because of other interference but I decided it was time to replace it with a simpler system, dedicated sensor nodes easy with their own wifi connection.
This new system would be a lot simpler, there would be no mesh and one sensor wouldn't rely on the next. As there was no connection between devices I could use whatever hardware I had to hand.
The New
My immediate choice was the Photon from Particle but I knew I wanted to get a couple of sensors running and I didn't have enough of these, after looking at what I did have I discovered a few Electric Imps.
I had used the Electric Imp quite a bit in the past but hadn't worked with them for some time, thankfully their system hadn't changed at all and they had an example for interfacing with the DHT22 sensor I was using. In the end I had a couple of sensors up and running in about an hour.
This setup replaced the temperature and humidity data collection but not the movement and the At Home detection. Adding a movement sensor was easy enough but for the Bluetooth sensor I ended up with a bastardised system consisting of a Bluetooth module, Arduino and Electric Imp. This way I could literally glue my existing hardware on the top with almost no changes to the code. All I had to do was delete all references to the NRF24L01 and set pin 13 to output the at home state, this was then red by the Electric Imp.
To finish off the system I designed and printed a simple enclosure, this was a box with a hole for the movement sensor and a lot of holes to allow air to flow through and over the sensor.
Outside
The other bit of data collection needed was the weather outside, at the moment I am just using this on the dashboard but hopefully when winter comes around I can use the temperature differential to determine the ideal switch on time for heating or perhaps preempt a cold spot. I am pulling this data from the forecast.io service which provides loads of great data when supplied with a set of cordinates.
Problems
I am using the bluetooth scanning to fairly reliably determine when I am in the flat, this works great and will allow me to turn off lighting or reduce heating when I am not around but it only works for me. If someone else is in the flat the system falls apart, the movement sensors are setup to mark the property as occupied but only for a short time after movement is detected. If someone else is around and sitting down or sleeping the system will end up turning things off which isn't ideal! I am not sure how I am going to solve this at the moment but it will probably involve more sensors!