Introduction: GPS Based Skateboard Analyzer

I am a student at Howest Kortrijk (Belgium).

We needed to make a project with the Raspberry Pi and Flask.

I made "TrackBoard", a skateboard data tracker. You can record skateboard sessions and analyse the data afterwards on my self made website. All data is stored in a MySQL database. You can analyse the data for each individual session or you can see a weekly overview and a total overview.

Step 1: Materials

1x Red led
1x Green led
1x Blue led
3x 220 Ohm resistor
1x Push button
1x PCB 7cm x 9cm
1x Raspberry Pi 3 model B
1x Adafruit ultimate gps breakout v3
1x Powerbank
Female-Female Jumper Wires (some cables will be striped)
Case (I used a plastic box)

Step 2: Electrical Circuit

Adafruit ultimate gps breakout v3:

VIN → 5V
RX → TX (GPIO14)
TX → RX (GPIO15)


Green → GPIO16
Red → GPIO6
Blue → FIX (gps)


Button → GPIO21

Step 3: Setting Up the Pi

You need a Raspberry Pi with Raspbian already installed on it.

For this project we need to first prepare the Raspberry Pi . Connect to your Pi via SSH. Once you are in the terminal we are going to update and upgrade all packages.

sudo apt-get update && sudo apt-get upgrade

Then we are going to install MySQL (bare in mind that you also need to install the mysql-client!).

sudo apt-get install mysql-server
sudo apt-get install mysql-client

Now we are going to make sure that our GPS module works correctly.
Edit /boot/cmdline.txt

sudo nano /boot/cmdline.txt

And change:

dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait


dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait

Then edit the /boot/config.txt file

sudo nano /boot/config.txt

At the very bottom of the file add this on a new line:


Now reboot your pi:

sudo reboot

Everything should work now.

Step 4: Database

So in my database i have 3 tables.

  • tblSessions
  • tblGps
  • tblUsers

tblUsers is not connected to any of the other tables. This table is to get access to password protected pages on the website. There is already one user in the table.

Username: gaetanvdb
password: password

tblSessions and tblUsers are connected with each other. When you press the button to start recording a new skateboard session, a new session is created. tblGps keeps all the GPS data.

You will need to import the database to your pi. (Trackboard.sql) You can do this with the MySQL workbench

You will also need to make a user and give him permission.

  • Connect to MySQL:
mysql -uroot -hlocalhost -p
  • Now create the user and give him permissions:
CREATE USER 'trackboard'@'localhost' IDENTIFIED BY 'Tr@ckB0@rd';
GRANT ALL PRIVILEGES ON *.* TO 'trackboard'@'localhost' WITH GRANT OPTION;
CREATE USER 'trackboard'@'%' IDENTIFIED BY 'Tr@ckB0@rd';

Step 5: Code and Startup Scripts

You can download my code from my Github.
Download the project somewhere on your Raspberry Pi.

We are going to make 2 files start at boot.

  • → For the website
  • → For controlling the leds and button. (To be able to record sessions)

Make a new file:

sudo nano /etc/init.d/trackboard

Write this script in the file:

#!/bin/sh -

### BEGIN INIT INFO # Provides: # Required-Start: $local_fs $syslog $remote_fs dbus mysql mysql.service # Required-Stop: $local_fs $syslog $remote_fs # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Start daemon at boot time # Description: Enable service provided by daemon. ### END INIT INFO

case "$1" in start) echo "Starting TrackBoard webserver" python3 /home/pi/pycharm_oefeningen/Trackboard/ & ;; stop) echo "Stopping TrackBoard webserver" # kill applicatie killall ;; *) echo "Usage: /etc/init.d/TrackBoard {start|stop}" exit 1 ;; esac exit 0

Now adjust the permissions of the file:

sudo chmod 755 /etc/init.d/trackboard

Now update init.d:

sudo update-rc.d trackboard defaults

Do the same for the other file ""

reboot your pi:

sudo reboot

Normally the 2 scripts will be active when your Pi boots.

You can connect to the website using "your-apipa-address":5000 → (eg.

Step 6: The Case

Because the case needed to be mounted to the bottom of a skateboard, it was very important that the box was not too high. The measurements of the box are 15cm x 9,5cm x 4.5cm (Length x Width x Height).

If you want to know more about the case, view the pictures and the explanation on each photo.

Step 7: Apply "TrackBoard" on Your Skateboard

At the bottom of the case, there are Velcro strips. You just need to apply Velcro strips to your skateboard.
I can hear you think: "Is it strong enough?" YES! You can lift the whole skateboard by just holding the box and it won't come off.

Step 8: How Does It Work

  • Give the Pi power by plugging in the cable from the power bank.
  • Wait for the pi to boot (Approx. 20sec).
    • The blue light is connected to the gps. If it is blinking, it is searching to get a FIX with a satellite.
    • If it get's a FIX, the light will only blink once every 15 seconds
  • If you press the button, the red light will light up. This means that the script is in stand by (not recording a session)
  • If you press the button again the green light will light up.
    • You are now recording a new session
    • The GPS writes data to the database (Every 7 seconds)
  • If you want to STOP the session, just hold the button until the red light starts to blink.
    • All data will be saved and the pi will reboot
  • If you want to record another session, just repeat step 1.

So in short:
"Press Press Skate Hold"

If you want to view your recorded data, just connect the pi to your computer with your Ethernet cable and go to

Website login credentials:
Username: gaetanvdb
Password: password

(If the pi automatically connects to your home wifi and you know the IP, you don't need to connect the box to your PC. Just navigate to "YourIp":5000)


Swansong made it! (author)2017-06-19

That's an interesting idea :) I'd be a little worried about how close to the ground it hangs.

About This Instructable



More by gaetanvdb:GPS Based Skateboard Analyzer
Add instructable to: