Get Physically Fit with Fitlet and Fitbit

Application notes using fitlet. Credit goes to user Hassellbear for publishing more than enough cool application notes to justify a dedicated sub-forum.

Moderator: hassellbear

Post Reply
hassellbear
Posts: 106
Joined: Mon May 28, 2012 12:25 pm

Get Physically Fit with Fitlet and Fitbit

Post by hassellbear »

Overview
running2.gif
running2.gif (7.78 KiB) Viewed 17615 times
Obtaining and maintaining a state of physical fitness is a lifestyle for some and should probably be a goal for the rest of us. The positive aspects of a physically active lifestyle are well known and documented. Some of the proven and likely benefits are:

- Weight Control
- Reduced risk of cardiovascular disease via lower cholesterol levels and other mechanisms
- Reduced risk of diabetes
- Stronger bones and muscles
- Improved mood and lessened levels of depression
- Improved Sleep
- Higher energy levels through increased metabolic rate and cardiovascular improvement
- Reduced stress levels
- Reduced cognitive decline due to ageing
- Improved brainpower and memory
- Lower risk for cancer (primarily breast and colon
- And many more


In recognition of growing consumer interest in the benefits of exercise and the resulting market opportunities, a growing number of companies are introducing wearable fitness trackers. Such trackers are often configured as arm bands which are quite stylish and popular. A few of those now available include the Nike FuelBand, Jawbone Up Series, Under Armour Band, Microsoft Band, Garmin Vivoactive, and Fitbit products.

The features available in wearable band fitness trackers vary with price and range from spartan types with no display to watch type units with color displays. The on board sensors begin with 3-axis accelerometers on the low end and add things like gps as the price increases.

All of the wearable fitness tracking systems are similar in that they use their sensor data and attempt to deduce the wearer's level of physical activity by way of complex algorithms. Parameters reported to the user include items such as steps taken, miles walked, calories burned, stairs climbed, and so forth. They all claim to be reasonably accurate, but is likely the higher cost units with more sensors produce the best accuracy.

This app note focuses on integrating the Fitbit Flex with Compulab's Fitlet. The Fitbit device was chosen for this project because Fitbit products are very popular and because there is a free and open source software package available for Fitbit. That being said, it may be possible to integrate other brands using Linux, but I have not researched this.



Hardware

The hardware used in this project includes:

1. Fitlet Computer running Linux Mint 17.3
2. Fitbit Flex personal fitness tracker
3. Fitbit Bluetooth Low Energy (4.0) USB Dongle.
Hardware.jpeg
Hardware.jpeg (202.32 KiB) Viewed 17616 times



Software

As is often the case, Fitbit does not offer an official software package for Linux. As is the norm, the manufacturer only provides apps for Windows, IOS, and Android. Fortunately for those of us in the Linux community, the developer Benoît Allard has provided us with a free and open source package called Galileo. It would seem that the greater community owes a debt of gratitude to Mr. Allard for his contribution.

Galileo is not a GUI/HMI application. Instead, Galileo is a command line based package which features a background daemon which syncs the Fitbit wearable tracker to the user's online Fitbit account and dashboard. This approach is in keeping with the official Windows software. Galileo is written in python and is actively maintained and supported.

Software Installation

Installing Galileo is simple and straightforward. There are 3 installation methods which include:

1. Using Pip
2. Using distribution packages
3. Cloning locally and manually installing required dependencies

I elected to use the Ubuntu distribution package, and this worked well for me.

For specific installation instructions for the 3 methods see the following web page.

https://bitbucket.org/benallard/galileo


If you plan to run Galileo as a non-root user, you will have to modify your udev rules accordingly by adding the file 99-fitbit.rules to the directory /etc/udev/rules.d
Again, the instructions for udev are available in the above listed web page.

Running The Software

In general, Galileo runs in the background and syncs with the fitbit servers every 15 minutes. You can also actively run the software by issuing the command galileo in your terminal. However, in my case running Galileo using the basic command proved to be a bit problematic as it often returned errors instead of a successful sync. I found running Galileo using the --v (verbose) command line switch proved to be much more reliable. The resulting command galileo --v proved to produce more consistent syncs.
Galileo_Synching.png
Galileo_Synching.png (109.56 KiB) Viewed 17616 times

hassellbear
Posts: 106
Joined: Mon May 28, 2012 12:25 pm

Re: Get Physically Fit with Fitlet and Fitbit

Post by hassellbear »

Results

The result of using Fitlet running Galileo to sync my Fitbit Flex to the Fitbit servers was on balance good. At 15 minute intervals the system interrogates my Flex and uploads that data to the Fitbit servers. The result of this process is reflected in my personal online Fitbit dashboard as seen in the following picture.

Unfortunately, it seems I have fallen quite a "bit" short of my goal of 10,000 steps per day. Sometimes the truth hurts.
fitbit_web_portal.jpg
fitbit_web_portal.jpg (82.23 KiB) Viewed 17614 times



The Mysterious Fitbit BLE Dongle

The latest Fitbit products including the Flex communicate using Bluetooth Low Energy (Bluetooth 4.0). For this reason I was hopeful it would be possible to use Fitlet's built-in BLE adapter for communicating with Fitbit Flex. However, I have not been able to accomplish this yet as it seems Galileo is hard coded to only use the Fitbit BLE Dongle. A few modifications to the python source code should in theory correct this. The encouraging news is that using its internal BLE adapter, Fitlet is able to see the Fitbit Flex during a BLE scan as the following picture shows.
BLE_Device_Scan.png
BLE_Device_Scan.png (30.47 KiB) Viewed 17614 times

The mystery in the process concerns the Fitbit Bluetooth Low Energy Dongle. A search for that device's FCC ID on the FCC website reveals the Fitbit dongle is a BLE device. However, the normal Linux tool for identifying BLE adapters does not list the Fitbit Dongle. The hcitool dev scanning command only finds Fitlet's internal BLE adapter. It seems there is something proprietary about the Fitbit Dongle that is masking its presence. This situation begs for more investigation and research.
Fitbit_Dongle_Data.jpeg
Fitbit_Dongle_Data.jpeg (275.53 KiB) Viewed 17614 times


Conclusions

1. Fitlet in conjunction with Fitbit have the potential to play an active role in promoting and facilitating personal physical fitness.
2. Fitlet again shows how very versatile and adaptable it is.

Post Reply

Return to “Cool stuff with fitlet”