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.

<p>what are you using for the sensor</p>
<p>I use reed switch.</p>
<p>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?</p>
<p>What is the maximum speed? Can I use it in a car?</p>
<p>Yes, you can use it in a car</p>
<p>I intend to use only the LCD</p>
<p>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?</p><p>and thank you for the ide</p>
Congratulations Nikus, great proyect, but I have the same problem. Can you help me? Mi email is vordesigns@hotmail.com. I will thank you very much.
<p>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)</p>
<p>hi, is very important this proyect for me, can you sell me the proyect Assembled and working? i really apreciate a good price. </p>
<p>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? vordesigns@hotmail.com. Thanks very much Nikus!</p>
<p>I have the same problem. </p>
<p>This is a speedometer ,not a tachometer.</p>
<p>Which arduino board you have used?</p>
<p>Looks really cool! I can put this on my To-Do list (after I learn arduino :( ...)</p>
<p>Thanks! Good luck with arduino </p>
<p>Could you tell us more about Reed switches and How to connect Reed switch to wheels..?</p>
<p>is there anychance that the sensor would be a steppermotor connected to the wheel ?</p>
<p>If you were to connect a regular motor to the wheel, you could measure its voltage and get an accurate reading of your speed, you could also use that voltage to run your system and forgo batteries altogether!</p>
<p>I've never done anything with steppermotors so I do not know. Now I'm going on holiday so I can't check it but when I get back I'll try.</p>
<p>Cool project!</p><p>You can save a wire on the DS18B20 by running it in parasite-power-mode. It's supported by the PJRC-library.</p><p>Also, i don't know how much time you get out of the 9V battery, but i cannot be very much. 40% of the energy of the 9V battery is lost as heat in the voltage regulator on the Arduino, and there isn't much more than 600 mAh in one of those, so it will run down very fast. You will get much longer runtime with a battery holder for 3 AA-cells, and connecting that to the 5V-rail. It should be plenty enough to run all your stuff nicely. If not, use 5 AA-cells, and wire it to the VIN-terminal. Then you will have 2000-2500 mAh capacity :D</p>
<p>Thank you.</p><p>I know about the 9V battery, about temperature sensor too. I plan to do a second version which will have a more function and other power will be much smaller size.</p>
Nice idea :)
<p>Thank you :)</p>

About This Instructable




Bio: Hi, my name is Nikodem. I live in Poland, I'm 17 years old. I like to program and create robots, devices and things. In ... More »
More by Nikus:Live Instructables Followers Counter Arduino Drone | Quadcopter (3D Printed) Cheap 3D scanner 
Add instructable to: