The meter component of the project started when I had trouble debugging the pickup. I had a noise problem which I couldn't spot with my oscilloscope for lack of a reliable trigger. Nor could I debug it with print statements because these interfered with the program timing. My solution was to emit program variables on various PWM channels and watch them with my SimpsonVom.
This lead to dedicated meters in a pleasing arrangement with a few extras like a blinking light and a beeping speaker. The meters came from CascadeSurplus.
The spinometer connects to the rollers' pickup with 1/8 inch stereo patch cable. I attached the jack to the roller frame with HotMeltGlue and then ran stiff wire to the CdS photo cell which was positioned by bending so as to see light and dark flashes created by black electrical tape wrapped half-way around the roller. A little heat-shrink tubing over the cell blocks unwanted light.
I found that I was getting on and off the rollers over and over while debugging. This didn't make for a very interactive development environment. I struggled unsuccessfully to operate my oscilloscope and computer while pedaling. I needed another approach.
One innovation was to substitute a Radiometer for the roller as it would spin just fine without any effort on my part. I bet you were wondering what a Radiometer was good for. Now you know.
I had used a magnifying lamp to image my Radiometer on a CdS cell before. Here is the sketch I made in 2001 of what I then called a Radiometer Speedometer.
I further improved my spinometer debugging environment by omitting the physical input entirely. I modified the program to simulate the rolling input signal instead. I replaced the single analog input statement:
int sig = analogRead(1);with a computation that simulates flashing input using the millisecond counter and a modulus function:
int sig = millis()/60%2 ? 100 : 200;This had the advantage of producing controllable and repeatable stimulus as I tuned the time constants in my filters.
I read the CdS cell with the analogRead (ADC) command. I filter this with a weighted average so as to get an adaptive threshold. The first two meters monitor this process:
The third meter measures elapsed time. I use it to challenge myself with sprints, like bell laps at the track.
The last two meters report the pedaling speed and speed varaiation.
I report zero variation as a full scale reading and go down from there as variation increases. The ideal for training would be to pin these last two meters for each sprint.
Here is the program as originally written. I've been using my laptop as a battery to power this thing. Someday I will extend this to write data to the laptop so that it can be logged and plotted.
// Spinometer -- Adaptive cycle training meter // (c) 2008 Ward Cunningham
My car was stolen 1/09 with my bike and rollers from my office the day I was taking the Spinometer to Dorkbot to show it off. The car and rollers were recovered five months later. Now, after a year of bicycle commuting I am again interested in indoor training and have revived the project.
My first modification was to up the speed scale, 30.0 => 50.0, reflecting a year of training. This places 25 MPH mid scale. 25 seems to be the boundary for sprinting given my current conditioning. I've spun it up to 40 MPH, which was an uncomfortably fast and uncoordinated cadence on the rollers.
I share my source code updates to this project at https://github.com/WardCunningham/Spinometer
|Last edited April 3, 2011
Return to WelcomeVisitors