Smox (a Smart Box)

by Wout Lambrecht in Circuits > Raspberry Pi

25 Views, 0 Favorites, 0 Comments

Smox (a Smart Box)

20250620_0934188.jpg

I made a storage box that can track what products you place inside it, and how many of each. It tracks the products when you scan them with the barcode reader attached to the top of the box. It can also display the temperature and humidity on the LCD display next to the scanner.

Link to GitHub:

GitHub repository

Supplies

Materials Used:

  1. Raspberry Pi 5 Kit (including power supply, network cable, SD card, and HDMI cable)
  2. DS18B20 Temperature Sensor
  3. Joy-it SEN-KY015TF Humidity Sensor
  4. Axial Fan
  5. LCD Display with Blue Backlight (5V)
  6. DC-DC Step-up Power Supply Module
  7. SUCIKORIO Transformer (220V to 12V)
  8. Barcode Scanner
  9. Electric Solenoid Lock
  10. Diode
  11. Potentiometer
  12. Breadboard Power Supply
  13. Transistor
  14. Resistors

Note:

The total cost comes to €197 if you need to buy all the parts.

I provide more details and information on where to buy these components in the attached file.

Electronic Design

IMG_20250615_164934_786.jpg
Screenshot 2025-06-19 115343.png

I first created the electronic schematic for all the components I was going to use and connected them. I then built the circuit on a breadboard to test all the components. (I have linked the electronic schematic and the breadboard setup I made.)

Database

Screenshot 2025-06-18 162848.png

Second, I created the database to store the data from my sensors and the products scanned by the barcode reader.

(The schema for creating the database will be provided in the GitHub repository under the 'data' directory.)

Code

Screenshot 2025-06-19 085747.png
Screenshot 2025-06-19 085813.png
Screenshot 2025-06-19 085840.png
Screenshot 2025-06-19 085854.png

This was the most time-intensive phase. First, I wrote Python code to read the sensor data. I created test files for every sensor and ran the code to verify functionality. Then, I added an LCD display using a custom class I designed to simplify integration.

Next, I implemented SQL in the data repository for FastAPI calls, creating functions for all anticipated requirements. Third, I designed the HTML and CSS, starting with Figma sketches to visualize the layout. Finally, I wrote JavaScript to display data on the website. After initial implementation, I made adjustments to ensure everything worked correctly.

Once the core functionality was operational, I redesigned the website to my preferences—feel free to modify it to suit your tastes.

(The full code is available in the GitHub repository under the 'front' and 'backend' directories. Most parts of the code include comments for further details if needed.)

Made the Casing

20250609_203302.jpg

For the casing, I used wooden planks that I cut to the correct size. Here are the measurements:

  1. The whole casing: 50 cm wide, 24.5 cm high, and 23 cm deep.
  2. The small part: 12.5 cm wide, 10 cm high, with a 2 cm separator in the middle, and 18 cm deep.
  3. The big part: 32 cm wide and 21.5 cm high.

First, I attached the sides to the bottom and taped them in place so I could more easily drill in the screws.

Then, I put the top on.

After that, I made the doors with handles and attached the hinges to mount the doors.

Finally, I made holes in the right places to run the cables through.

Making Everthing Work Together

20250618_151345.jpg
20250619_092947.jpg
20250619_092908.jpg

Finally, I made sure everything worked, and then I placed my breadboard with all the components inside the small part of the box. I put the Raspberry Pi on the bottom and the breadboard on top. I installed the lock on the big door and taped the cable to the top of the box so it would not be in the way. I then screwed the fan to the back of the box and connected it. Next, I positioned the barcode reader and LCD on top of the box and connected them. Finally, I tested everything to make sure it all still worked and that no cables were loose.