Here at Make and Build we started an internal R&D project, named Courier, to create a beacon experience that doesn’t require a mobile app. The ultimate goal is to turn the office into a context aware playground for anyone who enters. First one here in the morning? The alarm turns off and the path to your office is illuminated. Show up as a guest? We’ll alert the person you’re meeting. Last out the door in the evening? All the lights shut off and the alarm is armed. Setting up a full automation experience throughout the whole office is non trivial, so we’ve broken the project into stages.
The goal of stage one was to track employees’ location as they move around the office. We completed our proof of concept in time to demo it for our 2014 Movember Mustaches & Brews fundraiser event to benefit the Movember Foundation. Since our office is a large converted warehouse space, we thought it would be helpful for guests to be able to view the location of their M&B employee hosts as they moved around the office.
Let’s dive into the details starting with how it works and then the tech stack.
Beacons - We used iBeacons in the form of Estimotes, Gimbals, and iPhones (broadcasting as iBeacons). For the demo each person carried one in their pocket, but beacons could easily be attached to an employee’s badge.
Agents - Raspberry Pis act as our stationary agents and for the demo we placed one in three different rooms; the entranceway, the kitchen and the great room. The Pis detect when a beacon comes in range and send the details about the detected beacon to the server. These details include the date, time, and approximate location of the detection. We installed BlueZ (a Linux Bluetooth library) on each Pi as well as our custom Python scanning code to capture the beacon detections and forward them to the server for processing.
Server - The server side code runs on Amazon Web Services (AWS) and was built using Node.js with the Express framework. The server processes the beacon detections received from the Raspberry Pis and stores a history of them in a MongoDB database.
Demo UI - We hooked up a monitor to each of the three Raspberry Pis to display a user-friendly site displaying which employees were in which room at any given time. This page was continuously updated as the detections were analyzed on the server.
Although playing with beacons to create our demo was a lot of fun, it was not without its hiccups. One of the main problems we kept running into was the reliability of the Raspberry Pis. Parts seemed to break all the time for no reason and sometimes just quit working all together, requiring a reboot. We choose Raspberry Pis because they were cheap – around $60 including all the components - and maybe we should have expected hardware problems but it was still quite a headache. Since then the Raspberry Pi 2 has been released, so it’s possible we’d have better luck with that. On top of that the batteries in our beacons kept dying. Estimote has some tips for extending battery life but perhaps the batch we have is just outdated – one of the hazards of being an early adopter. The final hurdle was smoothing out the beacon detections. Since we rolled our own code to process the raw Bluetooth data (as opposed to using the iOS SDK that provides beacon functionality out of the box) it was obvious to see that the detection strengths jumped all over the place and even vary from one device to another.
All in all we got everything working and learned quite a few things along the way. With stage one behind us we’ve focused on making code improvements in time for our presentation at the Atlanta Tech Demo this Thursday, February 12. One thing that made development harder is that BlueZ doesn’t run on our Mac development environments. This slowed down the testing process since we had to test our code on actual Raspberry Pis. After some research we figured out that we can run Node.js in conjunction with the open source node-bleacon library on our Pis and since we can also run Node.js on our Macs we can now do all the coding/testing in one place.
We’re still hard at work on our newest demo setup and plan to publish another post detailing our setup and experience with it in the near future. In the meantime we hope to see you at the Atlanta Tech Demo on Thursday.