The Blog of Ian Mercer.

Bluetooth Sensing for Home Automation

Cover Image for Bluetooth Sensing for Home Automation

Traditionally iBeacon technology was created to allow a mobile phone to know where it is in a building. A museum for example might place an iBeacon on each display and have an app that tells you about the exhibit in front of you. This works well but you need to have your phone on and you need an app running for this to be useful. When your phone is locked it still checks periodically for location beacons but the interval is around 15 minutes and is therefore useless for home automation.

Instead, my interest is in using the Bluetooth advertisements sent by cellphones, Apple watches and iBeacons to track where people, dogs and assets are located within the home. I see this data as complementary to all the other sensor data collected and plan to fuse the two in the future.

Phones however do not want to be tracked, they include a technology called "mac address randomization" that causes the phone to skip to a new mac address on a random time interval. iBeacons and many other devices are much easier to track.

My approach has been to install multiple Raspberry Pi devices around the home and barn and then use code to figure out where each phone, watch or beacon is. The code includes hundreds of heuristics to discern the device ID from any information it transits including manufacturer id, manufacturer data, mac address (if public), appearance, name, ...

Stitching mac address randomization back up into a coherent track has been achieved! I can now track a person with a phone as they move through the space from room to room even as their phone skips mac addresses. Only when two phones in the same room switch mac address at the same time does the system lose the ability to track an individual but it retains the ability to know how many people are in each room.

Determining the location from Bluetooth RSSI has also been a challenge. The next version of Bluetooth will include direction finding capability to centimeter accuracy using angle-of-arrival, but I don't have that yet. Mapping RSSI values onto locations is complex because reflections (off metal surfaces), attenuations (walls, furniture, ...) and atompsheric conditions (mostly humidity) can all affect the received signal strength. Further complicating the issue is that fact that not all of the Pis will receive any given advertisement packet and some of the Pis may be offline for maintenance.

Despite all these problems I now have a robust algoritm that can map devices to rooms, and in some cases areas within a room.

Applications

I envision many different uses for the Bluetooth tracking technology I have developed including:-

  1. Occupancy-based heating control, e.g. lower temperature when just one person present.
  2. Lighting controls can now be more certain that someone is still in a room even when they do not move.
  3. Asset tracking enables "find my anything" for any Bluetooth tagged tool or dog.

Trials

The technology is currently in trials in the Kuwait, Baltimore and Seattle. A huge volume of data is being collected every day to improve the heuristics for device categorization and to tune the location tracking aspects of the system.

Awards

The technology has won two awards so far, one from Hackster.io and another global hackathon with a $20,000 first place prize from HCL. You can read more about that on Geekwire.

Related Stories

Cover Image for Time Series Data Compression

Time Series Data Compression

This new technique to compress the time series data collected by my home automation system seems to be working really well.

Ian Mercer
Ian Mercer
Cover Image for Home Automation

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
Cover Image for Bluetooth Tracking Project

Bluetooth Tracking Project

My year long Bluetooth project that won the $20,000 HCI and Microsoft competition during lockdown has continued to grow and now reliably tracks how many people are in the house and outside and can locate any device down to room level.

Ian Mercer
Ian Mercer
Cover Image for Digital Twins are never identical

Digital Twins are never identical

Digital Twin are an online representation of a real world object, a copy of its properties in the digital world and a way to send updated and commands to it. In effect I've been making them for years but now they have a trendy name.

Ian Mercer
Ian Mercer
Cover Image for Home Automation Sensors

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
Cover Image for Collinearity test for sensor data compression

Collinearity test for sensor data compression

One way to reduce the volume of sensor data is to remove redundant points. In a system with timestamped data recorded on an irregular interval we can achieve this by removing co-linear points.

Ian Mercer
Ian Mercer
Cover Image for 3d Printed ESP32 Brick

3d Printed ESP32 Brick

ESP32 provides a great platform for sensors around the house but by the time you've added a USB power brick, cable and enclosure it's quite messy. I wanted a device that I could just plug in with no exposed wires and no mounting needed so I designed one in OpenSCAD.

Ian Mercer
Ian Mercer
Cover Image for Filtering techniques

Filtering techniques

Filtering raw data is essential for a reliable home automation system. Here are some of the many ways you can filter sensor data.

Ian Mercer
Ian Mercer
Cover Image for Gas sensors

Gas sensors

Gas sensors come in many different flavors including CO2, VOC and particulate sensors.

Ian Mercer
Ian Mercer
Cover Image for Humidity Sensors (DHT11, DHT22, AM2320)

Humidity Sensors (DHT11, DHT22, AM2320)

Humidity sensors are great for controlling extractor fans in bathrooms and other damp spaces.

Ian Mercer
Ian Mercer
Cover Image for Light sensors for Home Automation

Light sensors for Home Automation

Having at least one light sensor is critical for any home automation system that controls lightng. Lights need to be turned on when it's dark not at specific times of day, especially here in Seattle when it can be dark and cloudy at any time of day.

Ian Mercer
Ian Mercer
Cover Image for Microwave Doppler Sensors (RCWL-0516)

Microwave Doppler Sensors (RCWL-0516)

Microwave doppler sensors can be found in some alarm sensors but there are also available very cheaply as a separate component. They offer exceptional range but suffer from false triggers requiring a probailistic approach to people sensing.

Ian Mercer
Ian Mercer
Cover Image for Optical-beam sensors

Optical-beam sensors

Optical-beam sensors are reliable and can cover a long-distance such as across a garage or aisle-way. When they include multiple-beams they have good false-trigger rejection.

Ian Mercer
Ian Mercer
Cover Image for PIR Sensors for Home Automation

PIR Sensors for Home Automation

PIR sensors are cheap and easy to use but they suffer from slow response times and low repeat rates.

Ian Mercer
Ian Mercer
Cover Image for Strain-gauges

Strain-gauges

Strain-gauges are my top-rated sensor for home automation because they are invisible, reliable and can be tuned to detect people and ignore pets.

Ian Mercer
Ian Mercer
Cover Image for Temperature sensors for home automation

Temperature sensors for home automation

Temperature sensors I've experimented with for home automation.

Ian Mercer
Ian Mercer
Cover Image for Event blocks

Event blocks

Home automation systems need to respond to events in the real world. Sometimes it's an analog value, sometimes it's binary, rarely is it clean and not susceptible to problems. Let's discuss some of the ways to convert these inputs into actions.

Ian Mercer
Ian Mercer
Cover Image for Logistic function - convert values to probabilities

Logistic function - convert values to probabilities

Another super useful function for handling sensor data and converting to probabilities is the logistic function 1/(1+e^-x). Using this you can easily map values onto a 0.0-1.0 probability range.

Ian Mercer
Ian Mercer
Cover Image for ATAN curve for probabilities

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
Cover Image for Bluetooth

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
Cover Image for Probabilistic Home Automation

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
Cover Image for Multiple hypothesis tracking

Multiple hypothesis tracking

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

Ian Mercer
Ian Mercer
Cover Image for A state machine for lighting control

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
Cover Image for iBeacons for Home Automation

iBeacons for Home Automation

My investigations into using iBeacons for home automation

Ian Mercer
Ian Mercer
Cover Image for iBeacon meetup in Seattle - January 2015

iBeacon meetup in Seattle - January 2015

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

Ian Mercer
Ian Mercer
Cover Image for The Internet of Hubs (and things)

The Internet of Hubs (and things)

Maybe it should be called the Internet of Hubs instead

Ian Mercer
Ian Mercer
Cover Image for World's Smartest House

World's Smartest House

Over 15 years of experimentation with home automation

Ian Mercer
Ian Mercer
Cover Image for HX711 Strain Gauge Pulsor Sensors

HX711 Strain Gauge Pulsor Sensors

Using Pulsor sensors with an HX711 for homeautomation.

Ian Mercer
Ian Mercer
Cover Image for The Grideye 8x8 camera sensor

The Grideye 8x8 camera sensor

Experiments with an 8x8 IR camera for privacy-preserving people detection using cameras.

Ian Mercer
Ian Mercer
Cover Image for CCTV Cameras as Home Automation Sensors

CCTV Cameras as Home Automation Sensors

CCTV cameras are an option for detecting people but within the home there are privacy concerns that need to be addressed.

Ian Mercer
Ian Mercer
Cover Image for Pressure Sensors for Home Automation

Pressure Sensors for Home Automation

Pressure sensors can detect HVAC system operation and could potentially detect clogged filters.

Ian Mercer
Ian Mercer