A couple of years ago my parents bought themselves a LifeFitness R3 electronic exercise bike. It’s a pretty slick little machine, albeit expensive. The R3 has a plethora of workout and intensity options, a built-in heart-rate monitor, and displays that show distance traveled, calories burned, etc. What’s really cool is that all of the electronics are pedal-powered; who really wants to suck energy from the grid just to get a workout?
But I’m not writing this post just to tell you about a neat exercise bike. I’m writing because I’ve figured out a way to make it even neater. Err, more neat. Whatever. Anyway, there’s one thing about the LifeFitness R3 that we’ve found slightly annoying: because it’s pedal-powered, whenever you stop riding, the display shuts off and the electronics reset. So if you’re in the middle of a 30-minute ride and get distracted by, let’s say, a Justin Bieber commercial, you’ll lose all of your stats and will have to re-start.
So since I hold degrees in electrical engineering, my parents asked me to make use of my education and remedy this inconvenience. My first step was to [carefully] crack open the display panel so that I could assess my options (scroll down for the full label legend):
It turns out this bike is controlled by our old friend the AVR ATMega128 (Label #1). This is the same chip found in the development board I used for my chronograph. It’s also very closely related to the AVR microcontroller used in the Arduino Mega. I tell you, it warms my heart to see this chip out in real products. Ah, but I digress…
Well having located the brains of the operation, I started looking for their power source. I quickly spotted two TO-220 package 5V linear regulators (labeled “R” in the image above). However, my multimeter (the only tool I had available at the time) indicated that neither of these were connected to the AVR. Eventually I located a tiny 8-SOIC regulator (Label #2) just beneath a pair of 2200uF power supply filter capacitors. A check of its pins indicated that this was in fact the device powering the AVR. And this regulator was fed by a set of wires that led down into the generator electronics. Interestingly, the generator appeared to be brushless, but I couldn’t get a good look at it or its electronics because of large panels I did not wish to damage (well, I thought about it).
I was also very excited to find a 2×5 ISP header on the main circuit board (Label #8). This meant that I might be able to reprogram the AVR to do my bidding. (Update: I’ve confirmed that this is possible; scroll down for details.) Perhaps I could have it enter power-save mode whenever the pedals stopped. Of course, this wouldn’t eliminate the power consumption of other devices on the board (display drivers, regulators, op-amps, etc). Plus, trying to reverse-engineer and modify machine code is no picnic (at least not to my knowledge). I decided to avoid this rabbit-hole and keep things simple.
My best option seemed to be the addition of supercapacitors. I could just tie them in parallel with the supply line filter caps. That way, the AVR’s regulator would continue to get stored power even after the user stopped biking. Adding capacitance to the regulator’s output was another option. However, the high initial charging current required by a large capacitor could be damaging to a device only rated to supply 100mA.
So I had two questions: how much capacitance do I need, and how much voltage will it have to handle? The second question was answered simply – I hooked my voltmeter up to the supply lines while pedaling and measured about 10.5VDC. To determine the amount of capacitance required, I used the following formula:
Ic = C*(dV/dT)
The ATMega128’s datasheet says it draws a current (Ic) of 19mA at 8Mhz and 5V, so let’s roughly double that figure just to be safe (to account for losses in the regulator and consumption by additional components). If the regulator can safely operate down to 5.5V, then our dV value will be 10.5 – 5.5 = 5V. Finally, let’s say we want to operate for 90 seconds. This means we need a capacitance of at least 0.72F. When I looked at Digi-Key (at the time), my best option was to purchase three 5V, 2.5F capacitors. Put in series, they’d be able to handle up to 15V, but their total capacitance would be reduced to 0.83F – still more than was necessary. Here’s a closeup image which shows the three supercaps linked together and soldered across one of the power supply filter capacitors:
So how did it all work? Splendidly. It turns out the AVR circuitry only drew about 30mA, giving approximately 120 seconds before full discharge. So now, whenever you hop off the bike to get water, adjust the stereo, or pet the dog, the bike’s display turns off (since it’s powered by a separate regulator), but the AVR continues to run, and will hold your current program and position for up to two minutes. A nifty feature added for about $20.
While I’m on the subject, I also found it interesting that the LifeFitness R3’s circuit board includes connections for a serial port (Label #9) as well as pins for a safety switch (Label #10). I suppose these were intended for other features not included with this model, but were left in place to reduce PCB manufacturing costs. For instance, the safety switch must have been meant for use with treadmills (I can’t see the need for this on a stationary bike). Perhaps the serial port is for a computer link of some sort? I’m tempted to test it out…
So finally, here’s the complete legend for the circuit board pictured above:
- ATMega128 microcontroller
- Linear regulator (8-SOIC) supplying the microcontroller
- Supercapacitor fun pack (3x 2.5F, 5V caps)
- Pushbutton circuit board
- Display driver IC (Holtek HT1647, 4-level grayscale, 64×16 LCD controller)
- Main I/O connector (includes power connections)
- Beeper (or, if you prefer, the annunciator)
- ISP header (for AVR programming)
- Serial port connections
- Safe switch connections
And because the quality of one’s post is directly related to the number of images contained therein, here’s a picture of my yellow lab. He’s not too sure about cameras just yet…
Update (10/8/2010): So I pulled out my old serial AVRISP with its 2×5 connector this afternoon, just to see if I could talk with the bike’s ATMega128. As it turns out, none of the chip’s lock bits were set, so I was able to download the HEX file with no problem (except for the strain on my arms while I kept the pedals turning). This means it is entirely possible for me to make modifications to the R3’s firmware. Of course, I’d have to figure out how to convert HEX back into ASM (which seems to be a questionable practice). If anyone else out there is interested in looking into this, feel free to leave a comment.