Phone Locker
This is a locker box for your own or your friend's/partner's phone. It is large enough to fit a Samsung Galaxy s23 Ultra.
You set the time to lock your phone in 10 minute increments via the rotary encoder and the oled screen. The phone is locked until the timer runs out. When you try to get it out by unplugging it, the timer resumes from the nearest full 10 minutes.
It can send a Telegram message to anyone that you add to the Telegram Bot. This person then gets notified when and for how long the phone is locked and also when it is unlocked again.
The box also has two methods for an emergency exit. Either one of the Telegram Bots sends the "/unlock" command or you use a magnet to activate a hidden reed switch in the back. Either will open the box immediately.
When closed the inside has a volume of 185 mm x 110 mm x 20 mm (W, D, H).
Supplies
What do you need to build this project:
- 1x Raspberry PiPico (any kind does work)
- (1x) ESP01 or any other WiFi capable MCU (if you get an PiPico with WiFi the ESPs funcionality could be implemented into it directly)
- 1x SG90 servo
- 1x Rotary encoder
- 1x SSD1306 0.91" OLED (I2C)
- 1x Reed switch
- 3x M2x10 self tapping screws
- 1x 5V Powersupply
3D Printing
The fiirst step is to print the attached STL-Files. The attached lid is single colour compared to the one in the pictures.
It should be possible to print all parts without supports.
You need one from each, except the LockPin and PinStick of which you need to print 2 each.
Soldering the Electronics
Next solder all parts together. Make sure you make the connections long enough to fit them into the box later.
The schematic provided uses an ESP01, as mentioned above you can use any other WiFI capable MCU instead or even a PiPicoW to implement the Telegram Bot into the main code. Then you only need one MCU.
Also if you do not want to use the Telegram Bot capability you do not need WiFi.
The 5 V supply can be of an sort. You could even use the USB input of the PiPico and an USB supply. You just need to fit it thorugh a hole in the box later.
Building the Box
Now you need to build the box.
Gather the printed parts first. The locking mechanism is a bit tricky to get right. To connect the LockPin to the PinStick you can use wire or cut off a piece of a paper clip. Then insert both assembled parts into the holes in the Lid_Inner. Test how they are sliding. It should go in and out of the openings wihtout any effort. You might need to sand it or add some grease.
Next add the servo into its mounting place in the Lid_inner piece. Now you need to connect both PinSticks to the SG90 servo. I have used one of the servo horns and cut it down to the first hole on each side. Then use another piece of a paper clip to attach it to the servo horn through the hole. It is important that the horn is short enough so that there is enough space between the servo shaft and the printed part to let the servo rotate even with the PinStick attached. Also make sure the connection to the servo horn allows the PinStick to move rotate. To get the position right it might be helpful to move the servo into the 90 degree position and attach the horn in the dersired way. Later you can fine tune the close and open position in the code.
Next screw in the rotary encoder. You might need to cut off the little positioning key on the top side of the encoder. The OLED gets glued into place using a hot glue gun. Also glue in the reed switch behind the little circle in the back of the Lid.
Now glue in the rest of the parts where they fit. Then feed the power wire through a hole in the back of the Lid. The hole you need to drill yourself. Like that you can choose where to feed it through and how large it has to be. You could also add it directly into the 3D print itself of course.
Next close the Lid with the Lid_Inner using the 4 M2x10 screws in the corners.
Last use a piece of filament to attach the Lid to the Base creating a hinge.
Programming
The last step is to program the PiPico and the ESP01. The code can be found on my GitHub. You might need to programm the PiPico with the current version of Micropyhton before being able to upload the code to it, as it is written in python. In the main.py you can also adjust the close and open position of the servo, as you might need to fine tune them.
The only part you need to add yourself is a Credentials.h which includes your WiFi credentials as well as the Telegram Bot Token.
After you are set and ready to detox.