Motorcycle Universal Gear Indicator

Vassilis Papanikolaou     
Project tested




This is a new design for a universal gear indicator that can be fitted to any motorcycle as an aftermarket accessory. Its main advantage is that its operation depends entirely on the gear shift lever movement, instead of connecting to speedometer and tachometer sensors (found in expensive commercial devices), which are rarely available in older motorcycles. It consists of a main circuit including a 7‑segment LED indicator, two Hall sensors that are attached to the motorcycle frame, and a small magnet placed on the gear shift lever.


The main circuit is based on an AVR ATTINY25/45/85 microcontroller, which reads the signals of the two Hall sensors and the neutral switch and outputs the current gear number to a 7‑segment LED indicator, through a 4026 counter/decoder.

At maximum output power there is significant heat produced by IC1 and for that reason we mounted it directly on the ground plane to achieve maximum heat radiation.


Source Code

The source code is written in AVR-GCC (WinAVR) and can be programmed with the default fuses using an AVR programmer (default : ATTINY25 microcontroller and USBTiny programmer). Moreover, the constant TOP_GEAR 5 should be changed to 6 for six-gear motorbikes. Source code can be downloaded on the download section below.

PCB Design

The suggested implementation for the main circuit is a small size, double-sided PCB, with SMD packages for the microcontroller and the decoder ICs. The 7-segment LED is placed in a secondary PCB, connected vertically to the main one in a modular fashion (see pictures). Two PCBs for different Kingbright LED footprints (red and blue) are also provided.


Parts List

R1 10 to 220 Ω ½W Depending on preferred LED brightness
R2, R3 10 ΚΩ ¼W
C1 220 μF / 35V Electrolytic capacitor
C2 100 nF MKT/polyester capacitor
MCU ATTINY25/45/85 Mouser Part 556-ATTINY25-20SU
COUNTER 4026 Mouser Part 595-CD4026BPWE4
IC1, IC2 Hall sensor Melexis US5881LUA (available from adafruit)
IC3 7805 5V Regulator TO-220
BLUE Kingbright 0.3″ Mouser part 604-SC03-11PBWA/A
RED Kingbright 0.3″ Mouser part 604-SC03-12EWA
JPx Pin connectors As shown in silkscreen and pictures

Possible improvement

In the current design, when the neutral switch is open (there is a gear on), there appears to be a very small current (< 0.5 mA) sinking through R3, due to the voltage difference between the neutral switch connection (TO_POWER-4) and the microcontroller. If the neutral indicator is of LED type (not a resistor bulb), there is a possibility that it stays dimmed, instead of being completely off. In that case, a small switching diode (1N4148) can nicely replace R3 (on the same PCB) in order to block this small incoming current when the neutral switch is open, as shown in the figure below :


For a better insight in the above issue, the following script can be imported in Paul Falstad’s excellent circuit simulator:

$ 1 5.0E-6 10.20027730826997 62 5.0 50
R 192 96 192 48 0 0 40.0 5.0 0.0 0.0 0.5
R 512 96 512 48 0 0 40.0 12.0 0.0 0.0 0.5
r 192 96 192 176 0 10000.0
x 231 142 309 145 0 12 internal pullup
x 125 25 277 31 0 24 Gear Indicator
x 456 26 571 32 0 24 Motorcycle
M 192 176 96 176 0 2.0
x 65 157 118 160 0 12 AVR Input
w 192 176 192 256 0
162 512 96 512 160 1 2.1024259 1.0 0.0 0.0
r 512 160 512 256 0 470.0
d 512 320 512 400 1 0.805904783
x 413 388 499 391 0 12 protective diode
s 512 400 640 400 0 1 false
g 640 400 640 448 0
x 539 422 615 425 0 12 neutral switch
x 309 240 391 246 0 24 1N4148
x 132 377 269 380 0 12 in place of R3, and watch
d 304 256 400 256 1 0.805904783
r 304 336 400 336 0 10000.0
x 337 371 367 377 0 24 R3
S 192 320 272 320 0 1 false 0
w 192 256 192 320 0
w 304 256 272 256 0
w 272 256 272 304 0
w 304 336 272 336 0
w 400 256 400 304 0
w 400 304 448 304 0
w 400 336 400 304 0
w 448 304 512 304 0
w 512 304 512 320 0
w 512 304 512 256 0
x 131 359 276 362 0 12 flip switch to insert a diode
x 134 394 272 397 0 12 current drop to zero when
x 134 412 254 415 0 12 neutral switch is open

… or click here for direct Circuit Simulator Link

Contributed by Brett Walach









A successful circuit build will do a self-test when connected solely to 12V power (pins TO_POWER_1 and TO_POWER_2), by cycling through all digits on the 7-segment display (see video below). After the self-test, the current gear will be shown and can be changed by the shift lever movement. Note that a gear is changed when the magnet’s south pole is drawn away from the sensor (north pole will not work). Moreover, if a neutral gear is detected (from the neutral switch connected to TO_POWER_4), the display resets to zero (also acting as a self-calibrating feature if anything goes wrong). Finally, when the power is turned off, the last shown gear is stored in the MCU’s flash EEPROM and restored when the device is turned on again.


The following video shows the initialization procedure of the gear indicator :


Sensor Cable

The following photos show the construction of the 4-wire sensors cable that is plugged to the TO_SENSORS connector. The visible sensor pin parts should be covered with plastic lacquer for protection as well.




After putting it all together the circuit is now operative and ready to be installed on the motorcycle. A video showing a simulation of gear shifting (by hand) is available below :


Installation Photos

Here are some photos and videos from the installation on my Suzuki Intruder VS400







Custom Housing





Installation Videos

Installation1 – Gear shifting by hand

Installation2 Real gear shifting with engine on

Installation3 – Storing last gear in EEPROM


Thanks for reading !

Designed and built by Vassilis Papanikolaou © 2010


38 Response on “Motorcycle Universal Gear Indicator

  1. Nice Project, But i would prefer N instead of the 0 for neutral, could this be written into the source code easily ?.

    Thanks for sharing your project.

    1. Thanks for your comments. Unfortunately 7-segment display can’t display the letter “N”, so that’s why they show 0

    1. Sorry, i didn’t get you. You can display some letters on a 7-segment display but you have to modify the source code.

        1. It is not possible for a 7-segment display to show the letter “N”. For that reason an alphanumeric display needs to be used, but you have to modify both schematic and code.

    1. Just a few ideas for your project.
      You,ll need 2×7 digit displays 1 for the front cog selector ie 1>3 and one for your rear cogs ie 1>7 (presumed 21 speed).
      I would utilize your gear change levers as they have pre-defined stops which makes your hardware a little simpler as each position could just be switch/wired to the pins of an mcu with at least 10 inputs and 7 outputs (mega16/328) thus you woud,nt need the counter ic or the hall effect sensors as all i/o would be handled by the mcu.

      Hope this helps
      ps the source code id use would be switch case and is not to difficult to write.

      1. Forgot to add the Outputs would look like this,
        16 = 1st cog 6th gear
        26 = 2nd cog 6th gear
        36 = 3rd cog 6th gear Etc Etc

    1. The code is written for ATTINY25 in AVR-GCC, so if you want to use it on Arduino you have to re-write the code.

  2. hey! thank you
    it’s very usefull project!
    will you please help me to change its program for 4 gears bike?
    please help me about this

  3. Hello thank a lot to share this circuit, nice solution!
    One question: I understand this circuit is made simple for universal use but is there a way to get an additionnal feedback of real engaged gear thus in case the shift lever is activated twice or gear doesen’t engage Indicator will show wrong number?

    1. Actually it’s designed for foot gear shifting, so it depends on your gear sequence and placement of sensors.

  4. Hi,
    I need help for write source code.
    My motocycle have 6 gear,and i have to change from 5 gear to 6 but i dont know how….
    I opened the code from download section in WinAVR but but I do not know what I need to change.

    can you help me,please!?

  5. Is there a way to make this but instead of the output to an LED it have a 0-5 volt output? Reason I ask is I have an automated shifter on my race bike and can vary the shift time based on current gear… the box I use for shifting is looking for an input along these lines,
    1st gear = 1.782v
    2nd gear = 2.242v
    3rd gear = 2.960v
    4th gear = 3.630v
    5th gear = 4.310v
    6th gear = 4.660v
    Neutral = 5.000v

  6. Hello Sir,
    I am from India and i am facing some problem with the components in India i couldn’t found the S.M.D I.C of M.C.U I.C and COUNTER I.C. I got the normal or big I.Cs. so please can u provide us as P.C.B sketch of both the side and a new eagle file using the normal or big I.Cs please.
    Its my humble request to you Sir.

  7. Pls guide me about source code…How can I program microcontroller …I don’t have any idea about programming but I want to do this project…

  8. Very nice project!
    How does it distinguish from
    – changing from 2nd to neutral with one push on the lever, from
    – changing from 2nd to 1st also with one push?

    Thanks a lot!
    – Br Mikkel

    1. That’s a good point to clarify. We may need to contact the author about it. Have you tried to email him?

    2. Actually motorcycle had manual sequential you can’t change gear from 2nd to neutral have to go through 1 St gear.

  9. how could you detect the gear position at the time of starting of the vehicle?, if vehicle was stopped in 3rd gear will it show 3rd gear position at starting of vehicle or it shows 0 ?

Leave a Reply