A few months ago we rigged our conference room to schedule itself using motion sensors. Here's how it happened.At Robin our conference room is a staging area for workplace tech, ranging from the useful to the far out. One of the first things we did with our conference table was build an LED system with API to coordinate the animations. Using Robin's presence API, we were able to add motion sensor occupancy to the mix.
Normally people use beacons and the app to report presence, but that can leave gaps. What about visitors or people without the app installed? With the motion sensor, now whenever you walk into the room and stick around for a few minutes the auto-booking trigger fires and schedules the room automatically, just like the beacon and app combo.
Our resident electrical engineer Chris soldered up a board with a motion sensor and Bluetooth radio that could be powered by USB. As an added bonus, this let the sensor simultaneously broadcast as an iBeacon while sending back motion data.The sensor itself doesn't have any network connectivity aside from Bluetooth, so we flashed custom firmware onto a separete Bluetooth dongle and wrote a Chrome app that would relay motion data up to our API as a live feed of presence data. Any computer running the Chrome app with the dongle plugged in streams feeds from sensors within range.
For those of you familiar with our beacon system, this flowchart will look very familiar:
"Wait... why not just use the computer's Bluetooth directly?"
In this case the MAC address of the device reporting the motion matters, since we might one day support multiple sensors. As a security precaution Apple and others have started to limit access to this data directly, so using a separate dongle to relay the important parts made compatibility easy.
Wiring up to the presence API
With Robin's API, anonymous presence is added by omitting the user_id and providing a device_id:curl -X POST https://api.robinpowered.com/v1.0/spaces/:id/presence
-H "Authorization: Access-Token TOKEN"
-H "Content-Type: application/json"
}The final result is that our conference room will automatically show when someone is moving in the room, and then schedule a new calendar event when they stick around long enough. By following the same rules as our beacon-based system on mobile, it can also unbook rooms as people leave. In our case, this approach is best as a fallback to identified presence via our mobile apps.
Rolling your own version
We'd built earlier prototypes using Arduino and Rasperry Pi, so we went for a more polished and miniaturized version this time around. While we don't have a plan to produce a public version, (hardware is best left to the experts) the parts are all standard. Our friends at Tessel would be a good place to start for making your own.This is a hardware-intense hack, but there's a lot of lower-hanging opportunities for your business using off-the-shelf beacons and the API directly. Check some out here.