DIY Electronic Derailleur




If you just want to get building move on to step 1.

This instructable is part of a larger project to build the ultimate bicycle computer, which you can read about on my blog. It will show you how to build an electronic rear derailleur for Shimano parts. I've tested it on the RD-4500 Shimano Tiagra, but this method should work with similar derailleurs. Rather than pulling the shift levers, you press a button to get to another gear.

1. Once both derailleurs are electronic you get automatic trimming, which means no more chain rub!
2. Easier/smoother shifts. OK so it's not super hard to change gears with mechanical levers, but going electronic means you get an accurate shift every time.
3. Cheaper than the commercial alternatives. Like thousands of dollars cheaper...
4. When your gear changes are combined with other metrics like your heart rate, gps, speed and incline you can improve your ride by finding your weakness. Were you on the correct gear on that incline?
5. It's a conversation starter.
6. Adding electronics to anything is always cool!

Skills Required
- Basic soldering and electronic skills. See Sparkfun's Soldering 101
- Very basic Arduino knowledge like how to upload a program. See Sparkfun's beginning embedded electronics
- Basic bike mechanic skills like a removing derailleur, if you do your own bike maintenance you be should OK

So far we've got the rear derailleur shifting and plan to do the front so look for future instructables for updates and new features. At the time of writing the software does not turn off the servo to conserve battery power because there is a chance of gear slippage. This means you will have limited ride time. A fix for this coming soon so follow my instructables account.

Open Source
Up to date Arduino sketch, schematics, Fritzing diagram, bill of materials and CAD diagrams can be found on the project page

Future plans
- EEPROM wear levelling
- Waterproofing and better a enclosure
- Better cable management
- Machined servo bracket

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Tools

Philips Screwdriver
2 Clamps
Wire cutter
Large Metal File
Small Metal File
Electric Drill
Alan keys
Metal drill bits
Third Arm
Clear hocket tape
Clear hockey tape - Best tape ever

Step 2: Parts

You can find most of these parts at your local hardware or electronic shop. Harder to find items have links to online stores.
Soldering stuff
Soldering Iron
Solder Fume Extractor
Desoldering wick

Arduino Pro Mini
USB to Mini-USB connector
FTFI USB to serial adaptor
5V Lipo boost converter
3.7V 6A Lipo Battery
FTDI USB connector
10K resistors x2

Universal Ram Mount
HiTEC HS-225MG Servo
Project box - 2.1'' x 3.5'' x 1.25''
Protoboard - About half the size of a breadboard
Solid core wire - 22 gauge
5 feet of stranded wire - 22 gauge
3 wire ribbon wire the length of your bike
Single pole changeover switch rated for 10V minimum
Momentary push button x2 - Omron/B3F-4000
12 pin female pin headers x2
Velcro strips
016'' thick aluminum sheet
Zip ties
#3 Screw bolt x4
#4 screw bolt x2

Step 3: Electronic

We recommend prototyping on a breadboard before making modifications to your bike. Copy the Fritzing diagram to a breadboard and see if you can make the the servo move then start soldering using the protoboard.

Tip: Adafruit sells a protoboard that looks like a breadboard called the Perma-Proto. When you are done testing your circuit on a breadboard just transfer the design without any modifications. They also sell one that fits in a Altoids mints size tin.

Step 1:
Take the Protoboard and create the circuit using the Fritzing diagram and schematic.
Note: Always wear googles while soldering or doing machine work.
Picture 1 and 2

Step 2:
Connect the wires through the back and put jumpers on the connections that attach to the servo and buttons
Cut the wires from the back and make the connection according to schematic.
Picture 3 and 4

Step 3:
Solder wires to the center pin and one other pin of the switch. Make sure to put heat shrink on the wire first. Attach the Molex pin terminal to one pin. Drill a hole in the top of the project box and mount the switch.
Picture 5 and 6.

Step 4:
Route the wires through holes in the side of the project box then attach the other to the positive output of the Lipo Boost converter.
Picture 7

Step 5:
Attach the negative output of the boost converter to another Molex terminal. Attached the wires with Molex pin terminals to the Molex connector as showin in Picture 8. Make sure the orientation matches the connector on the protoboard.

Step 6:
The end result should look like Picture 9. Connect the Lipo battery to the boost convert and the Molex connector from the switch to the protoboard. After checking for shorts with a multimeter turn on the power.
Picture 10

Step 7:
Program your board by installing arduino on your computer and loading this sketch

Turn on the your board and make sure your servo functions to your button presses 

Step 8:
Using heat shrink solder two wires to you buttons after flattening the pins. Use a heat gun or the barrel of a soldering iron to shrink the heat shrink. Do this for each button
Picture 11 and 12

Step 9:
Tape the buttons in a comfortable position on your handlebar. Twist the wires to get them out of the way.
Picture 13 and 14

Step 10:
Attach Molex pin terminals to each wire for each button. Attach one wire from each button to a Molex connector.
Picture 15

Step 11:
Route the wires on your handlebars using hockey tape.
Picture 16

Step 12:
Test the circuit so far pressing the buttons.

Step 4: Metal Work

Step 1:
Take the Aluminum sheet and print out the template 
Picture 1,2,3

Step 2:
Cut the bracket out of the aluminum sheet according to template using a metal saw and bend the bracket tab according to picture
Picture 4 and 5

Step 3:
Cut out the mount arm from the aluminum sheet
Picture 6

Step 4:
Cut holes into the mount arm (according to template) and attach the servo wheel to it using #3 bolts. Cut any excess bolt length after attaching a nut. 
Picture 7, 8

Step 5: Mounting

Step 1:
Mount the servo to the bracket using #3 screws such that the tab is away from the servo head
Picture 1

Step 2:
Take out your old derailleur and clean it reapplying grease when your done.  
See for instructions
Remember to tape your gear cable to the bike.

Step 3:
Since the servo is not strong enough to move the derailleur we must remove the spring. NOTE: This means your derailleur will not without a servo. I do not believe it is possible to remove it without cutting it so use your dremel or heavy duty wire cutters for this. This is difficult so have some patience and wear goggles.
Picture 2

Step 4:
Attach the servo and backet to the derailleur as pictured using a #4 screw.
Picture 3 and 4

Step 5:
Attach the servo wheel and mount arm on the servo and screw in the other arm of the mount arm to the derailleur using the old bolt. Make sure the servo can move freely through the entire range of motion.
Picture 5

Step 6:
Test to make sure that the derailleur moves when pressing the buttons

Step 7:
Remount the derailleur
Picture 6

Step 6: Wiring

Step 1:
Strip the servo wires and the ribbon cable. Solder them together with heat shrink.
Picture 1 and 2

Step 2:
Measure and cut a length of ribbon cable long enough to reach the front of the bike. Connect Molex pin terminals to the other end of the ribbon cable and insert them into the 3 pin Molex connector. Make sure the orientation is compatible with the the connector on your protoboard.

Step 3:
Route the ribbon cable to the front of the bike following the original cabling using hockey tape. Secure the original cable to the frame with tape if you don't want to completely remove it from your bike.
Picture 3 and 4

Step 4:
Place the buttons comfortably near the derailleur lever on the handle bar and velcro it in place
Picture 5

Step 5:
Attach the controller to your bike and connect the wires to the servo and button using the Universal Ram Mount
Picture 6 and 7

Step 7: Calibration and Testing

There are a few variables that need to change in the Arduino sketch depending on which position the servo was in when you installed it. These are:


They determine how far the servo can move. To find these change

#define MANUAL_MODE 0
#define MANUAL_MODE 1

This allows you to control the movement of the servo using a potentiometer connected to pin 3. Upload the sketch and open the serial terminal. Find the values by moving the servo to its limits and update the variables.

Change MANUAL_MODE back to 0.

You may also want to play with the servo_step_size variable. It determines how much the servo moves on each button press.

Close everything up and ride the bike for a while making sure the gears and chains are attached well.

Test out the up and down gear shifts to see if they adjust to new gears. If not, attach the Arduino to your computer and reprogram the values.

Look for future instructables and the project page for updates.

Make It Real Challenge

Runner Up in the
Make It Real Challenge



    • Make It Fly Challenge

      Make It Fly Challenge
    • Stone Concrete and Cement Contest

      Stone Concrete and Cement Contest
    • Indoor Lighting Contest

      Indoor Lighting Contest

    51 Discussions


    2 years ago


    2 years ago

    sir plz send pdf files this project


    2 years ago

    Hi, Can anyone recommend how to translate the schematic (pin mappings) for the Arduino Pro Mini to the Arduino Uno (using breadboard). I want to get the Uno + breadboard working before buying the protoboard and ProMini. I need help a bit because I am new to the Arduino and electronics, but am keen to get this project working.



    3 years ago

    very good man great work welldone


    4 years ago on Introduction

    Has anyone actually been able to solve the battery life issue ?

    If so then that would be great to hear how.


    5 years ago on Introduction

    I've been tinkering around with an arduino and an old rear derailleur trying to implement something like this, but wasn't sure of the best type of motor to use. I'm thinking of a worm gear rather than a pushrodand servo, as it will hold its position without power. Does anyone have any recommendations about where I can find motors that are lightweight and powerful enough? It's a bit tricky trying to estimate how much torque you need to shift under load, so I'm just guessing as to how much grunt the motor needs.


    5 years ago on Introduction

    I just want to ask if their are other factors that can change gears automatically besides to the bike speed, pedalling rate and pedalling torque?


    6 years ago on Step 7

    Such a great hack! Congratulations! I'll do this in my commuter bike! Thinking in house this inner seat tube and with 18650 cells in pararael custom mount. Congratulations!


    6 years ago on Introduction

    Will say this is really incredible! Yes I know this is WAY too far in advanced but how about programming it around a smart phone app(s) that would take out alot of the problems with your GPS, Terrain inclination, heart rate, and other factors!?!?! Just a thought to help you out :) . By all means I know this right now is in it infancy.

    mr fat

    6 years ago on Step 7

    Awesome idea and I look forward to reading your Blog!


    great project!!!!
    do you have in mind for the front derallier?
    i would like to see a video with this working.
    can you fine tune without pc just in case it happens somethin on your ride?
    great!!!!if you add the front derallier i will built it the same time!!


    7 years ago on Introduction

    Love the work you've done on this!

    Here's an idea for when you get the front der added to the mix:

    Since you are using an arduino, how hard would it be to program in a gear sequence so when you hit the upshift or downshift buttons it progresses to the next gear in a logical sequence, moving either or both the front and rear ders?

    Also, since my ride is a home built trike with a mid-drive, I have 1 front on a triple, a 6 cog mid, and a 7 cog final. Could this be programmed to account for all three?

    I would definitely be interested in building something like this!

    Thanks for the 'ible!

    3 replies

    Reply 7 years ago on Introduction

    Very cool project!!

    Shifting in sequence is very doable but I question its usefulness on the road at least for the way most bikes are geared and the way I ride.

    First, although, mathematically, there may be 21 gears, there are usually duplicates. You would not want to waste time shifting to a gear that is marginally different. Ok, you need to (and can in fact) program the arduino to bypass one or the other.

    Secondly, when I shift I usually change only one derailleur. To clarify, say I have a triple chain ring. On the ride, I find a sweet spot using the middle ring. UpHill coming - I switch to the smaller front or a larger rear but not both on one shift. Don't need to - one or the other improves my situation and usually close enough. If not close enough, I tweak (probably with the derailleur I did not change initially). Chances are my changes are not sequential at all.

    So maybe a programmed set of "my favs" gears would be more useful whether accessed sequentially or directly.

    If we really were to put in the bells and whistles, Version 17.1 would chose the gear for you based on your cadence, heart rate, the incline, your power output and your fitness level and length of ride. It also stores your ride history and uses predictive logic to determine the gear and when it will shift.

    But I am happy with the promise you've shown so far! Good job. Very inventive.


    Reply 7 years ago on Introduction

    > how hard would it be to program in a gear sequence so when you hit the upshift or downshift buttons it progresses to the next gear in a logical sequence, moving either or both the front and rear ders?
    Not difficult at all. A few people have requested this so I'll add it to the feature list. The only difficulty is making installation easy with all of these new configurations.

    > Could this be programmed to account for all three?
    Definitely. The next version has an LCD so each user could choose their configuration on the screen.


    7 years ago on Introduction

    Nice Instructable!

    I can tell you the front derailleur is much easier to control with a servo than the rear. I have been working on a similar project for some time . Have you had any problems with derailleur ghost- shifting over large bumps? That  was one nut that I was having difficulty cracking without leaving the servo powered up and eating batteries.

    I look forward to seeing your updates and test results.

    2 replies

    Reply 7 years ago on Introduction

    maybe the inclusion of a wormgear would hold the derailleur in position when the electronics are sent to sleep between shifts? Perhaps something along the lines of this would optimise battery power conservation

    I think this is great and should provide endless funin the dark winter nights when riding is impossible...

    well done to all!


    Reply 7 years ago on Introduction

    Thanks for the kind comment. Good to hear the front derailleur will be easier to modify. I've seen your project a while ago and looks like you've made a lot of progress lately. I'm really impressed how professional it looks especially for someone who started tinkering with electronics in 2011!

    > Have you had any problems with derailleur ghost- shifting over large bumps?
    I have. I'm thinking of adding some tension or a normally closed brake to hold the derailleur in place to fix this.

    Maybe we should chat and see if we can help each other out. Email me at nabil dot tewolde