The Blog of Ian Mercer.

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.

Related Stories

Home Automation

I've been working on home automation for over 15 years and I'm close to achieving my goal which is a house that understands where everyone is at all times, can predict where you are going next and can control lighting, heating and other systems without you having to do or say anything. That's a true "smart home".

Ian Mercer
Ian Mercer

Home Automation Sensors

An overview of the many sensors I've experimented with for home automation including my favorite under-floor strain gauge, through all the usual PIR, beam and contact sensors to some more esoteric devices like an 8x8 thermal camera.

Ian Mercer
Ian Mercer

Bluetooth Sensing for Home Automation

Bluetooth sensing for home automation is a great proxy for people counting as it can detect and locate each cellphone in the house. iBeacons attached to tools, cars and pets can provide a 'find my anything' feature too.

Ian Mercer
Ian Mercer

ATAN curve for probabilities

In a home automation system we often want to convert a measurement into a probability. The ATAN curve is one of my favorite curves for this as it's easy to map overything onto a 0.0-1.0 range.

Ian Mercer
Ian Mercer

Bluetooth

One of my inventions recently won a $20k global competition for applications that could help in a pandemic. It uses Bluetooth to count people.

Ian Mercer
Ian Mercer

Probabilistic Home Automation

A probabilistic approach to home automation models the probability that each room is occupied and how many people are in that room.

Ian Mercer
Ian Mercer

Multiple hypothesis tracking

A statistical approach to understanding which rooms are occupied in a smart house

Ian Mercer
Ian Mercer

A state machine for lighting control

An if-this-then-that style rules machine is insufficient for lighting control. This state machine accomplishes 90% of the correct behavior for a light that is controlled automatically and manually in a home automation system.

Ian Mercer
Ian Mercer

Home Automation States

Understanding the many different 'states' a house can have is critical to creating great home automation

Ian Mercer
Ian Mercer

Graphing gigabytes of home automation data with tableau

Some interesting charts from the gigabytes of data my home automation system produces

Ian Mercer
Ian Mercer

iBeacon meetup in Seattle - January 2015

My notes on the iBeacon meetup in Seattle held in January 2015

Ian Mercer
Ian Mercer

Home Automation Systems as a Graph

Using nodes and links to represent a home and all the devices in it

Ian Mercer
Ian Mercer

N-Gram Analysis of Sensor Events in Home Automation

Using n-gram analysis to spot patterns in sensor activations

Ian Mercer
Ian Mercer

Xamarin Forms Application For Home Automation

Building a Xamarin Forms application to control my home automation system

Ian Mercer
Ian Mercer

The Internet of Hubs (and things)

Maybe it should be called the Internet of Hubs instead

Ian Mercer
Ian Mercer

Showing home status with just a single RGB LED

Multicolored LEDs can convey a lot of information in a small space

Ian Mercer
Ian Mercer

A wireless sensor network using Moteino boards

The diminutive Arduino boards include a powerful transmitter/receiver

Ian Mercer
Ian Mercer

The home as a user interface

Ian Mercer
Ian Mercer

A RESTful API for sensor data

POSTing data to a home automation system from Arduino devices

Ian Mercer
Ian Mercer

The Internet of Boilers

An experiment to measure every aspect of an HVAC / boiler system

Ian Mercer
Ian Mercer

VariableWithHistory - making persistence invisible, making history visible

A novel approach to adding history to variables in a programming language

Ian Mercer
Ian Mercer

A Quantified House - My Talk to the Seattle Quantified Self Meetup

My talk to the Seattle Quantified Self meetup

Ian Mercer
Ian Mercer

Integrating an Android phone into my home automation system

Some new features for my home automation using an Android phone

Ian Mercer
Ian Mercer

The Internet of Dogs

Connecting our dog into the home automation

Ian Mercer
Ian Mercer

GreenGoose Review

A review of the now defunct GreenGoose sensor system

Ian Mercer
Ian Mercer

Home power meters revisited

Ian Mercer
Ian Mercer

Home Automation Calendar Integration

Ian Mercer
Ian Mercer

Smart home energy savings - update for 2010

Ian Mercer
Ian Mercer

A smart power strip

Ian Mercer
Ian Mercer

What does a Smart House do at Halloween?

My favorite home automation features for Halloween

Ian Mercer
Ian Mercer

Home Automation Top Features

Ian Mercer
Ian Mercer

Weather Forecasting for Home Automation

Ian Mercer
Ian Mercer

How can I tell if my house is smart?

Ian Mercer
Ian Mercer

Home Automation Block Diagram

Ian Mercer
Ian Mercer

World's Smartest House Demonstration

Ian Mercer
Ian Mercer

Future proof your home with a new conduit system?

Running conduit can be expensive but maybe you don't need one to every room

Ian Mercer
Ian Mercer

New Home Automation Server

Ian Mercer
Ian Mercer

World's Smartest House

Over 15 years of experimentation with home automation

Ian Mercer
Ian Mercer

World's Smartest House Videos

A collection of videos about my smart home efforts

Ian Mercer
Ian Mercer