DIY Bike Tachometer





Introduction: DIY Bike Tachometer

About: Hi, my name is Nikodem Bartnik. I live in Poland, I'm 18 years old. I like to program and create robots, devices and things. In the future, I want to start a company that creates new technology. Right now I ...

I will show you how to build a bike speedometer. It shows your speed,
the average speed,the temperature, the trip time and the total distance. You can change it using the button. Additionally, the speed is shown on a tachometer. I built it because I like building new things, I have not found anything like this on the internet so I want to show you how to build a good speedometer as the one on my bike is not as cool as I want :) . So let's get started.

Step 1: Parts:

This is a list of parts that you will need. They cost me about $ 40 but I bought them in Poland.


-bike with reed switch

-LCD display 16x2



-thermometer DS18B20

-resistor 1.2k Ω , 4.7k Ω



-potentiometer 10 kΩ

-9V battery



-tools (drill, soldering, knife, tape)

Step 2: Connection

I added a picture from Fritzing and verbal description of how to connect it. In the picture all red wires are connected to 5V, all blue cables are connected to GND.

  • LCD display:

VSS --> GND Arduino

VDP --> 5V Arduino

VO --> output potentiometer (potentiometer VCC -> 5V Arduino, potentiometer GND -> Arduino GND).

RS --> pin 12 Arduino

RW --> GND Arduino

E --> pin 11 Arduino

D4 --> pin 5 Arduino

D5 --> pin 4 Arduino

D6 --> pin 3 Arduino

D7 --> pin 2 Arduino

A --> 5V Arduino

K --> GND Arduino

  • Servo:

VCC --> 5V Arduino

mass --> GND Arduino

Data --> pin 6 Arduino

  • Thermometer:

VCC --> 5V Arduino

mass --> GND Arduino

Data --> pin 1 Arduino

data and power is connected via a 4.7 kΩresistor

  • Sensor on wheel:

one end -> 5V Arduino

second end -> A0 Arduino and resistor 1,2 kΩ

The other end of the resistor to ground in the Arduino

  • Button:

one end --> 5V Arduino

second end --> A1 Arduino

Step 3: Upload Code:

Below I added the code in comments there is an explanation.

links to the download libraries:

If you have a different wheel diameter you have to change it. You can calculate it with this formula:

circuit = π*d*2,54 (d=diameter of your wheel, I multiplied it by 2.54 to get the result in meters).


Copyright by Nikodem Bartnik june 2014


#include  < Servo.h>
#include <LiquidCrystal.h>
#include <OneWire.h>
#include <DallasTemperature.h>

#define ONE_WIRE_BUS 1
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);

//LCD display pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
//servo name
Servo myservo;
//definition of variables
 long previous, triptime, time, impulses;
 float speedometer, dist, aspeed;
 int servo;
 int screen=1;
 //If you have other circuit of wheel you need change it
 float circuit=2.0;
 double temperature;
 void setup() {

 lcd.begin(16, 2);</p><p>
  pinMode(A0, INPUT);
  pinMode(A1, INPUT);
  //servo definition and setting the tachometer to 0
  lcd.print("Bike tachometer");
  lcd.setCursor(5, 1);
  lcd.print("V 1.0");
  lcd.setCursor(0, 0);

 void loop() {
   //if wheel turns
      //number of turns++
      //count turn time
    //count speed
    speedometer=(circuit / time)*3600.0;

   //display speed on tachometer
   void Tachometer(){
     //map speed 0-180 to servo
  servo = map(speedometer, 0, 72, 180, 0);
  //setup servo
    void Lcd(){
       //when button is clicked
        //displays speed
        lcd.setCursor(0, 1);
        lcd.setCursor(7, 1);
        //displays themperature
        lcd.setCursor(0, 1);
        lcd.setCursor(7, 1);
        lcd.print(" C");
          //displays averagr speed
        lcd.setCursor(0, 1);
        lcd.setCursor(8, 1);
        if(screen== 4){
          //diplays trip time
        lcd.setCursor(0, 1);
        lcd.setCursor(7, 1);
        lcd.setCursor(0, 0);
        //calculation of the distance
       //dislays distance

Step 4: Pack

As a cover I used a plastic box I bought for $ 1. I cut holes using a knife and a drill. Servo and LCD display I glued with a tape, tip I made with carton and painted it with paint. I did shield in Corel Draw X5 and I printed it, I added a PNG image, and Corel Draw file (if you want, you can edit it). I clipped the box to steering wheel on my bike and I soldered cables to the reed switch.

Step 5: Run It!

Now it is ready. All you need to do is turn it on and ride. Have fun with your speedometer. If you like this project, please vote on me.



    • Creative Misuse Contest

      Creative Misuse Contest
    • Oil Contest

      Oil Contest
    • Clocks Contest

      Clocks Contest

    26 Discussions

    Nice prototype-grade project, not yet practical, but it can be developed a bit. I was thinking about something like that, running on hub dynamo power (maybe even using its frequency as the tachometer/odometer input signal?), using Arduino Pro Mini and a Nokia 3310 display. No analog meters though, as they aren't too shock-resistant (unless you use military grade).

    What are you using to close the reed switch? Usually a magnet is used. Did you leave this out or is there another way to activate the switch?

    Yes, you can use it in a car

    i have run the code, but it counts by it self and the speed is 63 as a stable speed. It should give 0.00 . Any solution for that?

    and thank you for the ide

    5 replies

    Congratulations Nikus, great proyect, but I have the same problem. Can you help me? Mi email is I will thank you very much.

    Check if you have everything alright with connection. Hard to say but for sure you have problem with hardware. It is also possible that you used NC reed switch (normally close) but you should use NO (normally open)

    hi, is very important this proyect for me, can you sell me the proyect Assembled and working? i really apreciate a good price.

    I really appreciate your response. I checked the connections and they are well, I even put the cables of the same color that your own but still the same. My switch is a push buttom (NO). I'm thinking that the problem may be the libraries that may change or be different from yours. Could you send them to my mail? Thanks very much Nikus!

    This is a speedometer ,not a tachometer.

    Looks really cool! I can put this on my To-Do list (after I learn arduino :( ...)

    1 reply

    Thanks! Good luck with arduino

    Could you tell us more about Reed switches and How to connect Reed switch to wheels..?

    is there anychance that the sensor would be a steppermotor connected to the wheel ?