Gearing Up: Handlebar buttons (top) signal an Arduino microcontroller, tucked in with my electric bicycle’s main batteries (middle), to shift gears via a servo. A voltage regulator mounted to a heat-sink plate provides power to the Arduino and the servo mounted in the rear derailleur’s cage (bottom).Photos: David Schneider
When I was a teenager, I went from a bicycle with a 3-speed gear hub to a 10-speed with front and rear derailleurs. The wider range of gearing was empowering, but the derailleur shifting was sometimes a bit finicky, something that’s still the case even as I’ve gotten better bikes over the years. My road bike (a 1980s-era 12-speed) always seems to need its shifter friction tweaked. And my 21-speed mountain bike—which I converted to a human-electric hybrid a few years ago [see “The Hybrid E-Bike,” IEEE Spectrum, September 2009]—has always had trouble with the indexed shifter for its rear derailleur, perhaps a consequence of the time it spent rusting on an outdoor scrap heap before I rescued it. • One solution would be to buy better mechanical components, of course. But instead I decided to experiment with electronic shifting. Bicycle designers have been dabbling with electronic shifting for more than two decades, and in 2009 the Japanese company Shimano started selling its Ultegra Di2 electronic system. Problem is, a Di2 shifting kit costs nearly US $1900. Ouch.
I wanted a cheaper way to find out whether the advantages of electronic shifting would be worth the fuss of keeping a battery charged. The solution was to cobble together an electronically operated rear derailleur myself, following the example of Preston Fall, a bicycle mechanic from Oregon who has provided detailed instructions on his website, DIYshift.com. He’s not the only person to design a home-brew electronic bicycle shifter, but his approach and guidance looked much better than anything else on the Web.
Fall’s strategy is to modify a standard rear derailleur, removing the spring and replacing one side of the derailleur’s parallelogram-like cage with a bracket that holds a radio-control servo. Rotating the servo arm changes the cage’s geometry, which in turn moves the chain.
For this project, Fall recommends a metal-geared servo (a Hitec HS-225MG) and a popular derailleur, the X5 from SRAM. The first item was very easy to find ($26 from Servocity.com). Getting the second was trickier, because, as Fall warns, SRAM recently altered the design of this product in a way that could make his hack unworkable. So I acquired a new old-stock X5 derailleur from a seller on eBay (for $38).
I made some tweaks to Fall’s recipe for mechanically altering the derailleur to make it a little more robust on my bike. I also didn’t worry about power consumption. Fall was understandably concerned about depleting his system’s modestly sized battery, so he designed the electronics to cut power to the servo after each shift. I was working on an electric bike, which has a meaty battery for its traction motor. So the added energy demands of keeping the servo continuously powered (a few hundred milliamperes during a shift and a few tens of milliamperes between shifts) were inconsequential.
Keeping the servo continuously powered made the electronics a little simpler, eliminating the need for a MOSFET to switch the power on and off. But the biggest advantage is that with the servo always powered, the derailleur won’t accidentally move to a different gear. Fall’s arrangement avoids accidental shifts by leaving enough friction in the system to prevent vibration from moving things, but not enough to thwart the servo when shifting. That seems a real balancing act to me. So I adjusted my derailleur to have as little friction as possible, leaving it to the servo to hold it in position. A powered servo moves only when commanded and will resist outside forces applied to it, thanks to a built‑in feedback circuit.
As Fall did, I used an Arduino microcontroller to control the system. But I decided it would be easier to write my own code than to figure out his, so I created two Arduino programs. The first is for setup, which moves the servo one degree at a time, reporting its position to an attached laptop running a serial monitor. I used this to measure where the servo arm should be for each gear while I was cranking the pedals with my free hand. I then hard-coded those values into the second program, which shifts one gear up or down on command.
Another difference is that Fall’s shifter buttons are nicely integrated into the brake levers. Mine are merely lashed to the handlebars with cable ties. Perhaps I’ll attempt something more elegant later, if I decide to move to electronic shifting permanently.
So far, shifting this way seems very pleasant—tapping buttons is effortless, and the chain hits its targeted sprocket reliably. The system also offers flexibility, should I one day want to change the 7-speed cassette on the rear wheel to one with more gear choices. That would merely require updating the code, whereas with a mechanical system you’d need to install a new indexed shifter on the handlebars. I may try to electrify the bike’s front derailleur next, although with bigger jumps between chain rings here, this may prove challenging to do without stripping servo gears, as Fall warns on his website. In the meantime, my hybrid electric bike remains very much a hybrid, not just for propulsion but also in the shifting department.
This article originally appeared in print as "Ride by Wire."