SmartPack - a Smart Posture and GPS Monitoring Backpack

by Jasper De Jonghe in Circuits > Raspberry Pi

43 Views, 0 Favorites, 0 Comments

SmartPack - a Smart Posture and GPS Monitoring Backpack

PosterWithoutQrCode.png

Do you carry your backpack the wrong way? Like carrying it on only one shoulder. Over time, this can lead to back and neck problems. Smartpack is a backpack that monitors posture and GPS data in real time and gives the user immediate feedback using vibration motors.


The enclosure in the backpack is lasercut from 3.7mm plywood with fingerjoints to connect the different panels together.

Supplies

Setting Up Raspberry Pi

First you will need to prepare the Raspberry Pi:

  1. Flash the Raspberry OS onto an SD card using the Raspberry Pi Imager. Before flashing the SD card, click the gear icon or 'Edit Settings' buttons that appears after choosing your OS and storage.
  2. In this settings window, configure:
  3. General Tab: set a custom hostname (example. mypi), create your own username and password and optionally set up wireless LAN and locale settings
  4. Services Tab: enable SSH so you can log in remotely.
  5. Place the SD card into the Pi and start your Pi.
  6. Connect to the Pi via SSH from your PC., make sure your Pi and your PC are on the same network. Open a terminal and run:
ssh username@hostname.local
  1. After login in into your Pi, enable I²C, UART, SPI in raspi-config.
sudo rasp-config

Wiring the Sensors

ProjectOneFritzingBreadboard_bb.png
ProjectOneFritzingBreadboard_schema.png

Wire everything like seen in the schematics.

Database

final_ERD.png

The Raspberry Pi runs a MariaDB (MySQL) database that stores all sensor data. In the image you can see the schematic from the tables from each table and their connections with each other.

Below you can follow the steps on how to install the MariaDB database.

1. Update the system

sudo apt update
sudo apt upgrade -y


2. Install the MariaDB server

sudo apt install mariadb-server -y


3. Start and enable the service

Now we will enable the service so it starts automatically on boot.

sudo systemctl start mariadb
sudo systemctl enable mariadb


4. Check the status

sudo systemctl status mariadb

Next to 'Active', you should see that MariaDB is running.


5. Run the security setup script

This sets a root password, remove anonymous users, disables remote root login and removes the test database.

sudo mysql_secure_installation

You will be prompted to:

  1. Set a password
  2. Answer several questions, answer "yes" on all of them.


6. Log in to verify it works

sudo mysql -u root -p


7. connections

If another device on your network needs to connect to the database, edit the config file:

sudo nano /etc/mysql/mariadb.conf.d/50-server.cnf

Change bind-address = 127.0.0.1 to bind-address = 0.0.0.0, then restart:

sudo systemctl restart mariadb


8. Import the database

Excecute this SQL script to create the database.

Backend and Web Server

The web server runs on the Raspberry Pi. It reads sensor data, writes to the database, and serves a responsive HTML dashboard.

Find all source code on GitHub.

Virtual Environment

To create a virtual environment you need to execute this command in a terminal:

python3 -m venv .venv

After you have done this, close the terminal and open another one. At the beginning of the line you should see (venv), If you see this you have done everything correctly.


Backend

  1. Install all packages, you can do this in a virtual environment or directly on your device, using:
pip install -r requirements.txt
  1. Setup the connection from your backend to the database. You will need the name of your database, your username and your password. This happens in config.py:
[connector_python]
user = <username_from_database>
host = 127.0.0.1
port = 3306
password = <password_from_database>
database = <name_of_database>

[application_config]
driver = 'SQL Server'


Frontend

First we will need to install Apache, this is web server software. The installation process is very simple:

sudo apt install apache2 -y

Laser-Cut Enclosure

20260502_183945.jpg
20260502_133532.jpg
IMG-20260502-WA0001.jpeg
20260502_184052.jpg

The enclosure is made from 3.7mm plywood. The pieces fit together using finger joints and are glued together with wood glue. The top lid is left un-glued for maintenance access.


The Raspberry Pi with case fits inside the slot on the inside. The pi's fan should be aligned with the hole.

Assembly Enclosure

[images of the assembled enclosure]

3D Print the Guard

We will need a guard to secure the fan and LCD screen, and to make the side look more clean.

Downloads

Electronics Inside the Enclosure and Backpack

20260616_113926.jpg
20260616_113949.jpg
20260616_113937.jpg
20260616_161126.jpg

Mount your Raspberry Pi with breadboard inside the plywood box. Secure it with M3 bolts and the 3D printed guard.


The LCD screen should be snug-fit into the rectangle hole in the side.

The stretch sensors are sewed on at the shoulder straps, the vibration motors are connected on the inside at the back.

Glue the LDR somewhere on the outside of the backpack.

Web Dashboard

Schermafbeelding 2026-06-16 161532.png
Schermafbeelding 2026-06-16 161628.png
Schermafbeelding 2026-06-16 161610.png
Schermafbeelding 2026-06-16 161548.png

Make sure the Raspberry Pi and your PC are on the same netwerk, now you can connect to your website.

Make sure your app.py is running and go to your IP adress in your browser. The IP adress is visible on the LCD screen. The Webserver is responsive. You can look at the website on your phone or PC.

Testing

Checklist

  1. Shoulder balance: only ware one strap and check on the dashboard if the balance is off and if 1 vibration motor is vibrating.
  2. Fall detection: Tilt the backpack and make sure both vibration motors are vibrating.
  3. Cover the LDR and check if the LED activates.
  4. GPS Tracking: Go outside and verify the route on the map.
  5. Vibration feedback: trigger warning on the dashboard test button