Turning a Puck.js into an open source one-button tracker
tl;dr: You can turn your Puck.js into a one-button tracker with this open source website I made
Open Humans community member James Littlejohn highlighted the Espruino family of open source hardware boards and devices during one of our community calls some weeks ago. Their devices are fully open source – including the hardware, software and all of the documentation – which makes it super easy to get started for beginners like me. And programming the hardware is especially nice, thanks to two characteristics:
- You can push code right from your web-browser and don’t need to install any software. Thanks to all devices having Bluetooth Low Energy capabilities you can use web bluetooth to directly connect your web browser to them and use a web IDE.
Since getting my hands on some of their devices I’ve been playing around with them, especially the Puck.js, a bluetooth beacon that’s packed full of sensors: An accelerometer, a gyroscope, a temperature sensor, a magnetometer, a light sensor and most importantly the whole device acts as a button.
This button brings a great opportunity to do some self-tracking of discrete events, as you could use it to record whatever events you are interested in. During our Open Humans community calls the potential use cases for such one-button trackers are frequently discussed: Tracking how much/when you sneeze, tracking how much you eat, keeping a log of your allergies, figuring out how often you stand up. Getting a record of when it happened could be just a press of a button away, your own creativity is the limit. Inspired by another one-button tracker project that’s under development by Thomas Blomseth Christiansen and Jakob Eg Larsen I decided to give it a go and turn one of my Puck.js into a one-button tracker.
When you press the button of your Puck it records:
- the time when you pressed it,
- for how long you pressed it,
- the current temperature & light levels,
- the accelerometer data.
The latter might be useful to figure out if you accidentally pressed it. And when you install the one-button on the Puck.js the internal clock of it will also automatically be set to your current browser time, which makes it easy to have the correct timestamps for your button presses.
Of course the whole thing is open source too, and you can find the whole code for the one-button tracker on GitHub.