Raspberry Pi Smart Money Box With AI Banknote Detection
by Vsevolod Bereza in Circuits > Raspberry Pi
228 Views, 0 Favorites, 0 Comments
Raspberry Pi Smart Money Box With AI Banknote Detection
Smart Money Box is an AI-powered piggy bank built with a Raspberry Pi 5. It uses a camera and a YOLOv26n model to recognize euro banknotes and test monopoly banknotes and automatically update the savings balance after a real deposit is confirmed.
The project combines artificial intelligence, electronics and a custom wooden enclosure. It includes a keypad and LCD display for local interaction, a servo lock controlled by a PIN, LED indicators, a buzzer for feedback and a Gradio interface for monitoring the system, viewing the camera feed, and managing settings. The special part of this project is that the balance is not updated by AI alone, the system also waits for an ultrasonic sensor to confirm that the banknote was really deposited.
The main goal of this project was to create a more interactive and intelligent way of saving money while learning about AI, sensors, hardware integration, and full-stack development.
In this Instructable, I will explain how I designed the box, assembled the electronics, developed the software, trained the AI model, and integrated all parts into a complete working system.
Laser Cut the Scan Tunnel
The first part I made was the scan tunnel. This is the section where the banknote is inserted and photographed by the camera.
I designed the scan tunnel parts and laser cut them from wooden sheet material (3.6 mm plywood). The tunnel had to be large enough for a euro banknote to pass through, but also closed enough to control the lighting inside.
The purpose of this tunnel is to create a stable environment for the camera, so the AI model receives more consistent images.
Downloads
Paint the Inside Matte Black
After laser cutting the scan tunnel, I painted the inside with matte black paint.
This was important because shiny or light-colored surfaces can reflect the LED light and create glare in the camera image. A matte black inside surface helps reduce reflections and makes the banknote easier to detect.
After the paint dried, I assembled the scan tunnel parts together.
Add the Camera, Diffuser and LED Ring Lightning
For the camera system, I used a Raspberry Pi Camera Module v2. I attached the CSI Raspberry Pi camera to a 1 mm opal white plexiglass sheet. This plexiglass acts as a diffuser layer. It helps spread the light evenly, so the camera does not see strong reflections or bright spots.
The plexiglass sheet was placed on top of the scan tunnel, with the camera positioned so it could clearly see the banknote inside. I attached an LED ring to the scan tunnel lid.
The LED ring shines through the opal white plexiglass, which diffuses the light before it reaches the banknote. This creates softer and more even lighting inside the tunnel.
Good lighting is very important for AI image detection, because shadows, glare, and uneven brightness can reduce the accuracy of the model.
Collect the Banknote Dataset
After the scan tunnel was ready, I used it to collect my dataset. I placed different banknotes inside the tunnel and captured many images under the same camera and lighting conditions that the final system would use.
This helped make the dataset more realistic, because the AI model was trained on images that look similar to the real images captured by the Smart Money Box.
Label the Images in Roboflow
I uploaded the collected images to Roboflow and manually annotated the banknotes.
Each banknote was labeled with a bounding box around the visible banknote area. The dataset included six banknote classes, with around 120 images per class. I also included null images and images with multiple banknotes. These helped the model learn what should not be accepted as a normal single-banknote deposit.
Train the YOLOv26n Model
After labeling the dataset, I trained a YOLOv26n object detection model. The model was trained to recognize six banknote classes. YOLO was a good choice for this project because it can detect objects quickly and return both the class name and the confidence score. The trained model is used by the Raspberry Pi to detect which banknote was inserted into the scan tunnel.
Laser Cut the Main Box
Next, I designed and laser cut the main enclosure of the Smart Money Box.
The enclosure holds the scan tunnel, Raspberry Pi, electronics, LCD display, keypad, LEDs, and locking system. I also laser cut a separate internal money box where the deposited banknotes fall after being scanned.
The design had to be strong enough to hold the components, but still easy to assemble and access for testing.
Assemble the Enclosure and Install the Electronics
After laser cutting all enclosure parts, I glued the pieces together.
I assembled the main outer box and the internal money collection box. I made sure that the banknote path from the scan tunnel to the storage area was clear.
This step turned the project from separate test modules into one physical prototype. I mounted all electronics inside the enclosure. I also used cable holders to improve cable management. This made the inside of the box cleaner, safer, and easier to debug.
Build the Backend and Frontend
I developed a backend and frontend. The backend controls the camera, AI model, database, sensors, LEDs, buzzer, LCD, keypad and servo lock. The frontend provides a web dashboard where the user can view the camera feed, start scans, check the balance, test hardware, and monitor system events.
Both the backend and frontend run in Docker containers on the Raspberry Pi. The Docker stack starts automatically when the Raspberry Pi boots.
Add Database and Deposit Logic + Wireless Access
The system stores deposit information in a database.
When a banknote is detected, the AI result alone does not update the balance. The system first checks if the AI result is valid and stable. Then it waits for the physical deposit sensor to confirm that the banknote actually dropped into the box.
Only after both steps are successful, the balance is updated. This prevents the same banknote from being scanned multiple times without being deposited.
To make the system easier to use, I configured the Raspberry Pi to create its own Wi-Fi network.
This means a laptop or phone can connect directly to the Raspberry Pi without an Ethernet cable. After connecting to the Raspberry Pi Wi-Fi network, the user can open the frontend website in a browser. This makes the device more portable and easier to demonstrate.
Final Result and Future Improvements
The final result is a working AI-powered money box that can detect banknotes, confirm deposits, update the savings balance and show progress on both the LCD and web dashboard. The system can also run automatically on the Raspberry Pi and can be accessed through its own Wi-Fi network.
Future improvements could include improving the AI dataset, making the enclosure more compact, adding more banknote classes and improving the mobile layout of the web dashboard.