Introduction: Arduino Bike Speedometer With 128 X 64 Graphics LCD

I build this speedometer for my own motorcycle. I am using it on my own Honda CD70 motorcycle (70CC) and it is working pretty well. The concept of this speedometer is very simple. A reed switch is used to measure the RPM of the wheel, and some mathematics is used to determine the circumference of the wheel. And that is then used to find the distance traveled in unit time, which is called speed.

In this project only three digital I/O pins of Arduino are used by the Display. And all other pins are available for future addition of functions, like engine temperature, fuel gauge etc.

Step 1: What You Will Need!

Parts List:

(1x) 128 x 64 Graphics LCD with blue or yellow background (your choice). Amazon.com

(1x) 40 x 60 mm prototype board Amazon.com

(1x) 220 Ohm 1/4 Watt Resistor Amazon.com

(2x) 10K Ohm 1/4 Watt Resistor Amaz on.com

(1x) 20 Pin single row Male Headers Amazon.com

(1x) 20 Pin single row Female Headers Amazon.com

(1x) 1N4001 Diod (this quantity can increase up to 5 depending on your required functionality). Amazon.com

(1x) Magnetic Reed Switch Amazon.com

(1x) Hall effect Sensor Module (3pins) if you ant to use it instead of reed switch.

If you want to use an Arduino UNO, then the following Items will not be needed.

(1x) Atmega 328p Microcontroller (Arduino UNO Boot loaded).

(1x) 28 pin DIP IC socket Adopter

(1x) 16 MHz Quartz Oscillator

(2x) 22pF Low Voltage DIP Ceramic Disc Capacitors, 50V

(1X) 7805 Voltage Regulator IC.

(2x) 10uF 25V Electrolytic Capacitors.

Additional Material.

Zip Ties.

Double Sided tape.

Electric Tape

Solder Wire

Soldering Station, or Soldering Iron or Soldering Gun.

An Arduino UNO will be required only for the first time when you burn the code into the Atmega 328p microcontroller.

I am using it with my Motor Cycle, which has its own 12V Battery, so I am using the same battery as supply voltage, If you want to use it with your bike which do not have its own power source, then you should use a 9V Alkaline battery.

Step 2: Circuit Diagram Without Using Arduino UNO

I am using Fritzing to show the diagram, because it is a good software to use for schematic and breadboard view. I have not used the whole Arduino UNO, instead I have used only the Atmega Microcontroller to make things simpler. But if you want to use the Arduino UNO board you can do it. I am sharing both the diagrams. The choice is yours.

I am using a motorcycle, which has the only indication when the gear is neutral. The indication i through a wire which is gounded when the gear is neutral. I used a diod to prevent the positive polirity at this pin, because it can kill the arduino / Atmega Microcontroller, because my motorcycle has 12V battery.

If your motor bike have indication for all the gears, you can use the same method, and use additional pins of arduino, and a little bit changes in the code. If you are unable to do this, please let me know, i will help you.

Step 3: Circuit Diagram Using Arduino UNO

If you want to use the Arduino UNO board instead of microcontroller alone the follow the above diagrams.

Step 4: Mount the Reed Switch and Magnet to Your Bike Wheel

If you are using the delicate glass reed switch, then you should place it in wooden case and secure it with hot glue, to prevent it from damage. Mount the reed switch to the wheel axle at appropriate place and attach the magnet to one of the spokes exactly in front of the reed switch.

I have used zip ties to secure the magnet to one of the spokes, and it is working well, i have tested it up to the speed of 86 KM/H, and it works fine.

Step 5: The Code

Mount your Atmega 328p in the Arduino UNO board and copy paste this code into your Arduino IDE and upload it to your Microcontroller. If you have an error of the missing library, then download the U8glib from this link and add it to your Arduino IDE libraries folder. Click Here to Download Library.

I have added a splash screen in this version, you can amend it according to your needs.

If you want to use a hall effect sensor instead of reed switch, then change must be made to schematic as well as code. I will upload the same later.

The Final Code is attached here.

Comments

author
brunorzm (author)2017-04-10

Great project!!

But I didnt understand the maxReedCounter

Could we just drop it away?

author
JoeK17 (author)2017-03-31

nice!! that's innovation!!! great!! cheers...

author
kschmidt2 (author)2017-03-22

This is really cool, and that's a nice looking GUI too, well designed.

author
Shahid Khattak (author)kschmidt22017-03-24

Thanks

author
Demijaz (author)2017-03-14

hi shahid ,its a nice project soon will order the lcd, but can you make the code for the gears indicator,1st gear to 5th gear as my bike have the gears and it would be cool if it has the gears too, thanks and advance keep on following you...

author
shakoorsaeed (author)2016-12-25

Superb! I am making this, could I replace the screen with little bigger size? Could you help me what changes and parts we need to show other gears? Could you add fuel gauge to it?

author

Screen Size don't matter, you can use any size you want, just refer to its datasheet for correct connection. If your motorcycle already has other gear indication, then you can easily add them in this speedometer, same for fuel gauge. Ask me queries with details about your vehicle. Thank for appriciation. Please vot in the upper right corner if you like Thanks again.

author

Voted already.

author

thnx

author

My bike is pulsar 150 dtsi. It has a fuel sensor installed in fuel tank which has 2 wires coming out of it. I will have to use reed switch to detech gear lever change. I would appreciate if you could help.

author

For Gear lever change, you should use two microswitches, one to the front and other to the rear of gear change lever, reed switch will not work. you can write simple code for counting gears up and down, by incrementing or decrementing it with the micro switches. Which type is your current fuel gauge, analog or digital? I have my exam going on now a days, will contact you next week.

author
Bishopsboy56 (author)2016-12-19

I plan on making a speedo for my car using this with a couple modifications of the code to make it work with a 7 segment display as well as adding an odometer function. Thanks for sharing!

author

You are welcome, Please share pictures after making.

author
BRV64 (author)2016-12-18

How do I Connect it if i have a PSB pin?

author
Shahid Khattak (author)BRV642016-12-18

Connect PSB (pin 15) to ground. Please ignore the pin labeling in the fritzing breadboard view. Just follow the pin numbers.

author
Harisiqbalengr (author)2016-12-13

salam sir shahid khattak! i never worked on arduino but i want to make this project and i also want to start working on arduino...so which arduino uno i must use...thans in advance...

author

If you are a beginner.. then you should use Arduino UNO R3. Thanks for commenting. If you feel any difficulty in this project or using Arduino then please feel free to contact me.

author

I have bought one...thnx for your reply i will definitely get your help if needed.

author
ZeeshanR3 (author)2016-12-05

Nice one Shahid Bhai,

but how will it tell about that In which gear the bike is going?

Thanx in advance.

author
Shahid Khattak (author)ZeeshanR32016-12-05

Here a few bikes have the indication for gears, but if you are using CD 70, then there are a few parts, which mus be installed in the gearbox of motor cycle, and after that you will have to change the code and schematic to show the current gear. As my motor cycle have indication only for neutral gear, so I am using it to show whether my motorcyce is neutral or not. If have a motorcycle with all the gear indications, then comment here i will help you in building that. Thanks, and vote in the top right corner if you like.

author
ZeeshanR3 (author)Shahid Khattak2016-12-05

yes i will thnx

author
rochi (author)2016-12-05

what changes in the code if I switch to an hall effect?

author
Shahid Khattak (author)rochi2016-12-05

At line No 113

Change " if (reedVal)"

to " if (!reedVal)"

and in the schematic, you will remove the 10K resistor, which is connected between ground and reed switch.

I recommend you should use a hall effect sensor module for Arduino, which comes with amplifier and potentiometer. Also you should consider the polarity of magnet or the hall effect sensor, because the sensor is polirity sensitive. Hope I explained it well. I am working on the schematics, and will upload soon here. If you find any problem, please feel free to ask. Thanks. Please vote for me in the upper right corner if you like....

The image of module I am talking about is Here.

hall effect sensor module.jpg
author
RicTonyMal (author)2016-12-05

Great Project. it might just be me but the fritzing schematics seem a little Incomplete.

author

If you think so then please identify it for me, so that I can correct it, Thanks

author
Fungineers (author)2016-12-04

That's a nice project, Shahid!

author

Thanks

author
kcraske (author)2016-12-04

Really like this project. I particularly like the inclusion of a standard schematic as well as the Fritzing. I know by using the latter people can just copy exactly where you place the components and all will work but if you want to understand how things are connected then older people like me sometimes like a schematic.

author
Shahid Khattak (author)kcraske2016-12-04

Thanks for your comment, you can vote for me if you like, please share it with your friends.

author
DIY Hacks and How Tos (author)2016-12-04

Cool. I always wonder how fast I am actually going on my bike rides.

About This Instructable

11,226views

178favorites

License:

Bio: I am a student of BS Software Engineering. I have interest in microcontroller programming. I love to make electronic projects, especially CNC.
More by Shahid Khattak:How to increase the Life of EarpieceArduino Bike Speedometer with 128 x 64 Graphics LCD
Add instructable to: