Guided Practice System - GPS for Student Drivers

by ThorDi in Circuits > Raspberry Pi

123 Views, 0 Favorites, 0 Comments

Guided Practice System - GPS for Student Drivers

20260615_072942.jpg

When I first started learning how to drive, I didn't know any roads, so I asked my mom to be my co-driver, but her communication was unclear or came too late. I decided to make my own GPS which lets me select certain locations and generates a route that passes by every one of those locations.


This project was a task for school so to comply with the requirements I added an RFID reader to check who's driving, an accelerometer to check how roughly you're braking/accelerating and a servo to display your acceleration live.

Supplies

Electronics:

  1. Raspberry Pi with T piece
  2. adafruit ultimate GPS breakout board
  3. MPU6500 (MPU6050 works as well)
  4. RC522 RFID-reader
  5. At least one MIFARE Classic RFID tag (should come with the reader)
  6. LCD1602 module
  7. aurevita 7 inch mini monitor
  8. servo SG90
  9. mountable button
  10. external power supply MB102
  11. USB C cigarette lighter socket adapter
  12. USB C 3.0 Panel Mount
  13. INIU USB C to USB C-cable
  14. breadboard 17cm length
  15. potentiometer
  16. wires

Other materials:

  1. concrete plywood 4mm thick (or another strong plywood)

2x 21cmx24cm

2x 21cmx12cm

2x 24cmx12cm

  1. spruce wood (or another softer wood)

4 pieces of 1cmx1cmx12cm

2 pieces 1cmx1cmx17.5cm

  1. black matt wood lacquer (for an even black look)
  2. two 3mm diameter bolts of at least 9mm (use a nut and washer if longer)
  3. soldering tin
  4. duct tape/screws

Tools:

  1. a small wood file
  2. a bow saw
  3. a hand saw (or a table saw if you have one)
  4. wood glue
  5. a hammer
  6. nails
  7. a wood drill
  8. a tape measure
  9. a bodkin (or any long sharp tool)
  10. spring clamps
  11. soldering iron

Cost:

Assuming you already have the necessary tools and only need to buy the materials and electronics this project costs about €340, at the time of making this the Rasperry Pi makes up about €140 of that.

Downloads

Creating the Container

20260612_174338.jpg
20260612_153154.jpg
20260606_141845.jpg

Base

For the base plate and the lid of the container I cut out two 21 by 25 cm pieces of plywood using a handsaw. The side walls are 21 by 12cm and the front and back are 25 by 12cm.


Right side

On the right side wall I traced the lcd with a pencil onto the wood. I used a drill to create a hole inside the drawn lcd and put the thread of a bow saw through to cut the rest of drawing out. I also traced the head of the servo on that wall and cut it out with a bow saw.


Back side

On the back I marked the drill holes for the usb-c panel mount keystone by pushing a small dot into the wood through the holes in the keystone using a bodkin. I then drilled these holes out with a 3mm drill head. For the actual usb-port open I drilled two half overlapping holes with a 5mm head and used a round wood file to further open the hole until it fit. Next to the keystone I made a small opening for a mountable button with a 5mm drill head.


Front side

On the front I personally cut out too much for the wires of the mini monitor. A better way to do it would be to cut out a small 2.5cm deep, 3cm wide hole on the right side of the front wall. For the mounting of the monitor I used a small piece of cardboard and a bodkin to mark the spacing between the two mounting screw holes on the back of the monitor. Then using that bodkin I marked where I had to drill onto the wood. The screw holes on the monitor are 3mm. We can already mount the monitor now using the 3mm bolts.


Now that we have the walls, I cut out 4 pieces of 12cm long spruce wood from 1 by 1cm piece. I glued these pieces onto the inside edges of the two side walls. You can use nails or screws for extra rigidity.


Glueing everything

Up next we can glue all the walls together but don't forget to pre-emptively put the monitor wires in place because the heads are too big to fit through the hole. The back wall gets glued on the outside of the supporting spruce pieces but the front gets glued on the inside. That way there is a 1cm indentation, perfect for our 1cm thick monitor. After the has dried we can glue the bottom on but because there's not enough contact we also have to put one nail into each of the supporting spruce pieces.


Lid

To make sure the lid doesn't just slide off I glued two pieces of spruce on the short ends, 4mm from the edge, with a length just shorter than the inside from support piece to support piece. I used pieces of about 17.5 cm but this leaves a bit too much wiggle room so I recommend using something a bit longer.

Setting Up the Circuit

RFID reader

The RFID reader is used to check who is driving and to start the whole program.


Accelerometer

The MPU6500 is an accelerometer that is used to check for sudden braking and fast acceleration.


GPS module

The gps module tracks your location in order to save the accelerometer data to certain points on a map.


Servo

The servo is used to show the acceleration live on the device.


Button

The button is used as a safe external poweroff button.


Before we can start connecting the gps, accelerometer and button they need to be soldered. (depending on supplier other parts may need to be soldered as well) If you need help with soldering you can look at this guide.


Connecting

For connecting everything to the Raspberry Pi you can look at the breadboard image in the pdf. The accelerometer, gps module and potentiometer are actually mounted on the breadboard whereas the rest is mounted to the case.

Mind that on the pdf the external power supply isn't attached to the breadboard. This is because the 5v and 3v3 couldn't be switched but it's easier to just attach it to the breadboard and set the power correctly.

Putting everything inside the case will be done later on so we can still easily access the Pi's power and ethernet port.

Setting Up the Raspberry Pi

system_options.png
auto_login.png
interface_options.png
vnc.png

For this project I used a starting image from school. This image can be found here. If you need help with how to image a Pi you can find a guide here.


Talking to the Pi

This image has a static wired adres of 192.168.168.169 so if you set your pc's ethernet address to a static address of 192.168.168.10 and directly connect the two with an ethernet cable you can connect to it via ssh. To connect to it via ssh you can open a terminal and type ssh student@192.168.168.169 (student being the user set by the image). The password is set to P@ssw0rd and you will be asked to change it the first time you load into the pi.


Pi configurations

Use sudo raspi-config and go to system options then auto-log in and set boot to desktop ON instead of boot to console.

Still inside the sudo raspi-config window go to interface options and enable VNC, SPI and I2C. The Raspberry Pi may ask you to reboot in between. After your last enable make sure to reboot using sudo reboot if it didn't do it automatically.


Wifi

To set up the wifi connection I find it easiest to use VNC. Use realVNC viewer (or any VNC viewer) to connect to the Raspberry Pi at 192.168.168.169 with the student user and your newly chosen password.

Once connected you should see the desktop. In the top right corner you can connect to wifi using your wifi name and password.

Setting Up the Code

ssh.png
repo.png
terminal.png

All of the code is added using VS code so let's make a connection using ssh as well.

Install VS code if you don't have it already.


Importing my code

Go to the extension tab and install remote ssh. Then click on the arrows at the bottom left to connect to a new host. This will be student@192.168.168.169. Go to source control and click on clone repository. Copy this link to copy all my code and put it in the project folder. Now you have all my code but we still need to do some things first. Go to the backend folder and the open app.py. This is to make sure the correct terminal appears. Open a new terminal in VS code (see terminal top left) and paste the following code: python3 -m venv venv. Then close and reopen the terminal. It should automatically connect to the venv. Then paste: pip install -r requirements.txt. This will install all the needed libraries for this project.

In the data folder download the sql file to your pc for when we set up the database.


Files to edit

Next copy the config_example file and rename it to config.py. Change user to root, password to S3crET and database name to guided_practice_system

In the front folder go to app.js, scroll until you find the following function:

const showMap = () => {

// add your own mapbox access token

mapboxgl.accessToken =

'<acces token>';

and change access token to your own mapbox access token. To create a token you can create a free mapbox account and go to access tokens to make one.

Later on in the guide I will explain how to change the starting location of your map.

Setting Up the Database

sql.png
EER.png

SQL

To actually set up the database we need to install MySQL workbench if you don't have it and connect to the Raspberry Pi using ssh.

Create a new connection and set connection method to standard TCP/IP over ssh, the hostname should be 192.168.168.169, username: student, password: your password. The SQL hostname should be localhost, server port 3306, username root and password S3crET. Now you can go to file and open sql script, open the download sql file from before and run it using the lightning bolt.

Setting Up the Server

nano1.png
nano2.png

Apache

To make the website accessible to everyone on the same network as the Pi we will configure the apache server.

This is easiest to do via ssh via a windows terminal as done in the beginning. Go through the following steps to set everything up:

Run: sudo -i

Open the configuration file: nano /etc/apache2/sites-available/000-default.conf

Use the down arrow key to navigate to the line that currently says DocumentRoot /var/www/html or DocumentRoot /home/student/project/github.com/howest-mct/2025-2026-projectone-mct-ThorDitillieu/front, and change it to: DocumentRoot /home/student/project/github.com/howest-mct/2025-2026-projectone-mct-ThorDitillieu/front

To save, press Ctrl + X, followed by Y, and then Enter.

Next, restart Apache by running: service apache2 restart

Now, we need to set the correct permissions for the root folder.

Open the main configuration file: nano /etc/apache2/apache2.conf

Use the down arrow key to search for the following lines:

<Directory />

Options FollowSymLinks

AllowOverride All

Require all denied

</Directory>

Change them to:

<Directory />

Options Indexes FollowSymLinks Includes ExecCGI

AllowOverride All

Require all granted

</Directory>

To save, press Ctrl + X, followed by Y, and then Enter.

Setting Permissions

Fix the folder permissions by running:

sudo chown student:www-data /home/student/project/github.com/howest-mct/2025-2026-projectone-mct-ThorDitillieu/front

sudo chmod 0750 /home/student/project/github.com/howest-mct/2025-2026-projectone-mct-ThorDitillieu/front

Afterward, restart Apache again:

service apache2 restart

Check if Apache started correctly:

service apache2 status

You should see an output similar to this:

Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)

Active: active (running) since ...

Type in: exit, to leave super user.

Setting Auto Boot Backend

nano_service.png

Backend service

To make sure the backend of the website runs automatically we're going to make it run as a service.

Still inside the ssh terminal create a file named myproject.service using:

nano myproject.service

Place the following code in the file:

[Unit]

Description=ProjectOne

Project After=network.target

[Service]

ExecStart=/home/student/project///bin/python -u /home/student/project//backend/app.py WorkingDirectory=/home/student/project//backend

StandardOutput=inherit

StandardError=inherit

Restart=always

User=student CPUSchedulingPolicy=rr

CPUSchedulingPriority=99

[Install]

WantedBy=multi-user.target

Copy this file as root user to /etc/systemd/system with the command:

sudo cp myproject.service /etc/systemd/system/myproject.service

Now you can test the file by starting it:

sudo systemctl start myproject.service

You can stop the file by entering the command:

sudo systemctl stop myproject.service

If everything works correctly, you can make the script start automatically after booting:

sudo systemctl enable myproject.service

You can view the status of your service via:

sudo service myproject status

Setting Auto Boot Website

nano_autostart.png

Kiosk mode

Because we're using a monitor without touchscreen we want the website to be displayed automatically. We do this as follows:

In the ssh terminal run this to install a browser:

sudo apt install chromium-browser

Now we create an autostart file:

mkdir -p ~/.config/autostart

nano ~/.config/autostart/kiosk.desktop

Paste this inside the file:

[Desktop Entry]

Type=Application

Name=Kiosk

Exec=bash -c "sleep 5 && chromium-browser --kiosk --noerrdialogs --disable-infobars --no-first-run http://192.168.168.169"

X-GNOME-Autostart-enabled=true

Website Explanation

index.png
report_card.png
system.png

Index page

The index page shows the map and let's you generate a route to drive using the route select overlay.


Driving report card

The driving report card page let's you select a student and look at the locations where they made an acceleration mistake, filtered by ride.


System page

The system page let's you shut down the Raspberry Pi as well as test if the servo is functional.

Personalizing the Site

bounds.png
locations.png


Map

To make the map show up in your location go to app.js in VS code and change the bounds coordinates to the extreme coordinates your map should show.

All coordinates should be longitude then latitude and in decimal, degree notation

To change the marker that marks your starting location change the coordinates in the showUserMarker function to your starting coordinates.


Route options

To change the route options you need to connect via MySql and go to the tables in the database. Right click on the locations and click select rows, then in excel make a table similar to the table in the database: one column of incrementing integers, one column of coordinates separated by a comma (this column can be a text, the backend translates it to floats as long as they're separated by dots) and a column with a description that will be displayed on the website. Back in sql select everything by clicking in the top left of the table display, right click and delete rows. Click apply and finish to confirm. Now copy your excel table and do the same but click paste rows instead of delete rows. Click apply and finish to confirm.

Putting Everything Together

20260618_095303.jpg

Now that everything is set up and configured we can put everything inside the case.


Putting it in place

The lcd, servo and button each go in their respective holes. The button is screwed tight using the nut it came with. The lcd and servo I chose to tape onto the case but you can use screws if you have the right ones.

The RFID is taped onto the left of the container since it's strong enough to detect through the 4mm wood.

The breadboard is placed diagonally to fit and the Raspberry Pi fits beside it. Make sure to connect the hdmi micro, usb a and usb c ports onto the Pi before placing it in, for ease of use. If you want to make sure nothing moves too much you can remove the sticker at the bottom of the breadboard to reveal glue and stick it to the case. You can also screw the Pi onto the case if you want.


In the car

To get everything to work inside the car. Simply use the cigaret socket adapter for your usb-c power supply and wait for a gps signal.

Getting a GPS signal may take a couple of minutes and won't work inside