Exercise Bike (RunKeeper + OLED display)

I’ve been working on replacing the computer on my exercise bike with a Spark Core so it can automatically submit workouts to RunKeeper. I’m using an AdaFruit 16x2 OLED display to show the current distance / duration, and a small PHP script that fetches the data using the cloud API and sends it to the RunKeeper API. Photos, firmware, and PHP script are available on GitHub: https://github.com/c99koder/SparkCoreBike


Awexome project @c99koder :smile:

You might want to take a look at some work I did to figure out an initialization issue with the Sparkfun and Adafruit OLED displays here:

Basically the newer displays from Adafruit need an extra step in the initialization process which is not backwards compatible with older displays. Adafruit never really settled on how to handle this, but I think a #define OLED_VERSION 1 or #define OLED_VERSION 2 would be able to handle it better than not doing anything. Sparkfun links directly to my pull request for their library support xD.

1 Like

Thanks! I’ve just been power-cycling the core and the OLED after updating the firmware, it will be nice to push updates and have the OLED initialize correctly after a warm boot!

1 Like

Like the idea of this…would it be able to count 2 different revolutions at the same time?

I use my road bike on a tacx basic trainer with a computer to measure the speed/distance like you’ve done here but it also measures the cadence with another sensor by the pedal.

At the moment i stick all the info on to the web manually but it would be super if i could do it automatically…perhaps using a Reed Switch?

Yep, there are plenty of analog input pins available so it should be easy enough to add additional sensors. My next task is going to be trying to get a heart rate monitor wired up.


Oh yeah…didn’t even cross my mind to use an analog heart rate monitor!

Will certainly be following you for updates.

1 Like

Been doing a little bit of research (yeah, its NYE, i’m bored!)

This sounds like most of the hardwork is already done for a normal bike:


Now i have grand ideas of having a gps module to detect when i’m cycling outside, and then upload the data when i return home and reconnect the wifi…


Just got two bike computers off fleabay delivered for a couple of quid, going to see if i can use a sensor for speed and another for candence during the week while i’m off work.

Is there a new patched version of the OLED code @c99koder? The version you have on github doesn’t seem to include @BDub updates?

Skip that I quickly merged @BDub changes. Seems to work ok as long as you get the right version specified in its initialisation. I’ll write it up.

Yeah the two hardware versions are not compatible with each other… weird deal, but at least you figured it out easily! Goal achieved :smile:

I’ve just updated github repo. The firmware now includes the latest OLED library changes and also uses interrupts instead of polling to count the cycles. Also updated the included PHP script to work with the latest Spark Cloud API changes.

Thanks @c99koder really appreciate the work you’ve put into this.

I played around a bit with Fritzing today, here’s a sketch of the breadboard I’m using for this project:

Thanks to @BDub for the Spark Core fritzing part!