DIY Smart Parcel Locker System Using Raspberry Pi, SQL, and Web Dashboard
by jasper-lanoote in Circuits > Raspberry Pi
305 Views, 8 Favorites, 0 Comments
DIY Smart Parcel Locker System Using Raspberry Pi, SQL, and Web Dashboard
In this project, I will show you how to build a Smart Parcel Locker that automatically detects when a package has been delivered and securely stores it until it is collected.
When a delivery driver places a package inside the locker, the system automatically detects the delivery, records it in a database, and immediately locks the compartment. This ensures that every package remains safe and protected from unauthorized access.
The locker can be unlocked in three different ways, depending on the user's preference or situation:
- RFID/NFC Card Access – Simply present a registered RFID or NFC card to the reader to unlock the locker instantly.
- Physical Key Switch – A traditional key switch provides an additional secure access method when a card is unavailable.
- Remote Web Application – Users can unlock the locker remotely through a web-based dashboard, making it convenient even when they are not physically present.
The web application offers more than just remote control. It also allows users to view a complete history of package deliveries, including recorded delivery events and locker activity. This provides a clear overview of all packages that have been received and accessed.
By combining automatic package detection, multiple secure unlocking methods, and a web-based management system, this Smart Parcel Locker provides a reliable, user-friendly, and secure solution for receiving and managing deliveries.
Supplies
Electronics
- 1 × Raspberry Pi 5 (8GB)
- 1 × Raspberry Pi 5 Power Supply
- 1 × HX711 Load Cell Amplifier
- 4 × Load Cells
- 1 × PN532 RFID/NFC Reader
- 1 × I2C LCD Display
- 1 × Solenoid Lock
- 1 × Reed Switch (Door Sensor)
- 1 × Key Switch
- 1 × Push Button
- 1 × 12-24V Power Adapter (for the solenoid lock)
- 1 × 9V Power Adapter (for the external power supply)
- 1 × External Power Supply
- 1 × USB Flash Drive (for raspbarry pi os)
Wiring & Prototyping
- 1 × Prototype PCB / Perfboard
- 1 × Ethernet Patch Cable
- 1 × RJ45 Panel Connector
- 2 × WAGO Connectors
- Jumper Wires
Enclosure And Mechanical Parts
- 1 × 6mm basewood
- 1 × Piano Hinge
- 1 × Power Inlet Socket
- 2 × Plugs For Power Supplys
- Mounting Screws And Nuts
Tools
- Soldering Iron
- Solder
- Wire Strippers
- Screwdrivers
- Drill and Drill Bits
- Multimeter
- Laser Cutter
- 3D Printer
3D Print All Parts
You can find all the files for 3D printing here. Once you have printed it, you can click the load cells and the PN532 into place. For the reed switch section, you need to insert the legs through the small holes. This will hold the reed switch securely in place by itself.
Lasercut All Parts
The parts need to be lasercut on a 6mm sheet
Downloads
Insert All Parts in the Front Plate
You can now install the push button, the key switch, and the NFC plate into the front plate.
Both the push button and the key switch are secured with a nut.
The NFC plate uses a snap-fit (click) mounting system. Please do this carefully to avoid breaking the small retaining tabs around the edges.
Screw on the Load Cells
You can now screw the load cells onto the bottom shelf. make shure to leave 6mm on al sides for during the glueing process.
Be careful: make sure the screws are not too long and do not go all the way through the wood.
Glue the Lasercut Parts Together (step1)
First, take the four pieces with the square holes and the divider for the electronics compartment. Glue them together and clamp them tightly using clamps until they are fixed securely against each other.
Glue the Lasercut Parts Together (step2)
Take the two top pieces to make the lid. Glue them together as shown in the picture. When assembling them, make sure you leave a 6 mm margin on all sides.
Carefully place something with a bit of weight on top to keep everything pressed together, and make sure it doesn’t shift during the process.
Glue the Lasercut Parts Together (step3)
Also glue the bottom shelf in place and secure it with clamps, as shown in step 6, so that you achieve the result shown in the photo.
Hinge
The door is attached using a piano hinge. Cut it to 18 cm and pre-drill the screw holes carefully before attaching it.
If you don’t do this properly, the wood may split.
Add the Lock
To install the lock, first glue a small wooden block onto the right side so that the lock extends past the edge. Then mount the lock onto this block.
After that, attach the metal strike plate to the door using two screws, making sure it aligns correctly with the lock inside the cabinet.
Again, be careful not to use screws that are too long, so they don’t go through the wood.
Make the Appropriate Holes for Your Connectors/plugs.
The holes for the connectors still need to be made manually, since they are not included in the design.
You can, for example, install an Ethernet connector and a power cable connector like I did, but you can also use cable glands (grommets) instead if you prefer.
Connecting 230v Side
To fit the connectors neatly and compactly inside, you can use extension cable plugs without a grounding pin. These can then be connected to the plug that is located at the back of the box.
Everything is connected using WAGO connectors, which are in turn connected to the power plug at the back of the box.
Connect All the Electronics to Your Raspberry Pi
Above you can find the wiring diagram showing how everything should be connected. You can either build this on a breadboard or on a prototype PCB the choice is yours.
My preference is to solder everything and use proper connectors so everything is securely fixed.
A good tip for projects like this is to buy a kit for making custom cables amazon link
Start You Raspberry Pi And
Start up your Raspberry Pi and connect to it via SSH using Visual Studio Code remote explorer.
Clone Github Repo
Clone the github repo by copying its URL and using the Clone Git Repository button in Visual Studio Code and pasting the url.
Install Requirements
create a venv in the working directory
activate venv
install requirements.txt
run the app.py python file to start the backend
Install the DB on Ur Raspberry Pi
You can find the SQL file in the GitHub repository under the data folder.
Run this file on the MariaDB instance on the Raspberry Pi via mySQL workbench.
If MariaDB is not installed yet, you can find the installation and configuration instructions in the GitHub repository under 2_configuration.md.
Set Up Apache and Autostart Python
follow the instructions in the github repo under the folder docs in file 3_production.md. You simply need to change Apache's default document root so that it points to your index file.
You Are Now Ready to Use Your Smart Parcel Locker
enjoy!!