By Nathan Willis
January 16, 2013
Fitbit devices are a family of
wearable gadgets that track everyday health metrics (such as motion,
calorie burn, and sleep cycles) on a minute-by-minute basis. There
are certainly other hardware and software solutions to track such
data, but most of them are "sportsband" products, focused on
monitoring intense training sessions; the upshot of the Fitbit is that
it monitors the contribution of everyday activity: walking, climbing
stairs, and sitting still behind the keyboard. Since the latter
activity consumes a large portion of the average software developer's
day, the device has unsurprisingly attracted a following among
programmers. But as is often the case, Linux users have some hurdles
to clear in order to make use of the product.
Fitbit devices work by logging time-stamped readings from internal
sensors; the current models incorporate both accelerometers and
altimeters, tracking typical foot traffic. By associating the
movement data with some basic facts about the size of the user,
secondary statistics like calorie count are calculated, and some logic
is used to smooth out the results and determine when a wearer is (for
example) driving on the autobahn rather than running. The sensors
themselves are not unique — plenty of smartphones ship with
similar offerings — but the devices have gained a loyal
following thanks to their low power consumption, small size, and
relatively rugged construction.
Sync
Unfortunately the company releases support software only for
Windows and Mac OS X. Support software is required because the
devices are designed to offload their logs periodically to servers
running at fitbit.com, which provides a free web service where users
can track their individual metrics over time and compare it against
other users. The early Fitbit models came bundled with a USB "base
station" that connected wirelessly to the Fitbit devices using the ANT
protocol; every so often when the device was in range it would
synchronize the latest activity readings to the web service.
For that first generation of hardware, there is an open source
solution for Linux users. In 2011, Kyle Machulis released libfitbit, a Python
tool that supports pulling data off of the first generation Fitbit
devices and uploading it to the official web service. In addition to
pushing the device's data logs upstream, libfitbit also saves them
locally in plain text format. The library does not support the
altimeter sensor introduced with the Fitbit "Ultra", however.
Machulis has subsequently created an umbrella project for libfitbit
and an array of related health-monitoring device projects called
OpenYou — he does not appear to be actively developing it, but
there are several forked branches on Github that introduce
improvements.
In mid 2012, Paul Burton started another Fitbit sync project called fitbitd that
re-implemented libfitbit in C and ran the synchronization service as a
daemon, with the client connecting to it over D-Bus. Fitbitd also
added support for the Fitbit Ultra's altimeter sensor, allowing users
to keep a close eye on their stair-climbing prowess.
But in late 2012 the company updated its line of tracker devices
again, and switched radio protocols from ANT to Bluetooth Low Energy
(LE). On one hand, the switch to Bluetooth should make implementing
Linux support a little simpler, since ANT is proprietary. But on the
other, only relatively recent kernels support Bluetooth LE, and thus
far neither of the existing open source Fitbit sync projects have
undertaken the task of implementing Bluetooth support. The new Fitbit
devices do ship with a Bluetooth LE adapter for the PC, so the
hardware is in place, but it may be a matter of time before the
devices are widespread enough in the developer community for an effort
at reverse-engineering the Bluetooth traffic to pick up steam.
Nor is there any great hope that the company will provide a Linux
synchronization client of its own. Canonical's Jono Bacon reported in
January 2012 that he had reached out to Fitbit about writing a Linux
driver for the devices, but that after an initial expression of
interest, the company stopped replying. Several application
developers have asked about Linux support on the Fitbit API
development list (most
recently in September 2012) and were met with similar silence. In
fact, Fitbit has still not introduced an Android synchronization app
for the Bluetooth products; only recent Android devices support
Bluetooth LE, but the company has released an iOS app that
synchronizes with the devices over Bluetooth LE.
Data access
Of course, synchronization from a Linux machine is one aspect of using
the device, but it is not the only one. For some people, the notion
of uploading one's activity data to a remote service is anathema to
begin with, and even more so if the data cannot be retrieved. The
company offers an API so that developers can link other applications
(such as those for jog/run planning or nutrition tracking) to the same
user account. The API can be used to retrieve historical data from
the web service in JSON format, but it only provides access to daily
totals of the covered metrics.
At the moment, the most robust way to retrieve one's data from
fitbit.com is through John McLaughlin's Fitbit
for Google Apps script, a JavaScript tool that can extract the data
directly into a Google Docs spreadsheet. It requires registering as a
Fitbit application developer in order to obtain an authorization key,
but Fitbit has recommended
the script on the mailing list, so the company is clearly not opposed
to the idea.
Through the official API, McLaughlin's script can
download all of the daily totals from a user account going all the way
back to the account's creation. The retrieval period is configurable,
so users can run the script once to grab the complete history, then
run shorter updates for subsequent daily or weekly additions. The
result is a nicely formatted table of time-series data suitable for
any inspection or graphing tool.
Daily summary data is certainly
useful, but the minute-by-minute data is far more useful, particularly
when it comes to analyzing patterns of activity over the course of the
day. Libfitbit allows owners of the ANT models to save their full
sensor logs locally, but so far Bluetooth device owners are out of
luck. It is conceivable that the company regards high-resolution data
as something it can monetize, since the basic data logging services
is free of charge (Fitbit currently offers a paid "pro" version of the
web service that somehow acts as personal trainer to the user; I was
not intrigued enough by that idea to pony up the cash necessary to try
it out).
In October 2011, Fitbit announced
that it would begin allowing access to minute-by-minute "intraday"
data "on a case by case basis to a limited number of
developers." It is not clear what happened after that
announcement. As of January 3, 2013 the company still has
not opened intraday data to the public. The developer wiki mentions a Partner
API which still requires that the developer contact Fitbit and ask
for access, but the limited number of developers granted that access
do not seem keen to discuss it.
Others have inquired on the mailing list about "raw" access to the
device's sensor logs before they are uploaded to the web service.
This would be even more appealing to the privacy conscious, and if one
wants to do data mining personally it would be much faster to simply
capture the data locally before it takes a round trip to the server.
Here again Fitbit expressed
interest in the concept, but has not acted on it subsequently.
Alternative hardware
Fitbit is far from the only player in the health-monitoring
hardware market, but none of the other manufacturers are
particularly friendly to Linux and free software either. Machulis's
OpenYou project hosts a
number of other libraries for communicating with personal monitoring
devices, such as Nike's training-oriented Fuelband and the BodyBugg
armband. Like libfitbit, both are designed to allow extraction of log
data before it is uploaded to the relevant web server, but neither is
actively developed. Similarly, there was a 2009-era effort to reverse
engineer support for personal monitoring devices manufactured by
BodyMedia, but it has not been updated in several years.
The "Up" hardware devices from Jawbone offer a slightly better
experience. There is no Linux software available, but the full data
set can be downloaded from the web service in CSV form. Motorola's
motoACTV is an Android-based wristwatch with health monitoring
features, and it is possible to root the device and side-load third
party applications. Perhaps the strangest entry in the field is the
Zeo line of sleep-monitoring headbands. The company released an
official library
to decrypt the logged data and export it to CSV, and a separate project to
access the raw Zeo data in real-time. Although it was initially advertised
as "under an open source library" it can currently only
be accessed by agreeing to a severely limiting terms and
conditions document. This dichotomy is perhaps a simple
misunderstanding about licensing, but that does not resolve the
situation for free software sticklers.
Another alternative that is frequently proposed is to make use of
the position and accelerometer sensors already found in many
smartphones. There has been at least one effort to write an open
source pedometer
application for Android, but both the reviews of the app and
issues filed on the bug tracker reveal a key difficulty. Apparently
many Android phones do not allow an application to access and record
sensor data when the phone is in an inactive state. Since the goal is
to track movement over the course of an entire day, this can make the
app useless if one's phone manufacturer choose to enable this
restriction.
Exactly what Fitbit plans to do with the API and with raw sensor
data remains an open question. The company previewed another set of
new devices at the Consumer Electronics Show in January 2013, but did
not announce changes to the developer program. Consequently, Linux
users in possession of the newer devices will need to start
capturing and decoding Bluetooth LE traffic in order to make use of
their hardware. The good news is that so far all of the Fitbit models
successfully reverse engineered appear to use the same data format.
The bad news is that capturing and reading Bluetooth traffic logs is
such a sedentary activity.
(
Log in to post comments)