DIY Bike Tachometer
![DSC01212.JPG](/proxy/?url=https://content.instructables.com/F9Z/1SYQ/HX42QUO2/F9Z1SYQHX42QUO2.jpg&filename=DSC01212.JPG)
![DSC01205.JPG](/proxy/?url=https://content.instructables.com/F5J/5CUC/HX42QTYI/F5J5CUCHX42QTYI.jpg&filename=DSC01205.JPG)
![Building a bike tachometer](/proxy/?url=https://content.instructables.com/F1E/AZ2B/HX5H64B4/F1EAZ2BHX5H64B4.jpg&filename=Building a bike tachometer)
![DIY bike tachometer](/proxy/?url=https://content.instructables.com/FH6/N250/HX6YDMFS/FH6N250HX6YDMFS.jpg&filename=DIY bike tachometer)
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.
Parts:
![DSC01182.JPG](/proxy/?url=https://content.instructables.com/F4M/064F/HX42QTTZ/F4M064FHX42QTTZ.jpg&filename=DSC01182.JPG)
This is a list of parts that you will need. They costed me about $ 40:
- Arduino
- Bike with reed switch
- LCD display 16x2
- Servo
- Breadboard
- Thermometer DS18B20
- Resistor 1.2k Ω , 4.7k Ω
- Switch
- Button
- Potentiometer 10 kΩ
- 9V battery
- Cables
- Box
- Tools (drill, soldering, knife, tape)
Connection
![bike speedmeter_GB.png](/proxy/?url=https://content.instructables.com/FF8/TWC4/HX6YDMT8/FF8TWC4HX6YDMT8.png&filename=bike speedmeter_GB.png)
![DSC01163.JPG](/proxy/?url=https://content.instructables.com/FI3/27FO/HX42PFHU/FI327FOHX42PFHU.jpg&filename=DSC01163.JPG)
![DSC01164.JPG](/proxy/?url=https://content.instructables.com/FXY/16DM/HX42PFIO/FXY16DMHX42PFIO.jpg&filename=DSC01164.JPG)
![DSC01165.JPG](/proxy/?url=https://content.instructables.com/FF6/AVBX/HX42PFL0/FF6AVBXHX42PFL0.jpg&filename=DSC01165.JPG)
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
Upload Code:
Below I added the code in comments there is an explanation.
links to the download libraries:
http://www.pjrc.com/teensy/arduino_libraries/OneWire.zip
https://github.com/milesburton/Arduino-Temperature-Control-Library
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 ################################################## */ //librarys #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 myservo.attach(6); myservo.write(180); lcd.print("Bike tachometer"); delay(1000); lcd.setCursor(5, 1); lcd.print("V 1.0"); delay(4000); lcd.clear(); delay(500); lcd.setCursor(0, 0); lcd.print("Dist:"); } void loop() { //if wheel turns if(analogRead(A0)>=300){ //number of turns++ impulses++; //count turn time time=(millis()-previous); //count speed speedometer=(circuit / time)*3600.0; previous=millis(); Tachometer(); delay(100); } Lcd(); } //display speed on tachometer void Tachometer(){ //map speed 0-180 to servo speedometer=int(speedometer); servo = map(speedometer, 0, 72, 180, 0); //setup servo myservo.write(servo); } void Lcd(){ //when button is clicked if(analogRead(A1)>=1010){ lcd.clear(); screen++; if(screen==5){ screen=1; } } if(screen==1){ //displays speed lcd.setCursor(0, 1); lcd.print("Speed:"); lcd.setCursor(7, 1); lcd.print(speedometer); lcd.print("km/h"); } if(screen==2){ //displays themperature temperature=sensors.getTempCByIndex(0); sensors.requestTemperatures(); lcd.setCursor(0, 1); lcd.print("Temp:"); lcd.setCursor(7, 1); lcd.print(temperature); lcd.print(" C"); } if(screen==3){ //displays averagr speed aspeed=dist/(millis()/1000.0)*3600.0; lcd.setCursor(0, 1); lcd.print("A.speed:"); lcd.setCursor(8, 1); lcd.print(aspeed); lcd.print("km/h"); } if(screen== 4){ //diplays trip time triptime=millis()/60000; lcd.setCursor(0, 1); lcd.print("Time:"); lcd.setCursor(7, 1); lcd.print(triptime); } lcd.setCursor(0, 0); lcd.print("Dist:"); //calculation of the distance dist=impulses*circuit/1000.00; //dislays distance lcd.setCursor(6,0); lcd.print(dist); lcd.print("km"); }
Downloads
Pack
![DSC01172.JPG](/proxy/?url=https://content.instructables.com/FV2/CPHN/HX42PFL6/FV2CPHNHX42PFL6.jpg&filename=DSC01172.JPG)
![DSC01176.JPG](/proxy/?url=https://content.instructables.com/FTR/1ZD4/HX42PU66/FTR1ZD4HX42PU66.jpg&filename=DSC01176.JPG)
![DSC01177.JPG](/proxy/?url=https://content.instructables.com/FWV/OIP8/HX42PR6V/FWVOIP8HX42PR6V.jpg&filename=DSC01177.JPG)
![speedometer.png](/proxy/?url=https://content.instructables.com/FNK/JHGH/HX42QFWY/FNKJHGHHX42QFWY.png&filename=speedometer.png)
![DSC01215.JPG](/proxy/?url=https://content.instructables.com/FW2/X6WN/HX42QV1I/FW2X6WNHX42QV1I.jpg&filename=DSC01215.JPG)
![DSC01195.JPG](/proxy/?url=https://content.instructables.com/FAW/BEP9/HX42QTXY/FAWBEP9HX42QTXY.jpg&filename=DSC01195.JPG)
![DSC01188.JPG](/proxy/?url=https://content.instructables.com/FAF/YVSY/HX42QTUQ/FAFYVSYHX42QTUQ.jpg&filename=DSC01188.JPG)
![DSC01180.JPG](/proxy/?url=https://content.instructables.com/F7F/6VCU/HX42QTT0/F7F6VCUHX42QTT0.jpg&filename=DSC01180.JPG)
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.
Downloads
Run It!
![DSC01206.JPG](/proxy/?url=https://content.instructables.com/F4R/MCO1/HX42QU2U/F4RMCO1HX42QU2U.jpg&filename=DSC01206.JPG)
![DSC01222.JPG](/proxy/?url=https://content.instructables.com/FLX/7828/HX69RO43/FLX7828HX69RO43.jpg&filename=DSC01222.JPG)
![DSC01223.JPG](/proxy/?url=https://content.instructables.com/FCL/DS57/HX69ROC0/FCLDS57HX69ROC0.jpg&filename=DSC01223.JPG)
![DSC01221.JPG](/proxy/?url=https://content.instructables.com/F6L/FAHK/HX42QW2Y/F6LFAHKHX42QW2Y.jpg&filename=DSC01221.JPG)
![DSC01218.JPG](/proxy/?url=https://content.instructables.com/FPD/NG8J/HX42QVG0/FPDNG8JHX42QVG0.jpg&filename=DSC01218.JPG)
![DSC01219.JPG](/proxy/?url=https://content.instructables.com/F8X/6AWR/HX42QVQ6/F8X6AWRHX42QVQ6.jpg&filename=DSC01219.JPG)
![DSC01220.JPG](/proxy/?url=https://content.instructables.com/FPG/1OZW/HX42QVXI/FPG1OZWHX42QVXI.jpg&filename=DSC01220.JPG)
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.