Well I haven’t been doing a good job of posting what I have been up to. Here is an installment about my work to create an interactive bicycle trainer. The work was done during the winter of 2009/2010.
Back in March I posted that I had been working to make my winter time bicycle training more interesting. During the past winter I worked up three different sensors to interface my bicycle to an Arduino. The data that is captured by the Arduino is sent to my PC via the USB connection and fed into a program written using openFrameworks that runs on the PC and provide graphic feedback.
For anyone who doesn’t know “openFrameworks is an open source C++ toolkit for creative coding.” It has a number of excellent examples to get you started and also has a number of routines to interface with the Arduino. I strongly suggest that anyone interested in interfacing the Arduino with a PC that has programming experience take a look at it.
As you can see in the above screen shot the program displays the time I have been riding, the miles per hour, the cadence and the number of miles ridden. Surrounding this information is a track with a red dot that is updated as I ride.
Here is the first sensor I wired up. This was built using an old Cateye bicycle computer sensor which picks up rotations of the wheel and pedal strokes using sensors mounted on the frame and magnets on the wheel and pedal.
This should have been a simple build but turned out to be a real challenge. I was riding on a set of rollers on a piece of plywood to protect the carpet. The sensor would feed data to the Arduino for a while but then the Arduino would start giving crazy readings, locking up and rebooting.
To make a long story short it appears that the band that connects the front roller with the back roller was generating static electricity rubbing on the plywood. This setup would run for a while as I was holding on to the wall to get started which must have been gounding the whole setup. I solved the problem by placing an antistatic mat between the rollers and the plywood.
The second setup was built with a set of infrared LEDs. The transmitter and the receiver are mounted to a plastic U I fabricated and then a black plastic strip mounted to the counter balance breaks the beam which is connected to an interrupt on the Arduino. This setup doesn’t support cadence.
The final rig I built was using a hall effect sensor and magnet from adafruit. The sensor is connected to the bike frame using velcro and the magnet is connected to a spoke using a bolt that has been cut down the middle. This setup also doesn’t support cadence.
All three of the sensor setups worked well. By the time I had complete the initial experiments with sensors and got the openFrameworks program setup it was time that I could start riding outside again.
I plan to pick this project back up again this coming winter when I move my riding back inside.