Open Source Health With FitBit

As some of you might remember, I have expressed concerns at times about the physical health of some folks in our community. Some of us are overweight, spend too much time in front of a computer, have less-than-stellar diets, get little exercise, and boast about drinking too much caffeine. While I am not a health nut, and I am not trying to turn everyone into a health nut, I sometimes worry about the physical health of folks in our different communities. I want people to contribute to Free Software, but would never want them to develop unhealthy habits in doing so.

I feel really fortunate in this regard in that my wife, Erica, is a health nut. Before I met her, I used to eat like crap, rarely exercised, and I didn’t really know a lot about health and nutrition. I didn’t know a lot because I didn’t want to know a lot. Some of you may be aware that Iam a fairly social animal, and I didn’t want to be eating salads and sipping on tonic water whenever I was socializing. I am happy to be healthy, but I didn’t want to live a miserable life in the pursuit of it.

Ever since I met Erica, she has taught me heaps about how to stay healthy. It turns out that you can eat tasty food, have a good time socially, and still be healthy by just knowing a little bit more about what your options are. This is one of the many reasons I am so glad I met Erica, she not only gives me a reason to stay in shape, but she has also explained how to do it.

As such, I keep an eye on what I eat during the week, and try to eat below 2000 calories a day, I try to work out at least three times a week (a combination of metal drumming and an elliptical trainer), and try to do ten minutes of ab workout each day. At the weekend I throw caution to the wind, eat what I like, and don’t worry about working out.

Having visibility and measurements is useful when doing this. Knowing how many calories are in different foods and weighing yourself is handy, but there is another really interesting way.

The FitBit

While at OSCON this week, Erica and I got chatting to a friend about the FitBit. The FitBit is simple; it is a tiny device that looks like a clip that you clip onto yourself during the day and when you sleep. The little thing measures a stack of things:

  • how many steps you take each day and when.
  • how far in total you have walked.
  • how many calories you have burned.
  • how long you have slept and how often you wake up, giving you a good idea of the quality of your sleep.

Our friend is an enthusiastic user, so we bought a few.

I have only been using it for a day or so now, but it is really interesting. The way it works is that there is a small base station that you plug into your USB port and the little FitBit clip regularly sends it’s data to the base station, which then uploads it to the FitBit website. The website has a stack of different metrics and data analysis tools and you can use it to track your calorie intake, exercise and other additional elements. It provides a complete overview of your health, and your FitBit clip automatically updates it with what you are doing.

Supporting Linux

I think it is a neat idea. There are though a few wrinkles for Open Source fans such as ourselves. Unfortunately, there is no Linux client for FitBit to allow you to update the site from Linux. I did though find that a guy is working on a tool called libfitbit and he has some code in GitHub.

He says about 90% of the tool is feature complete in terms of updating the site with your details, but he has been side-tracked with other work to finish it. He also says that the current libfitbit is written as more of a proof of concept in Python, and he would like to re-write it in C. This would then provide a means to get the data off the FitBit clip and feed it to applications.

This got me thinking. Firstly, I would love to see FitBit fully supported in Linux. I would love to see it packaged, and whenever the data is sent to the site, a little notification bubble lets you know it was successfully transmitted. But that is only the tip of the iceberg.

Going back to my previous points about worrying if members of out community are getting unhealthy, I think the FitBit could be an awesome motivational tool to help geeks get fit. What do we like to do as geeks? We like to know about numbers, and metrics, and details, and the FitBit can help us to hack our health.

I could see all kinds of potential here. People could write Free Software apps that are based on FitBit data (imagine all the potential graphing, and health programme management apps), we could have an Ubuntu/Fedora/GNOME/KDE health community in which we have competitions for who works out the most on a given week, we could hold charity walks (imagine hooking FitBit up to Kickstarter to generate revenue based on how far you walk), and people could work together to motivate each other to stay trim. Essentially, we could crowd-source the idea of getting healthy, and base it on automated data from the FitBit.

I just wanted to throw out some of these thoughts and see if anyone is interested. The first step would be a C implementation of libfitbit, and I have reached out to current author to see if he is interested in making one. Would anyone be interested in helping him? If that happens would anyone be willing to volunteer to package it for Debian/Ubuntu/Fedora?

  • veeru

    Excellent idea really fortunate in this regards.The FitBit could be an awesome motivational tool to help geeks get fit .

  • Luis

    I just purchased, in a similar vein, the withings wifi connected scale. It has an android client, so haven’t looked at linux issues yet (I dont’t think they have any traditional desktop clients- just web and mobile?) That’s been good for me, I think; am interested to hear if you get anything out of this over the long haul.

  • Benjamin Kerensa

    I had contacted Fitbit’s PR people awhile back because I was interested in helping bringing a client to Linux.

  • Chris Hardee

    For $100 bucks, I think the open hardware community can whip up something cheaper and better supported…

  • Tom Arnold

    Well .. maybe being fit outweights the risks, BUT having all your activity logged and send to a website sounds really stupid to me. You did a financial transaction with that website, so it is hard to stay anonymous. The site will probably be hacked at some point and your employer, your health insurer and everybody you don’t like will see what a lazy fat und unhealthy slob you are.

    Sounds amazing!

  • Anne Wright

    Hi Jono.  I’m glad you’re getting into this! We met at OSCON a few days ago.  I know Kyle and have talked to him a fair bit about this.  Getting libfitbit happy and ported to C would be very cool and I would love to contribute as a tester and user.   However, it isn’t a sufficient solution by itself because according to Kyle the fitbit is promiscuous: anybody’s fitbit will upload through anybody’s basestation, not just it’s own home base.  When it does that the data is removed from the device, so you will end up with gaps in your data if you ever walk near anyone else with a Fitbit basestation plugged into their computer.

    The best option to fill those gaps is Eric Blue’s perl API scraper.  It gets the 5 minute data that Fitbit uses to populate their flash widgets.  That is the highest res available for data you didn’t suck up off the USB port yourself given that Fitbit’s Web API only gives you daily summaries, not intra-day measurements.  I’ve been using this perl library to get Fitbit data into BodyTrack and it works well.

    I’d be happy to talk to you more about this.  You should have my contact info (gave you a card after your talk at OSCon), or you can message me at twitter at @annerwright:twitter 

  • Paul Burton

    I’d be very interested in hacking on it if they’d actually sell me one in the UK…

  • Mike Sheldon

    A cheaper, more flexible and perhaps more convenient option (if you’re already used to wearing a watch) would be to write something for the TI Chronos EZ-430 development watch. It’s available worldwide, costs about £40 (including a USB RF receiver and programmer) and the watch itself contains an accelerometer and RF transmitter and can be fully reprogrammed with custom firmware. It can also hook up to a heart rate monitor in addition to the built-in accelerometer.

    This would allow you to define your own open protocol for the RF information and web communication without needing to rely on FitBit (albeit requiring more effort, since you’d be writing the web service as well as the watch firmware and client).

    The main concern with this approach would probably be the amount of on-board storage (32KB), but if you’re clever and do a lot of the accelerometer processing on the watch itself, rather than just storing raw accelerometer data, that shouldn’t be a massive problem.

    I’d be willing to help out on such a project, but I’m not particularly interested in doing it all myself if no-one else is interested (time restraints and all).

  • Tom Arnold

    @twitter-22257122:disqus Wow, that is way cool. I want one (but I will sleep one night over it). Compared to that the $99 for the FitBit (prof. cloud lock-in not included) look pretty crappy. Is there FOSS for it somewhere? A community?

  • Anne Wright

    Hi Mike.  We tried that a year ago and gave up on it.  The data from the TI Chronos sensors was good, but the little bit of storage was a serious problem.  If you wanted to sample each sensor you could do 1 sample/30 seconds and have to dump it out every ~24 hours, and that was it.  I tried and it was just too annoying to have to dump it out that often.  The other problem was that the firmware logger example was modal in its use of logging vs using radio so you couldn’t do the nice fitbit continuous acquisition to local storage and opportunistic upload trick without significant code restructuring, which my interns balked at.   If I the watch could have had it continuously uplinked through my phone or something it might have been ok, but phones don’t have the right kind of RF receiver.  They also couldn’t manage to expand the memory without fabbing an entirely new board. I have five of these and two of the Blue Robin heart straps gathering dust in my lab.

    There was a group from Fujitsu labs of America at the Quantified Self conference that had hacked hardware onto it and incorporated the USB RF receiver dongle into a custom wearable logging board called a Sprout so they could continuously receive transmits from the watch rather than rely at all on local storage.  Unfortunately they’re not allowed to share this technology until and unless their superiors allow them to open source it, which doesn’t look imminent or likely.

    If you’re up for building something like the sprout or add-on hardware and app for  smartphones to receive and log the data in a nice way I’d be interested to test and evaluate it.  I could probably even send you a watch and heart strap if I could find the box it’s in.

  • Mike Sheldon

    There’s some modular FOSS firmware called OpenChronos:

  • Anonymous

    I think the risk of this happening and the negative impact of this data being shared is so low that it doesn’t warrant boycotting the idea of tracking your exercise and getting fitter.

  • Mike Sheldon

    Hi Anne,

     Thanks for the offer of watch and strap I actually already have a set of my own that I’ve been playing with a bit; which may or may not be why I’m suggesting this… 😉

     In terms of data storage you’re right it’d be an issue if you’re trying to record frequent samples, but this wasn’t really what I had in mind for storage, when I mentioned doing some of the processing on the watch what I envisioned was detecting steps via the accelerometer and recording these cumulatively (either hourly or daily depending on what level of granularity you need), so you’re only storing a single int per hour that you frequently increment. Then for sleep tracking you simply record the times at which large motions occurred surrounded by periods of rest. With this sort of structure you should be able to store a fair few weeks worth of information.

    Cheers,  Mike.

  • Anonymous

    Thanks for the response, Anne – I can see you have quite some knowledge in this area. Sorry we didn’t get a chance to meet up at OSCON to discuss this – I got the FitBit when I got home. :-/

    I have a few questions I wanted to ask:

     * In terms of the fitbit being promiscuous, I thought the fitbit was tied to a base-station based on a unique code and the data would only be removed if the website confirms that the data was successfully removed? Or, or you talking about if you use the FitBit with another website (maybe an Open Source project)?  * Does the Perl API Scraper  simply provide a data dump, or does it provide an API that you can use? I am thinking dumping the data from the FitBit into a a database (such as CouchDB, which could be replicated), and then having an API to parse the data, could be useful.  * Where can I find more about the Perl API Scraper?  * You mentioned BodyTrack, what is that?

    I would love to talk more. Thanks for the responses, Anne!

  • Anonymous

    Interesting stuff. Part of what I find interesting about the FitBit is that if we had some useful consumer Open Source tools, it would provide a consumer solution. There would be no tinkering involved.

    What I would love to see is an Open Source solution for end-users, and I am thinking that the FitBit complete with some Open Source tools deployed in places such as Ubuntu, could be really interesting.

  • Anonymous

    You can’t get them there? Wow. You may want to just buy one in the US and get it shipped there.

  • rwg

    That scale looks interesting from a hardware point of view, but I’d have to give it some serious thought before purchasing a $160 scale that’s tied to someone else’s web service.  What happens if Withings goes under?

  • qdot

    Fitbit ain’t tied to a base station. It’ll talk to anything. I’ve made it talk to garmin and suunto keys. It’s just a matter of knowing the protocol, which is well documented as part of libfitbit.

    libfitbit already contains a client to upload to fitbit’s website too, see However, due to the transmission timing bugs holding up libfitbit from seeing v0.1, it’s maybe 10% reliable for connection/transfer right now.

  • qdot
  • Fabian Rodriguez

    I am not sure what is the advantage of buying a device I will have to carry with me, sync to a closed cloud (requiring Internet access) and risk losing when my Android phone already provides the same data. You can get Android devices for less than the fitbit alone costs today.

    A couple of projects (free, open source software) already implement some of its functionality:

    And code examples about sleep patterns detection can be found:

    Although a client could then be built on Ubuntu to read/analyze/track this information, I see an opportunity to do this within the Android app itself. Release it under the GPL and sell the binary via the Marketplace, also make it available on f-droid.

    That’s a project I would help with.

  • Fabian Rodriguez

    I think what Tom wanted to bring attention to are the many implications of such poor design and security, as illustrated here:

    I can stay healthy in many other ways, no need to submit my personal data and post it to be available in public like that.

  • Siegfried-Angel Gevatter Pujal

    There was an article in the last Technology Review about personal monitoring.

  • Jaynos

    I must stress if you are working out your abs, make sure you do some exercises for your back too. The plank is a good exercise for your entire core. You cannot just work out your abs. You have to do the whole core otherwise you will have posture problems. However I’m sure you know that! :-)

  • Anonymous

    Thanks, Jaynos! I didn’t know that! :-)

  • froodie

    I knew when I saw you wearing flipflops to a pub that it would end like this.

  • Anonymous


  • Dave Cross

    They were made available  in the UK at the start of 2012. I’ve just bought one from Amazon.

  • Carter Astrphys

    I realized this is an absurdly old post but I thought i’d reply anyway in the off chance that I get a response. I’m about to start a project that uses this type of technology and the Chronos seems like the best bet for hardware so far for what I’m doing. Nothing else that I’ve found seems to have accelerometer+heartrate+tempurature, which are the three sensors I need for my project. I was wondering if you have any more information on what you guys already tried? I’d rather not re-invent the wheel if someone’s already done some research on it. 

  • Chris Wayne

    I gave a go at packaging it, at ppa:cwayne18/fitbit, it seems to work alright, but you still seem to need to setup the device on a windows/mac first, but then any subsequent syncs work fine

  • A

    I was wondering if it were possible to access some of the raw data off of the fitbit one. I’m interested in taking the raw data on a small time scale (~30secs to 1min) and then exporting it to a .csv file for data analysis in my mathematics software in ubuntu. Is there anyway that I could do something like this? Also, if so, how would I go about this?

    Any help would be greatly appreciated.

  • Nick Heiner

    You can use my tool to export data from fitbit: It doesn’t do intra-day data (yet), but it’s open source and I accept pull requests!