iBeacons for Home Automation

My home automation system has been able to reliably understand which rooms are occupied for many years through a combination of many different sensors: PIR, strain-gauges under the floor, IR remote control sensing, door contacts, PBX extension usage, light switches, … and some limited reasoning. But it doesn’t know WHO is in a given room.

I have tried figuring out who is home by continually scanning the local network to see what devices have connected and I have a dashboard that shows every device that ever connects to the home network and when it was connected. It also happens to track visitors if they connect to the guest wifi. This has proven useful for finding devices: “Well, you had your iPod with you when you came home at 5PM and it’s still in the house somewhere”, but it’s not 100% reliable (sometimes pings aren’t answered and it assumes a device has gone away) and it can’t locate any more precisely than “Somewhere in the house or barn” (The barn is half a mile away but via a 900Mhz link is on the same subnet).

So, the next logical step was to give it that capability and iBeacon technology seemed like a good option to achieve that. Since we all carry cell phones almost 100% of the time we already have a personally identifiable iBeacon receiver with us most of the time. If I just mount enough iBeacons around the living areas I can tell who is home and perhaps even which room they are in.

So tonight I added code to my Xamarin home automation app for smartphones to detect iBeacons and to report back to the home automation system (via HTTP POST) whenever a phone enters or leaves the area covered by the beacons. I also added a couple of geo-fenced areas for good measure and code to report when it starts seeing any individual beacon.

On iOS this works in the background even when the app is not running which is great and I was hoping that this would allow the home automation system to know reliably whether I am home, at the barn, in the kitchen or in my office. I started with three beacons from Estimote, added another three from Sensoro and have another 12 on order.

Figuring out where to place the iBeacons and how strong to set their signal strength is probably worth a blog post of its own. The folks at footmarks.com suggested a couple of articles with some good advice on iBeacon placement: http://ow.ly/InVhY & http://ow.ly/InVhZ and I’ve been trying various locations and signal strengths to see what works.

One of the challenges for iBeacons within a house is that the signal travels vertically just as easily as it does horizontally and thus the room above the kitchen is as close to the beacon in the kitchen as anywhere else in the kitchen itself. This leads me to think that maybe I need to place beacons near the floor of the basement and the ceiling of the upstairs and then try to intersect the ‘spheres’ of coverage that each provides in order to get a precise fix on which floor you are on.

I may also be able to use the other motion sensors to disambiguate which floor you are on but that’s going to be a much more complex programming exercise and will be part of the machine learning project I’m planning.

The other beacons I’ve ordered are from a variety of manufacturers, some with AAA batteries, some USB, others coin-cell powered. I’ll blog again when I’ve had a chance to test them.

What I’d really like would be iBeacons with directional antennae. If you could buy ones with different patterns: half-sphere, corner, … it would be easier to create a system capable of precise location within a home.

BUT, and it’s a fairly large BUT, it turns out that in the background the iPhone only checks about once every 15 minutes for zone entry/exit status. This makes it totally useless as a real-time sensor for which room you are in. It also eliminates many of the other scenarios for which I was hoping to use iBeacons. If the app is running and in the foreground it can sense beacons but that’s a far smaller use case than I had planned.

Given this limitation I could still location-enable my iOS App for use-cases where the app is in the foreground. For example, you could maybe type “play 90’s” or “thermostat 70F” without having to specify a location. But this is a lot less than I had hoped for.

I’m also going to look at using iBeacons “in reverse” by placing them on moving objects (cars, backpacks, …) and having a fixed receiver (not using iOS) that is continually scanning for them and reporting their position. This will overcome the 15 minute issue but it’s not going to be able to track cell phones within the house. For that it looks like I will need a Bluetooth or GSM sniffer.

Tue Feb 03 2015 06:07:23 GMT-0800 (Pacific Standard Time)

Next page: Graphing gigabytes of home automation data with tableau

Previous page: iBeacon meetup in Seattle - January 2015