Introduction: "Analog" Bicycle Speedometer
In this instructable I'm going to show how to make an easy "analog" speedometer using an arduino nano, a servo motor and a few more extra components.
The analog part of the project is only in the display of the speed, all the sensing, calculus and processing is being done in a digital way inside the arduino.
Step 1: Materials
1 10k resistor
1 220 ohm resistor
1 reed switch from a house alarm
1 magnet from a hard drive ( you can use any magnet but stronger magnets can be place further way from the sensor so a strong magnet is recommended)
I used the plastic case from an old sega genesis rf box, any plastic box could be used but this one fits the components perfectly. Also I used a bike light, only for the plastic ring in the back so an already broken light would be better.
Step 2: Electronics
The electronic circuit is pretty easy, just follow the picture below. The resistor used for the LED is a 220 ohm resistor and the one used for pull down in the switch is a 10k resistor.
The servo will be used to mode the needle in the display and the LED will flash when you are going faster than the speed allowed in the scale (see last steps for more details).
Step 3: Case
Press the sides of the box and it will pop open. Make sure that your arduino and servos fits inside the box. The servo won't fit vertically so the back of it should be outside. Draw and square in the box for cutting, it have to be near the bottom and a bit to the side so the axis of the servo end at the center of the box. For cutting this hole I just made a lot of holes with a drill and finished it up with a file. You should also make a hole for the usb connector of the arduino, for the led and for the reed switch connector. Place everything inside and apply a bit of hot glue for hold everything in place. For finishing cut the back of the light and glue it to the back of the speedometer.
Step 4: Code
I based this project in the awesome project of Jenna deBoisblanc (https://github.com/jdeboi/pimpMyBike).
I simplified it by only keeping the function that calculates the speed. Added a function for displaying it on the servo, a few line of codes for detecting when you are stopped and the code that will turn on the led when you are going at a faster speed than the supported by you scale.
Here you can download the finished code with the modifications.
Step 5: Scale and Max Speed
When you are displaying your speed in digital lcd screen you can just show any speed in there, just write the number and it is, but with an analog speedometer you are physically limited by the size or your scale.
In the code you will find a variable called maxSpeed, this number represent the speed when the needle is at the end of the scale and the display can not show any higher speed. If you go faster than this the led will turn on, meaning that you probably should choose a higher value.
In my case I decided to use 36 km/h, is a speed that I won't usually achieve while riding in the city, and I know that if the needle is in the first mark I am at 9km/h, in the second one at 18 km/h and in the third one at 24 km/h. I didn't include any numbers in my scale so I can change my max speed at any time.
For finishing this project print the scale in the image (of any design of your own), glue it on top and then glue a bright color needle in the axe of the servo.
I hope you liked this instructable, it is my first project using and arduino.
I am from Argentina and I will be glad if you let me know any grammar mistake you find.
Second Prize in the
Sensors Contest 2016