Arduino Bike Speedometer With 128 X 64 Graphics LCD

42,577

209

65

Introduction: Arduino Bike Speedometer With 128 X 64 Graphics LCD

About: I am a student of BS Software Engineering. I have interest in microcontroller programming. I love to make electronic projects, especially CNC.

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.

First Time Authors Contest 2016

Participated in the
First Time Authors Contest 2016

Arduino Contest 2016

Participated in the
Arduino Contest 2016

Be the First to Share

    Recommendations

    • Explore Science Challenge

      Explore Science Challenge
    • Arduino Contest

      Arduino Contest
    • Box Challenge

      Box Challenge

    65 Comments

    0
    Mcclopp
    Mcclopp

    7 weeks ago on Step 2

    Hello Mr. Khattak my name is Marcio from Brazil, I would like to know if Is it possible to replace the space that shows "GEAR" with a programmable timer? and the space that shows "RPM" by an up / down counter .. the speedometer remains the same. I would like to use this project as a treadmill display .. would it be possible? thank you and congratulations.

    0
    Mcclopp
    Mcclopp

    Reply 22 days ago

    Thank you very much for your reply .. On the counter, in fact, I would like the "RPM" display shows the calorie spent on a walk on the treadmill, which is a formula that makes the following calculation: Km / h X 75X 0.0175 where the result is shown on the display in place of the "RPM". In place of "GEAR" I need a programmable timer to adjust the chosen time of the walk. The "SPEED" display remains the same, with only a change in the diameter of the wheel that changes to 20Cm. Please, can you help me with the programming. I don't have much experience. thank you so much.

    0
    Shahid Khattak
    Shahid Khattak

    Reply 22 days ago

    ok, Please give me a week or two and remind me after that, and I will try to help you with this

    0
    Mcclopp
    Mcclopp

    Reply 1 day ago

    Hello Mr. Khattak, as you asked me, I'm writing again to remind you about the possibility of rewriting the program with the features I requested ..can you help me?

    Thank you

    0
    Mcclopp
    Mcclopp

    Reply 22 days ago

    Thank you so much!!!

    0
    Shahid Khattak
    Shahid Khattak

    Reply 23 days ago

    Sorry for late reply, What do you mean by Up/Down Counter? And yes you can add a programable timer

    0
    Fatih1453dmrc
    Fatih1453dmrc

    24 days ago

    Hello, I did the same with the scheme and uploaded the code, nothing appears on this screen, why is the cathode pin of the diode blank? Can you help me
    WhatsApp Image 2021-05-23 at 21.49.16.jpegWhatsApp Image 2021-05-23 at 21.49.17 (1).jpegWhatsApp Image 2021-05-23 at 21.49.17.jpegWhatsApp Image 2021-05-23 at 21.49.18 (1).jpegWhatsApp Image 2021-05-23 at 21.49.18.jpegFJID1V0IW6PQ5SO.png
    1
    Shahid Khattak
    Shahid Khattak

    Reply 23 days ago

    Hi Thanks for your effort, The cathode pin is used for the gear indication of the neutral gear, it will be connected to the cathode of the battery when the vehicle is on neutral. It will be a lot easier to troubleshoot for me if you use a breadboard. From the images you sent I cannot see the connections properly

    0
    Fatih1453dmrc
    Fatih1453dmrc

    Reply 22 days ago

    First of all, thank you for your answer. First of all I want to make sure that my 12864b3 v2.0 coded screen is working. I couldn't even test the screen through the library. Can you help me to test it?

    0
    Shahid Khattak
    Shahid Khattak

    Reply 22 days ago

    Hi Welcome, are there any lables with pins of your LCD like this?

    ezgif-2-fcc743dba370.png
    0
    Fatih1453dmrc
    Fatih1453dmrc

    Reply 22 days ago

    I connected the display pins without setting up the circuit, is that the problem?

    0
    jalsingh64678
    jalsingh64678

    Question 5 months ago on Step 2

    Sir iwant speedometer bois devloper help me

    0
    MarkoS67
    MarkoS67

    3 years ago

    Dear Shahid Khattak, is it possible to display to odometer? I bought all of the components and starting to work on the speedometer. But i am curious is it possible to make odometer so i know how many kilometer my motorcycle has traveled. Many thanks, Marko.

    0
    NusratM
    NusratM

    Reply 6 months ago

    Yes, it is possible i make it, if you want to make i will sand you the code on your email.

    0
    NusratM
    NusratM

    7 months ago

    Dear Shshid Khtak, Assalam-o-alikum, I made this project with speed as well as distance showing on screen but the problem is that when magnet stop in front of reed switch the reading of distance is continue to increase. Is any idea to solve this problem.
    Thanks in advance.

    0
    Nimabaradari
    Nimabaradari

    Question 3 years ago on Step 5

    Hey bro
    I want that for my cbr1000f
    And i want to indicate gears on display

    0
    AQQA
    AQQA

    Answer 1 year ago

    There are these 7 segment gear indicators
    https://a.aliexpress.com/r3dA8c16
    They read current gear from the ECU directly, but I don't know how exactly.

    0
    mad_b
    mad_b

    Question 2 years ago

    Hello. I could not find the circuit and code to read the RPM, is it in this project ?
    I need a pickup circuit that can be read by an Arduino. Your project is cool but are you showing the spark pickup circuit here somewhere? best Regards. Lissandro.

    3
    gcurtis79
    gcurtis79

    Question 3 years ago

    You have RPM on your screen, but do not seem to have it in the diagram. What would I do to utilize this feature?

    2
    Harisiqbalengr
    Harisiqbalengr

    3 years ago

    I suspect, this line should not be commented..

    Untitled.png