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
9) Wires
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.
Attachments
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!

Participated in the
Make It Real Challenge
29 Comments
10 years ago on Introduction
Hey guys,
Sorry I was really slow on getting the arduino code back up. I've re-uploaded a pdf with the code, so everything should be good now. Enjoy!
4 years ago
Can you post a full photo of your arduino wiring without it in the box?
7 years ago
Good evening,
this application was published a long time ago but the concept triggered a new project. Check speed, distance for my model railroad. Model scale is H0 (1:87), the wheels are smaller than the one on your skateboard but with a reed relay and the attached magnet, it worked (mechanically). I still have a problem with the sketch:
After a compilation, an error message was shown:
exit status 1
stray '\342' in program
and the following line of code was highlighted:
if(millis()-last>=milisegundos){
If you can spend a minute, I would appreciate any tipp. Thanks a lot, Walter
7 years ago
Hello,
i am workind on something similar, he differences are:
- i have a line follower sensor on digital pin 2
- i have a black and white stripe with 20 mm between 2 white stripes
- i need the output on the serial monitor, and not on the lcd.
i have put up a sketch, but i have some issues with the time.
i need to:
- start the counting every time the pin 2 changes (the sensor has moved) and count the millis until next pin 2 changes, and have the speed. at the end, if the pin 2 does not changes for 1 sec, the program stop's
can someone help me?
i have this sketch until now:
// Constante:
const int buttonPin = 2; // pinul digital pentru senzorul de linie
// Variabile:
int buttonPushCounter = 0; // counter numar impulsuri (1 sau 0)
int buttonState = 0; // starea actuala a senzorului de linie (1 sau zero)
int lastButtonState = 0; // starea anterioara a senzorului de linie (1 sau zero)
long time = 0;
void setup() {
// inititalizeaza intrarea pentru senzorul de linie:
pinMode(buttonPin, INPUT);
// initializeaza comunicatia seriala:
Serial.begin(115200);
Serial.println("________________________");
Serial.println("Program test");
Serial.println("________________________");
}
void loop() {
// citeste intrarea senzorului de linie:
buttonState = digitalRead(buttonPin);
time = 0;
// compara starea butonului actuala cu cea anterioara
if (buttonState != lastButtonState) {
// if the state has changed, increment the counter
if (buttonState == HIGH) {
// if the current state is HIGH then the button
// wend from off to on:
buttonPushCounter++;
time++;
}
Serial.print("Deplasare [mm]: ");
Serial.println(buttonPushCounter*20);
Serial.print("Timp [s]: ");
time = millis();
//prints time since program started
Serial.println(time/1000);
Serial.print("Viteza [mm/s]: ");
Serial.println((buttonPushCounter*20)/(time/1000));
Serial.println("________________________");
// Delay a little bit to avoid bouncing
delay(1);
}
// save the current state as the last state,
//for next time through the loop
lastButtonState = buttonState;
time = 0;
}
8 years ago on Introduction
Hi Leonardor, would your code that you posted (speedometer.pdf) change in any way for using a hall effect sensor? Not entirely sure what the point for int milisegundos = 500 is? Also, as a matter of interest what does the value represent in serial.begin(9600)?
8 years ago on Introduction
Looks like you have both of the backlight wire grounded (LCD display)
9 years ago
heyy leonardor I'm still trying, what brand type 16x2 lcd did you use, I'd appreciate it if you commented on my email eddy_gringo@hotmail.com thanks a lot :)
10 years ago on Introduction
can some one please help me find the relay switch he is using! please thank you
Reply 10 years ago on Introduction
Here's another:
http://www.amazon.com/Directed-Electronics-8600-Magnetic-Switch/dp/B0009SUEZY/ref=sr_1_2?ie=UTF8&qid=1386311244&sr=8-2&keywords=magnet+switch
Reply 10 years ago on Introduction
Look for reed switches or hall effect sensors. Here's an example:
https://www.google.com/shopping/product/18050359336623449179?q=reed+switch&client=safari&rls=en&bav=on.2,or.r_cp.r_qf.&bvm=bv.57752919,d.cGU,pv.xjs.s.en_US.JVi-ZN0rCA0.O&biw=1371&bih=745&tch=1&ech=1&psi=dm2hUtv4DYn2oATs9ICwCw.1386311030542.3&ei=g22hUqSHK5DroATb6oDABQ&ved=0CMECEKYrMAs
10 years ago
hey leonardor I'm trying to do it, I connected everything I used your pdf arduino code and my lcd display turns on but it doesn't show mph or anything do u have any idea what could be the problem?
Reply 10 years ago on Introduction
The lines
lcd.print("RPM");
lcd.print("MPH");
towards the bottom of the code are the ones that dictate what the LCD should display. More generally, the bottom of the code after
void LCDPrint ()
is the part of the code that you should look at. Make sure you have this part exactly as written. Also make sure you haven't accidentally commented out any lines of code. But if your code is identical to the pdf file, then I'm not exactly sure what the problem could other than a wiring problem. Sorry I can't be of more help
10 years ago on Introduction
Hey guys,
How i can convert RPS to M/S & MPH to KMH?
Thanks!
Reply 10 years ago on Introduction
it isn't that hard al you have to do is rpm*(circumference of your wheel in cm)*(60 min/hr)*(1/100000 miles/inches)=speed in KMH
and change everey MPH to KMH in the code and why change RPS?
10 years ago on Step 3
Hi link for code (word file) is not working. Can you fix it? Thanks!
10 years ago on Introduction
You mentioned a 10K Potentiometer. I didnt see it anywhere in the write up, what did you use it for? And can you please re post that word doc. It is blocked by admin.
10 years ago on Introduction
hello, I love, but does not work the link to doc to download the code. I would like to try. thanks
10 years ago on Step 3
link for skateboard speedometer code.doc is down ... please re-up
10 years ago on Step 3
Hello I wanted to download the word file containing the code for this project. The link is not working. Can you please fix it. Thank you.
10 years ago on Introduction
I am unable to access the code file shown here.
Can you provide an alternate source to obtain a copy?
Richard