Smart Letterbox
Hello everyone, I'm a student at Howest in Kortrijk. I am studying Multimedia and creative technologies, I'm in my first year. At the end of the schoolyear we had to show what we've already learned. For the assignment we needed to make a project with minimum 3 sensors and 1 actuator. I thought about it for a while and then i came up with an idea. During corona my family ordered a lot online. So I thought can I make a smart letterbox so that our packages are safe when we aren't home?
To make sure my packages are safe i have three sensors on my letterbox.
- An accelerometer to know when the top was opened.
- A PIR sensor to know when someone was near the letterbox.
- A load cell to know when the package arrived.
On the website you can see when the top was opened or when there was movement. And of course when your package was delivered.
To get your package out of the letterbox, you have to open the side door. It is closed with an electromagnetic lock. you can open or close the door on the website.
The box also has a little lcd display via this way you can say something to your mailman. you can change the message on the website.
Supplies
the cost was around €210
- Raspberry pi 4 model B
- Raspberry pi T-cobbler
- 4 Weight sensors (SEN-10245)
- Load cell amplifier
- PIR sensor
- Accelerometer
- 16*2 LCD
- Electromagnetic lock
- Power supply (3.3V, 5V, 12V)
- Microswitch
- Tip 120 transistor
- Mounting wire
- Male to male jumperwires
- Female to male jumperwires
- Female to female jumperwires
- Tin to solder
- MDF board
- corner connecters
- Hinges
- Paint
Downloads
Fritzing Schema
As you can see I needed a lot of wires to connect everything to my raspberry pi. I also needed longer wires to connect the accelerometer because it has to cross a longer distance. I cut a female to male cable in two, after that I soldered a longer piece of mounting wire between the two pieces of the cable.
pir sensor
My pir sensor could work on 3.3v but the values weren't always right so I changed it to 5v. the values were better now. You need to put two resistors so the 5v doesn't go directly to your pi as you can see on the picture.
lock
To make sure my electromagnetic lock woudn't kill my raspberry pi I linked it with a transistor and a diode over the lock.
Building My Circuit
first I made my circuit outside my case to see if everything worked and to test my code, then I made it again on the inside.
Load cell
I used 4 SEN-10245 load cells, you have to place them in the right angle as you can see on the picture. Make sure there's space under the middle part of the load cell. I attached a wooden slab on the 4 load cells with some tape.
You can see the circuit of the load cells on the fritzing scheme.
Writing My Code
You can download the code on my github. Change it to your preferences.
Github: https://github.com/EechauteAntje/SmartLetterbox
Load cell
For my load cell I used some code that i found on the internet. You can find it in this article. They explain how the code works and how to install the load cell.
Accelero meter
There's a file with a class for the accelerometer you can find this in the map 'helpers'.
PIR sensor
The PIR sensor was really easy to program you just have to read the input. You can change the sensitivity and the time delay on the two yellow turn knobs.
LCD
You can also find a file with a class for the lcd display in the map 'helpers'.
Database
This is my database model.
I made my database with mariadb.
- History: to save all the data of the sensors and actuator.
- Device: to know which deviceID is which device.
- Action: to know what action happened with the device.
Making My Case
You can see an explanation of the housing in the pdf file.
I would recommend to make it a little bit higher because that way bigger packages can fit in.
Downloads
My Site
I created my site for mobile devices. I didn't have to make a lot of changes for bigger devices so that was very easy.