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
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
- Raspberry pi 5
- Raspberry pi case
- SD Card
- Raspberry Pi T-cobbler
- Conductive Rubber Cord Stretch
- NEO6MV2
- MPU6050
- LDR
- WS2812 RGB 5050 LED / Neopixel
- Coin Vibration motor
- I2C 16x2 LCD display met Backpack
- Intenso Powerbank PD10000
- A Backpack
- 3.7mm plywood 80x40 -> It's better to buy wood in a local hardware store.
Setting Up Raspberry Pi
First you will need to prepare the Raspberry Pi:
- 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.
- In this settings window, configure:
- General Tab: set a custom hostname (example. mypi), create your own username and password and optionally set up wireless LAN and locale settings
- Services Tab: enable SSH so you can log in remotely.
- Place the SD card into the Pi and start your Pi.
- 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:
- After login in into your Pi, enable I²C, UART, SPI in raspi-config.
Wiring the Sensors
Wire everything like seen in the schematics.
Database
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
2. Install the MariaDB server
3. Start and enable the service
Now we will enable the service so it starts automatically on boot.
4. Check the status
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.
You will be prompted to:
- Set a password
- Answer several questions, answer "yes" on all of them.
6. Log in to verify it works
7. connections
If another device on your network needs to connect to the database, edit the config file:
Change bind-address = 127.0.0.1 to bind-address = 0.0.0.0, then restart:
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:
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
- Install all packages, you can do this in a virtual environment or directly on your device, using:
- 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:
Frontend
First we will need to install Apache, this is web server software. The installation process is very simple:
Laser-Cut Enclosure
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
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
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
- Shoulder balance: only ware one strap and check on the dashboard if the balance is off and if 1 vibration motor is vibrating.
- Fall detection: Tilt the backpack and make sure both vibration motors are vibrating.
- Cover the LDR and check if the LED activates.
- GPS Tracking: Go outside and verify the route on the map.
- Vibration feedback: trigger warning on the dashboard test button