Intro: The Longboard Speedometer
Hello fellow longboarder!
Been thinking of building your own longboard the easy way?
Are you into technology?
Then this might be the perfect DIY project for you...
The Longboard Speedometer powered by a Raspberry pi displays your current speed, travelled distance and other on a 16x2 lcd in front of the board and a web page running on the pi.
For the longboard itself you need to be a little bit handy. You got to shape a board, dril holes, varnish. I had never really done something like this before and it was not hard at all.
This is an end project in my first year of ict university so to understand the electrics you will need to have basic understandings of making an electric circuit, coding in python, hmtl, css (+flask) and sql.
Whatsoever you can download all the files so you don't need to exactually code something.
Step 1: Parts
Total price of all parts: 324 euro
I made a list of materials you need in excel you can download below.
(click on the links to see the parts on the internet!)
Step 2: Building the Longboard
1. Making the deck
The deck itself is made out of 15mm multiplex wood.
The pro deck shapers might say this is not the right way to build a longboard deck, but if this is your first time building a deck this will do the job.
I printed a longboard fish-tail design (file will be below). If you want to look for other designs, this is the site.
- Print the design
- Glue it to the multiplex wood.
- Start cutting. (I used a normal jig saw)
- Drill the truck holes.
- Lasercut! I suggest to use your own personal illustrator design, but if you want to use my NMCT (name of my study) logo, the file will be below. This logo was engraved 2mm. I also lasercutted in the front of my deck to place the lcd into the longboard. This was 9mm deep.
- Varnish. I used 1 layer for the upper deck (griptape comes on) and 2 layers for the bottom deck. (Wait for the varnish to dry after layers! +- 10hours)
2. Putting on the griptape
- Take the grip of the sticker and place it nicely and tide on the board. Make sure the griptape covers all of the board.
- Take a screwdriver and push on the sides of the board so the sides become well visible.
- Cut the sites in a corner of 45° and try to do this in one smooth move.
3. Adding the trucks/wheels
An accurate drilling of truck holes is needed to put the trucks in place nicely.
- Screw the screws trough the griptape and board with a drilling machine, but not all the way down (leave 2mm)! Screwing them all the way down will leave ugly srew marks on the grip tape.
- Take the trucks and put them trough the srews.
- Secure the bold until a decent amount of pressure is noticed. You will see that the screws on top will go down in a more controlled way.
ET VOILA, you just made your own longboard. Let's head to the electrical part.
Step 3: Wiring Sheme
Up here you can find the wiring sheme.
I used two electrical components:
- 3144 Hall effect senor
- 16x2 lcd
You will need a couple of wires to wire all the pins.
Step 4: Hardware Build
In this step I will explain how I added the additional electronic hardware to the board.
1. Attaching the flex-o-boxes
This is the first thing you want to do. Place the first box, which is gonna to be holding the Pi, 3cm after the front trucks. You can also already attach the nuts to the hole were the wires are going to go trough. Off course you want to make sure the box is centered on the board.
If you think the box is in a good position start screwing in the screws displayed on the parts list. When this proces is finished place the second box after the first one and start screwing again. It's important there is a connection hole between the two boxes, this for the usb cable which runs trough the boxes to power the pi.
2. Placing the Raspberry pi & Battery bank
The Raspberry Pi will have it's place in the first box and the battery bank in the second box.
You will need a cutter knife to cut out some plastic to hold the pi. This is because the micro-sd cart sticks out for 2mm and this makes the Pi to big.
3. Hall sensor + lcd
- Take a screw and put it trough 2 of the magnets.
- Srew this into the side of the wheel so only the magnets stick out.
- Take some elctrical tape and secure the hall sensor and its cables so it can't be moved anymore.
- Take the cables an put them trough the spiral wire wrap, trough the hole in the nut, in its specified port.
- Drill trough the lasercutted engraving to put the ports of the lcd trough the board, so they can be reached on the bottom of the board.
- Place in the lcd.
- Connect the wires on the lcd like displayed in the previous step
- Put them trough the spiral wire wrap all the way to the Pi. (Yes, this can be frustrating)
- Conect the wires to the Pi like displayed in the previous step.
4. 3D printed frame
I tought the green borders of the lcd were ugly so I searched on the internet and found a design.
It covers up the borders nicely.
Step 5: Coding
After booting and logging into the Pi you have to check if there are any updates. This is for the mysql database.
For updates & installs you have to be connected to the internet!
For connecting to wifi, check this: connect to wifi
To update first type:
sudo apt-get update && sudo apt-get upgrade
Install these 3
- sudo apt-get install mysql-server
- sudo apt-get install mysql-client
- sudo apt-get install python3-mysql.connector
If done correctly you can now log in to mysql
mysql -uroot -p
To not use the root user in the database you will need to make a new user.
If you don't want to change the file please use this user:
user : pierre
pwd : geheim
CREATE USER 'user'@'%' IDENTIFIED BY 'pwd';
GRANT ALL PRIVILEGES ON *.* TO 'user'@'%' WITH GRANT OPTION
Now type "quit" to stop mysql
To start up with your own account type
mysql -u'user' -p or mysql -upierre -p
Now you can create a new schema by typing (TLS or The Longboard Speedometer = name of the database)
CREATE SCHEMA TLS;
Now it's finally time to paste the text to create some tables.
In the file 'sql.txt' you can find the text to be copied and pasted in the mysql terminal.
After doing this you are done with mysql.
2. Rest of the code
To get the rest of the code go to my github account were you can find all the other files.
Press the green clone or download button and copy the link.
Go to the Pi terminal (make sure you are on the homes ($)) and type:
A directory will be made in the working directory.
3. Startup script
If you want to start your project automatically while booting the py please do the following:
Type in the Pi terminal
sudo nano /etc/rc.local
and type the following under 'fi'
sudo python3 /home/pi/LongboardSpeedometerOfficial/3144_lcd.py &
sudo python3 /home/pi/LongboardSpeedometerOfficial/LongboardSpeedometer.py &
Step 6: LCD & Web Page
After a while when booting the Pi you will be able to see the current speed on your lcd.
This will explain how you will get the web page running on the Pi.
- Make sure your pi is connected to a wifi network
- Plug in your ethernet cable and start the command line.
- Check the ip adress of the Pi typing: ifconfig
- See the third row wlan0 and copy the inet adrr. (for example: 192.168.0.158)
- Pull out the internet cable.
- Surf on a device connected on the same network to the ip and add :8080
- You are now on the website .
When you start a session on the website, on the second line of the lcd, the travelled distance of that session will be displayed.
When you stop the session on the add session page, the second line will dissapear.