# MotorCycle Gear Indicator

11,945

41

18

This is a new design for gear indicator that can be fitted to any motorcycle . 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.

### 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: Parts List

R1 =10 to 220 Ω ½W Depending on preferred LED brightness

R2, R3 = 10 ΚΩ ¼W

Arduino Uno

Hall sensor

7805 5V Regulator TO-220

C1,C2 =220 uf

7 segment LED display (common anode)

9-12 v battery (otherwise connect the device with your bike battery supply).

connecting wires, general purpose pcb.

## Step 2: Working Principle

The main working principle is based on an AVR Arduino UNO.

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 arduino.

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

## Step 3: Circuit Diagram

```int ledPinA =  13;    // LED connected to digital pin 3<br>int ledPinB =  12;    // LED connected to digital pin 4
int ledPinC =  11;    // LED connected to digital pin 5
int ledPinD =  10;    // LED connected to digital pin 6
int ledPinE =  9;    // LED connected to digital pin 7
int ledPinF =  8;    // LED connected to digital pin 8
int ledPinG =  7;    // LED connected to digital pin 9

#define BUTTON_DOWN 4<br>#define BUTTON_UP 6
<br>```

## Step 4: Source Code

```#define BUTTON_DOWN 4#define BUTTON_UP 6int ledPinA =  13;    // LED connected to digital pin 3
int ledPinB =  12;    // LED connected to digital pin 4
int ledPinC =  11;    // LED connected to digital pin 5
int ledPinD =  10;    // LED connected to digital pin 6
int ledPinE =  9;    // LED connected to digital pin 7
int ledPinF =  8;    // LED connected to digital pin 8
int ledPinG =  7;    // LED connected to digital pin 9int val_down = 0;
int old_val_down = 0;int val_up = 0;
int old_val_up = 0;
int state = 0;
int gear = 0;// The setup() method runs once, when the sketch startsvoid setup()   {
pinMode(BUTTON_DOWN, INPUT);
pinMode(BUTTON_UP, INPUT);

// initialize the digital pin as an output:
pinMode(ledPinA, OUTPUT);
pinMode(ledPinB, OUTPUT);
pinMode(ledPinC, OUTPUT);
pinMode(ledPinD, OUTPUT);
pinMode(ledPinE, OUTPUT);
pinMode(ledPinF, OUTPUT);
pinMode(ledPinG, OUTPUT);

}void led0()
{
digitalWrite(ledPinA, LOW);
digitalWrite(ledPinB, LOW);
digitalWrite(ledPinC, LOW);
digitalWrite(ledPinD, LOW);
digitalWrite(ledPinE, LOW);
digitalWrite(ledPinF, LOW);
digitalWrite(ledPinG, HIGH);

}void led1()
{
digitalWrite(ledPinA, HIGH);
digitalWrite(ledPinB, LOW);
digitalWrite(ledPinC, LOW);
digitalWrite(ledPinD, HIGH);
digitalWrite(ledPinE, HIGH);
digitalWrite(ledPinF, HIGH);
digitalWrite(ledPinG, HIGH);

}void led2()
{
digitalWrite(ledPinA, LOW);
digitalWrite(ledPinB, LOW);
digitalWrite(ledPinC, HIGH);
digitalWrite(ledPinD, LOW);
digitalWrite(ledPinE, LOW);
digitalWrite(ledPinF, HIGH);
digitalWrite(ledPinG, LOW);

}void led3()
{
digitalWrite(ledPinA, LOW);
digitalWrite(ledPinB, LOW);
digitalWrite(ledPinC, LOW);
digitalWrite(ledPinD, LOW);
digitalWrite(ledPinE, HIGH);
digitalWrite(ledPinF, HIGH);
digitalWrite(ledPinG, LOW);

}void led4()
{
digitalWrite(ledPinA, HIGH);
digitalWrite(ledPinB, LOW);
digitalWrite(ledPinC, LOW);
digitalWrite(ledPinD, HIGH);
digitalWrite(ledPinE, HIGH);
digitalWrite(ledPinF, LOW);
digitalWrite(ledPinG, LOW); } void led5()
{
digitalWrite(ledPinA, LOW);
digitalWrite(ledPinB, HIGH);
digitalWrite(ledPinC, LOW);
digitalWrite(ledPinD, LOW);
digitalWrite(ledPinE, HIGH);
digitalWrite(ledPinF, LOW);
digitalWrite(ledPinG, LOW);

} void led6()
{
digitalWrite(ledPinA, LOW);
digitalWrite(ledPinB, HIGH);
digitalWrite(ledPinC, LOW);
digitalWrite(ledPinD, LOW);
digitalWrite(ledPinE, LOW);
digitalWrite(ledPinF, LOW);
digitalWrite(ledPinG, LOW);

} void led7()
{
digitalWrite(ledPinA, LOW);
digitalWrite(ledPinB, LOW);
digitalWrite(ledPinC, LOW);
digitalWrite(ledPinD, HIGH);
digitalWrite(ledPinE, HIGH);
digitalWrite(ledPinF, HIGH);
digitalWrite(ledPinG, HIGH);

} void led8()
{
digitalWrite(ledPinA, LOW);
digitalWrite(ledPinB, LOW);
digitalWrite(ledPinC, LOW);
digitalWrite(ledPinD, LOW);
digitalWrite(ledPinE, LOW);
digitalWrite(ledPinF, LOW);
digitalWrite(ledPinG, LOW);

} void led9()
{
digitalWrite(ledPinA, LOW);
digitalWrite(ledPinB, LOW);
digitalWrite(ledPinC, LOW);
digitalWrite(ledPinD, LOW);
digitalWrite(ledPinE, HIGH);
digitalWrite(ledPinF, LOW);
digitalWrite(ledPinG, LOW);

} void setLed(int number)
{
switch (number) {
case 0:
led0();
break;

case 1:
led1();
break;
case 2:
led2();
break;
case 3:
led3();
break;
case 4:
led4();
break;
case 5:
led5();
break;
case 6:
led6();
break;
case 7:
led7();
break;
case 8:
led8();
break;
case 9:
led9();
break;
}
}

// the loop() method runs over and over again,
// as long as the Arduino has powervoid oldloop()
{
// wait for a second
led0();
delay(1000);                  // wait for a second
led1();
delay(1000);                  // wait for a second
led2();
delay(1000);                  // wait for a second
led3();
delay(1000);                  // wait for a second
led4();
delay(1000);                  // wait for a second
led5();
delay(1000);                  // wait for a second
led6();
delay(1000);                  // wait for a second
led7();
delay(1000);                  // wait for a second
led8();
delay(1000);                  // wait for a second
led9();
delay(1000);                  // wait for a second
}void loop()
{
if ((val_up == HIGH) && (old_val_up == LOW)&&gear<7 ) {
gear += 1;

delay(100);
}
old_val_up = val_up;

if ((val_down == HIGH) && (old_val_down == LOW)&&gear>1 ){
gear -= 1;

delay(100);
}

else   if ((val_down == HIGH) && (old_val_down == LOW)&&(gear<1)){
gear += 1;

delay(100);
}

else   if ((val_down == HIGH) && (old_val_down == LOW)){
gear += -1;

delay(100);
}

old_val_down = val_down;

if (gear >= 6) {
gear = 6;
}

setLed(gear);
}```

## Step 5: Installation

After putting it all together the circuit is now operative and ready to be installed on the motorcycle.

in my pics i used this indicator for my car which is based on duke bike engine

therefore installation technique is similar for bike...

NOTE: gear mechanism is same as bike.

THANK YOU SO MUCH FOR WATCHING AND READING IT.........LIKE IT & SUBSCRIBE US.

Participated in the
Arduino Contest 2016

## Recommendations

• ### Internet of Things Class

22,715 Enrolled

## 18 Discussions

Though this person has stolen the images and idea from another person, he has changed the code from ATTiny to Arduino

show me the proof dude. It is easy to blame others but very hard to take the blame.
well you are right about schematic it was done by mistake actually i used 220uf cap but in my schematic i wrote12pf. Sorry for that but you can use both no need to worry about values.

I'm a beginner, I don't know how to connect with all pins in 7 segment display. Can you share complete circuit diagram with each pin connection.

In your schematic it says we need a 12pF capacitor, whereas is in the parts list at the beginning it says we need a 220uF. Which one is it??

Really awesome instructable

sorry alok014, but I can't give you credit for something that is not completely yours. if you had put the link in for the original site then that would have been acceptable.

3 replies

wait wait there are 3 pics that i used from Google for making my instructable attractive and i think that my code is very advanced and 100 percent better than any code for any universal indicator.i will show u my design. installation method is similar that's y i use in my step but if u are challenging than look at this

I'm not disputing the fact that you've made this instructble and manipulated the code to work on arduino. as for yours being advanced as you put it. I don't think so.
like I said I've built this for my bike following the instuctions on www. electronics lab.com and it works perfect. I used arduino to program the attiny85 both the 8pin dip and the smd.
Anyway that's it I've said my piece. people can either build your version or the can follow the link and build the original version.

this is my original version not yours if you want to show your version then show it on you instructable not on my wall u don't have any copyright and patent for your image that's y m using from Google Image other wise i don't know who are u and ur original version.This is made by me nd this is my version..

This has been done before using attiny 85.... This is the Web links for it. www.electronics-lab.com/. when you go to the website in the search box type motorcycle universal indicator.
I built it for my bike 3 years ago. It gives you the full code for the attiny85 .
also gives you the board layout so you can make your own boards.
I'd recommend this site for this project it has the full instuctions on how to build it along with videos. that's where this instructsble comes from as do all the pics.

This is brilliant, and I want to do this. I get the gist, but can you please take a picture and post it so I can see your shift lever and how it is all set up, it's not clear, for me at least, from the pictures. Sorry if I sound needy, but I really want to do this and just need that little bit more info....

Cheers

Roger

I do want to ask, though... in step 5 you said you aren't using the neutral wire to sense neutral because that is done in code, yet you do show a connection to neutral in the schematic in step 3. If you do not use the neutral connection, how does the software know which gear it is in?