Introduction: Arduino Skateboard Speedometer

Picture of 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

Picture of 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

Picture of 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

Picture of 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

Picture of 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

Picture of 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!


leonardor (author)2013-09-05

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!

plw1946 (author)2016-11-20

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 you can spend a minute, I would appreciate any tipp. Thanks a lot, Walter

CornelN1 (author)2016-04-10


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.println("Program test");



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:




Serial.print("Deplasare [mm]: ");


Serial.print("Timp [s]: ");

time = millis();

//prints time since program started


Serial.print("Viteza [mm/s]: ");



// Delay a little bit to avoid bouncing



// save the current state as the last state,

//for next time through the loop

lastButtonState = buttonState;

time = 0;


phillip.manock (author)2015-07-19

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)?

SirusF (author)2015-03-19

Looks like you have both of the backlight wire grounded (LCD display)

dannyboy07 (author)2013-12-06

heyy leonardor I'm still trying, what brand type 16x2 lcd did you use, I'd appreciate it if you commented on my email thanks a lot :)

michmag (author)2013-11-29

can some one please help me find the relay switch he is using! please thank you

leonardor (author)michmag2013-12-05

Here's another:

leonardor (author)michmag2013-12-05

Look for reed switches or hall effect sensors. Here's an example:,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

dannyboy07 (author)2013-12-05

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?

leonardor (author)dannyboy072013-12-05

The lines
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

ипънев (author)2013-11-25

Hey guys,
How i can convert RPS to M/S & MPH to KMH?

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?

Neil.r (author)2013-08-06

Hi link for code (word file) is not working. Can you fix it? Thanks!

JustinRSharp (author)2013-07-30

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.

almogu (author)2013-06-06

hello, I love, but does not work the link to doc to download the code. I would like to try. thanks

Risso (author)2013-05-15

link for skateboard speedometer code.doc is down ... please re-up

Ronni530 (author)2013-04-12

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.

Richard.s (author)2012-12-31

I am unable to access the code file shown here.

Can you provide an alternate source to obtain a copy?


panchavanparivendhan (author)2012-05-06

hey urs was the easiest and the cheapest speedometer...and can u mail me the picture of the magnet and the relay attached to the wheel so that i can attach it to my cycle compared to it ........please mail it to me as fast as u can..u can mail me at or or reply to me as fast as u can.please please PLEASEE

Thank you!

Please, for your own sake, do NOT post your email address in public comments! It will attract spammers. Instead, send a personal message to the creator of the instructable.

painfulfart (author)2012-09-15

how do you test for sens value and milisegundos value? thanks.. also could someone explain why use a analog input not a digital input since its counting on (1023) and off(0) values?

bbsux (author)2012-07-10

Hall effect sensors always "seem" to be better until you look at all the supporting hardware you'll need to setup to make sure they get a clean digital signal. Trust me its not as easy as it sounds.

idoha (author)2012-05-29

I think you mean Arduino LONGBOARD Speedometer. Anywho, this is an awesome project, and I love skate/longboard mods. I did notice though, that the box is kinda bulky, and seeing you're only using 1input and 6 outputs, maybe switch out that uno for a pro mini:

Not as easy to code, but I think worth it for your project.

nerd7473 (author)2012-05-11

where did you get the plastic case for the arduino?

leonardor (author)nerd74732012-05-11

You can find them right here...

blinkyblinky (author)2012-05-05

I agree with Technochicken. A few thousand clicks and it is done for. Plus, it would probably miss a few clicks at high speeds...

However, a reed switch will give you easier coding.

Very cool.

ben_k (author)2012-05-04

Good project. Rater than using a mechanical relay (was it a reed switch?), it might be more reliable and longer lasting to use a solid state Hall Effect sensor, which does not rely on moving mechanical contacts to sense the magnetic field.

About This Instructable




More by leonardor:Arduino Skateboard Speedometer
Add instructable to: