Introduction: Arduino Skateboard Speedometer
Using an Arduino, it is easy to make a speedometer/tachometer for virtually any man-powered vehicle. I made one for my skateboard that used a small magnet to count revolutions and utilized an LCD display screen. This Instructable will show you how you can do the same step by step.
You will need a few things before we get started.
1) A man-powered vehicle (I will be using a skateboard)
2) An Arduino
3) A plastic Arduino protective box (pictured)
4) A small magnet (mine is 1/4 inch in diameter and about 0.2 inches tall)
5) A magnetic relay switch
6) A 9V battery and an adapter that connects this battery to the Arduino plug (pictured above plugged into an Arduino)
7) A small LCD screen (16 x 2 character display)
8) 10K and 47 Ohm resistors
10) A soldering iron and solder
11) Gorilla glue, super glue, crazy glue, or some adhesive of the sort
12) 10K Potentiometer
Step 1: Putting the Magnet on the Wheel
The first thing I did was embed the small magnet in my rubber skateboard wheel. I drilled a small hole (1/4" diameter to fit the magnet snugly) on the inside of one of my back wheels toward the edge of the wheel. I then dropped some gorilla glue in this hole and fit the magnet in it so about half of the magnet's height was imbedded in the wheel and half was sticking out of the wheel. Later this magnet will allow the magnetic relay switch to count the wheel's revolutions when the relay switch is near the spinning magnet.
Step 2: The Electronics
The next step is to get all the electronics functioning. The circuit diagram can be seen here. The red connections indicate attachment to the Arduino's +5V pin and the green connections are to the Arduino's ground pin. You will want to solder (and probably also heat shrink) your connection points to ensure that the circuit doesn't short itself out. This will also ensure that the connections (and thus speedometer) don't fail while it is being used. You may want to wire everything up through a small piece of board separate from the Arduino. You can wire the pot, ground and +5V components to this board to minimize the connections into the actual Arduino pins. This will keep your electronics more organized and easier to work with. It is also important to consider where you will be mounting the LCD before you wire it all up. Depending on where you choose to mount your display, it may be necessary to take steps to ensure this connection is possible once the LCD is wired up. For example, since I mounted the LCD in my board and had the wiring go through a small hole I had to put the LCD in place and run the wiring through the hole to the LCD before I connected everything.
Step 3: The Arduino Code
With the electronics all wired up and secured, the next step is to code the Arduino. There are tons of codes out there for Arduino tachometers, so it shouldn't be hard to find. The code I used for my speedometer/tachometer is attached.
One thing to note is the line that says "Serial.print(rpm*0.0080622311)." This line will be different for everyone. This line of code calculates the speed in MPH from the RPM value the relay and Arduino read. To do this you take:
rpm*(circumference of your wheel in inches)*(60 min/hr)*(1/63,360 miles/inches)=speed in MPH
One you've calculated what this constant is that the RPM must be multiplied by to convert to MPH, you can just insert it in the code in place of the 0.0080622311 that is in there now.
Once the electronics are properly wired up and the Arduino is programmed with the attached code and appropriate MPH arithmetic, the device should successfully display MPH and RPM on the LCD display when the Arduino is plugged in (as pictured). Putting the magnetic relay switch near to the magnet you put in your wheel and spinning the wheel should make the LCD display the corresponding MPH and RPM for the wheel's rotation.
Step 4: Protecting the Electronics
Next, you will want to put all your electronics in the plastic Arduino case. This case can easily fit the Aruino and the 9V as well as a fair amount of wiring. The inside of my protective box is pictured. Having the electronics in this box will not only keep the electronics together in one place, but will also make sure the electronics are protected as you travel. You might have to cut small holes in the side of the plastic box so that the wires that need to leave the box have a way out without being pinched by the top cover of the case. I also advise taping this box shut so that you don't have to worry about it opening and spilling all the electronics while you're riding.
After you've completed this step, you should have a plastic box housing the electronics and a 9V battery. Leaving this box should be two wires attached to the magnetic relay switch and 12 wires (hopefully bundled together somewhat neatly) attached to the LCD screen. When the Arduino in the plastic case is plugged in the LCD should be illuminated and counting the RPM and associated MPH whenever the small rotating wheel magnet is sufficiently close to the relay switch.
Step 5: Mounting the Components
Last but not least, you will want to mount the speedometer you have just built. This is a matter of preference and also depends on what vehicle you plan on attaching your device to.
For my skateboard, I mounted the plastic box on the underside of the board up by the front truck (pictured). The relay switch wires ran down the middle of the board to the back truck where the small magnet was imbedded in the wheel. I then secured the relay switch near the wheel by zip tying the switch to the truck. The 12 conductors that are wired to the LCD leave the plastic box and run up to a small hole on the nose of the board. The hole leads into the small chamber where the LCD is embedded on the top of my board (and covered by a piece of thin acrylic. Of course there are a number of ways to mount the speedometer and it is up to you to find the way you like best. The method I used of embedding the LCD in the top of the deck would not work for most boards since it requires a very thick deck.
Before using your new hi tech skateboard (or whatever vehicle you mount the speedometer on), make sure all the wires are secured in such a way that they aren't loose and won't get caught in your wheels. This could lead to destroying your speedometer, or worse, wiping out and hurting yourself.
With all these steps completed and your device mounted, you are now ready to try out your speedometer and try to break your own speed records! Have fun!
We have a be nice policy.
Please be positive and constructive.