Supercaps For The Win!

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?

LifeFitness R3 Exercise BikeBut 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):

LifeFitness R3 Circuit Board
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.

NessCap 5V, 2.5F SupercapacitorsMy 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:

Closeup of the supercapacitor fun-pack
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.

LifeFitness R3 Circuit Board
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:

  1. ATMega128 microcontroller
  2. Linear regulator (8-SOIC) supplying the microcontroller
  3. Supercapacitor fun pack (3x 2.5F, 5V caps)
  4. Pushbutton circuit board
  5. Display driver IC (Holtek HT1647, 4-level grayscale, 64×16 LCD controller)
  6. Main I/O connector (includes power connections)
  7. Beeper (or, if you prefer, the annunciator)
  8. ISP header (for AVR programming)
  9. Serial port connections
  10. 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…

Marti (the Dog)

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.

This entry was posted in Hobbies and tagged , , , . Bookmark the permalink.

17 Responses to Supercaps For The Win!

  1. Rick Rosenblum says:

    Great! Not only is the article well written and in great “Double E” techie jargon I might add but it has a great picture of a yellow lab which my kids will love to see when I get home!! :) Once again, Good article and Good Work!

  2. Mike says:

    I’m actually a little curious what the serial port could be used for. Maybe it outputs diagnostic data or even better exercise data! Put a ZigBee in there and log exercise on the bike!

  3. ole716 says:

    you can use http://www.hex-rays.com/idapro/ to disassemble the hex

  4. Mike says:

    @Rick – thanks so much! I’ve been looking for an excuse to post some dog pics. :)

    @Mike – me too… I might just check that out one of these days. Gotta love ZigBee!

    @ole716 – thanks for the link!

  5. Robin Chan says:

    Hello!

    If you mail me the hex file, I could disassemble it for you!

    Rob

  6. ben says:

    Use AVR Studio

    or

    http://www.frozeneskimo.com/electronics/2009/10/08/vavrdisasm-free-avr-disassembler-updated-to-version-1-5/

    Anyway, will take some time because your missing the source or an object file.
    Maybe the AVR Lib site is help full.

  7. migsantiago says:

    Hey Mike

    Nice mod to your bike. I still have one question, how did you protect the short circuit current that flows when the super capacitors are empty?

  8. Mike says:

    @Robin – thanks, file sent!

    @ben – AVR Studio has a decompiler? Or do you just mean I could run the hex file through the simulator? Thanks!

    @migsantiago – thanks, I was wondering when that question would come up! The short answer is, I didn’t. Instead I’m relying on the generator circuitry as well as the equivalent series resistance of the capacitors (about 0.2 ohms). Based on the measurements I made of the supply from the generator, it didn’t seem to be voltage-controlled in any way, so I’m guessing it’s basically just a set of rectifiers and capacitors. The generator and diodes won’t mind a temporary short too much. Still, it’s a bit of a gamble, granted, but the first time I ran the bike with the caps installed I did watch the current to make sure it wasn’t outrageously high. If I recall correctly the caps drew less than 1A, and only briefly, so I decided not to worry. The setup’s been running fine for several months now.

  9. Pingback: Add supercaps to your exercise routine | GeekNews

  10. Mike says:

    So I’ve been looking through the ASM output Robin sent back (thanks!!!), and it appears that there are no USART functions implemented. Bummer, that. I guess there’s no data coming out of that serial port after all… Still, it’s neat to look through! I’m seeing routines for ADCs as well as a number of timer and external interrupts.

  11. nickg says:

    can you really damage a regulator by putting too much load on it? I guess you could throw an inductor in there to slow things down.

    • Mike says:

      I suppose that depends on the regulator. A lot of them are designed with short-circuit and/or thermal protection of some type. I just checked, and the 8-SOIC regulator used on this board does in fact protect against short-circuit current by capping the output at 160mA. So technically, I could have put the caps across its output, but then it would’ve taken me about 30 seconds to charge… as opposed to about 6 seconds now.

  12. Pingback: Add supercaps to your exercise routine | secureXsystemblog

  13. Pingback: Myhackz

  14. D.plomat says:

    Nice hack!

    An ex-wife had a cheap stepper exercice machine which used an alkaline battery to power the small LCD counter while the hydraulic cylinders overheated even to the point leaking oil when i tried it… now at least some devices do something consistent with power we give’em :-)

    I’ve read somewhere that a cyclist develops between 150-300W, the geek inside thinks one could power a small PC

    If you reverse the prog and add functionnality you can even use the EEPROM of the ATmega to keep the data for years by saving on BOD and restoring on power-up.

    Oh, and BTW very cute Lab

    • Mike says:

      Cool, thanks for the comment and info! I’ve heard a similar figure about cycling power. If I ever come across a cheap old exercise bike I might just get it and hook it up to a laptop or something…

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>