Sunday, March 2, 2014

Bicycle Trainer - Take 2

Back in June of 2010 I posted of my work done during winter 2009/2010 to create an interactive bicycle trainer.  Four years later here is an update of where I have gotten.  The work below was done during the winter 2012/2013 and winter 2013/2014.

After two winters of occasional work I now have a truly interactive experience for riding when it gets dark early to make riding during the week dangerous.  The setup measures the speed of the rear wheel and the direction the front wheel is pointing in to display a virtual rider on the screen in front of the bike.


The rig for the bicycle consists of an old mountain bike mounted in a rear wheel trainer.  The front wheel is lifted off the ground using a 2 x 4 “saw horse” which supports the frame just behind the handle bars.  This allows the front wheel to be able to be turned from side to side.







The electronics consists of the following:

  1. Right and left buttons for controlling the program.
  2. A Triple Axis Magnetometer to determine the direction the front wheel is pointing in.
  3. Sparkfun Bluetooth Mate Silver to transmit data from the sensors to the computer that drives the display.
  4. Sparkfun Nordic USB ANT Stick for heart rate monitor.
  5. ATmega328p


The virtual bike rider is positioned on a road.  As the pedals are turned the road moves backwards like a conveyor belt to make it appear that the rider is moving forward.  The speed is determined by how fast the pedals are turned.  If the handle bars are turned to the right the rider drifts to the right side of the road.  When they are turned to the left the rider drifts left.

The rider gains points for the more distance travelled.  The score along with the speed, miles, heart rate and time are displayed on the screen.  (I wasn’t dead when the screen shot was taken I was just riding with out the heart rate monitor.)

To make the game interesting pot holes show up on the road surface.  If the rider doesn’t steer the bike around them then they crash and lose points. 



There is an interval timer that ends the ride and displays the riders miles, time and score. The number of pot holes is configurable as is the interval timer.


The code for the ATmega was written using the Arduino IDE and the interactive display is driven using openFrameworks.

Below is a short clip of a two minute ride. It isn't too interesting but it does show the display in action.