Intelligent Safe Zone
by Heorhii Horokh in Circuits > Raspberry Pi
15 Views, 0 Favorites, 0 Comments
Intelligent Safe Zone
I made an Intelligent Zone Intrusion Detection System.
It is a smart security prototype that uses a Raspberry Pi, a USB camera, and a YOLO AI model to watch a restricted area.
The goal of this project is simple: make a low-cost system that can detect when a person enters a protected zone and react immediately. The system can show detections on the camera feed, check if someone is inside the restricted zone, and trigger security actions such as an alarm, LED status, servo door action, Telegram notification, and event logging.
This project is useful for small spaces like study rooms, labs, offices, or personal work areas where a normal camera is not enough. Instead of only recording video, the system understands what is happening and gives a clear response.
I built this project to show how AI and embedded hardware can work together in a practical security solution that is affordable, interactive, and easy to demonstrate.
Link for cloning my git repository: https://github.com/howest-mct/2025-26-projectone-ctai-heorhiihorokh-create.git
Supplies
For the box I used this site https://www.makercase.com/laserSlide and also I used Raspberry Pi5 and Projectboard Freenove and WebCam Emeet 4k, roboflow https://app.roboflow.com/ draw io https://www.drawio.com/ canva https://www.canva.com/ docker https://www.docker.com/products/docker-hub/ vs code https://code.visualstudio.com/ gradio https://gradio.app/ face crop https://picturekit.app/en/face-crop video frame https://videotoframes.com/ chat gpt *for planning* https://chatgpt.com/
Design the Laser Cut Enclosure
First, I designed the main enclosure for the system using MakerCase LaserSlide. MakerCase is useful because it lets you enter the box dimensions, material thickness, and then export a laser-cut file such as SVG or DXF. It also gives a 3D preview, so I could check the shape before cutting.
The enclosure was planned to hold the main electronics:
Raspberry Pi
Project board
USB camera cable
Servo wires
LED indicators
Button extensions
Power cables
I kept the design simple and practical so the electronics could be protected but still easy to access during testing.
After generating the basic box shape, I prepared the file for laser cutting.
I added openings for the camera cable, button access, LED visibility, and wiring. I also planned space inside the box for the Raspberry Pi and the project board.
The goal was to make the enclosure compact, clean, and easy to assemble. The box works as the main body of the security device.
Downloads
Laser Cut the Enclosure Parts
Next, I assembled the enclosure.
The Raspberry Pi and project board were placed inside the box in a clean layout. I kept the wires organized so the hardware could be tested and adjusted easily.
The enclosure gives the project a more finished look and makes the prototype feel like a real security device, not just loose electronics on a table.
Assemble the Enclosure
Next, I assembled the enclosure.
The Raspberry Pi and project board were placed inside the box in a clean layout. I kept the wires organized so the hardware could be tested and adjusted easily.
The enclosure gives the project a more finished look and makes the prototype feel like a real security device, not just loose electronics on a table.
Inside the enclosure, I mounted the Raspberry Pi and the project board.
The Raspberry Pi is the main controller of the system. It runs the AI detection, reads the camera feed, controls the hardware, and communicates with the interface.
The project board is used to connect the physical components such as buttons, LEDs, and the servo system.
I made sure the Raspberry Pi and project board had enough space around them for wiring and airflow.
Connect the Servo, LEDs, and Buttons
After mounting the boards, I connected the hardware components.
The servo is used for the door or lock movement. It receives a control signal from the Raspberry Pi and moves when the system reacts to a detection.
The LEDs show the system status:
Blue means the system is starting or initializing.
Green means the system is active.
Red means an intrusion was detected.
I also added long physical button extensions in a LEGO-style design. These make the buttons easier to press from outside the enclosure and fit better with the demo model.
For the button controls, I used:
GPIO 26 for one main button.
GPIO 16 for the second main button.
These buttons can be used for actions such as starting, stopping, or resetting the monitoring system.
For the servo, I kept the wiring clear:
Servo power goes to 5V.
Servo ground goes to GND.
Servo signal goes to the GPIO pin used in the code.
The important part is that all hardware components work together as one system: camera input, AI detection, LED feedback, button control, and servo movement.
Build the LEGO Demo Area
After the electronics were prepared, I built a small physical demo area using LEGO.
The LEGO model represents the protected space. It makes the restricted zone easy to understand visually during the demonstration.
I created:
a small room or area,
a restricted zone,
a door or gate,
a place for the camera to watch the scene,
a servo-controlled part for opening or closing the door.
The LEGO setup helps show the idea clearly: when someone enters the protected zone, the system can detect it and react.
Then I connected the servo to the LEGO door mechanism.
The servo is positioned so it can move the door between two states:
open
closed
I adjusted the servo arm so the movement was strong enough to control the door without forcing the mechanism.
This makes the system more interactive because the AI detection does not only appear on the screen. It also creates a real physical action.
Collect the Dataset
To make the AI system work in the real setup, I collected images using the same USB camera that is used in the final project.
I collected images from the real demo environment, including:
empty zone,
person outside the zone,
person inside the zone,
worker situation,
intruder situation,
different lighting,
different camera angles,
different object positions.
This makes the dataset closer to the real demonstration environment.
After collecting the images, I annotated them for the YOLO model. The model learns what to detect from these annotated images.
Train and Export the YOLO Model
After the dataset was prepared, I trained a YOLO object detection model.
The model is used to detect objects or people in the camera image. After detection, the system checks the position of the detected object compared to the restricted zone.
The important logic is:
the camera sees the scene,
YOLO detects the object or person,
the system checks if the detection is inside the restricted zone,
if needed, the system triggers the hardware reaction.
This makes the project smarter than a normal camera because it understands the scene and reacts to it.
Test the Detection in Real Life
After training and exporting the model, I tested it in the real LEGO setup.
The USB camera watches the protected area. The detection appears on the live camera feed with bounding boxes and labels.
During the test, the system can show:
who or what is detected,
where the restricted zone is,
whether the detected object is inside the zone,
the current system state,
the hardware reaction.
When an intrusion is detected, the system can activate the red LED, trigger the alarm logic, move the servo door mechanism, and log the event.
For the final demonstration, the system works as one complete prototype.
The Raspberry Pi runs the project.
The USB camera watches the LEGO restricted zone.
The YOLO model detects objects or people.The software checks if the detection enters the restricted area.
The LEDs show the current status.
The buttons control the system.
The servo moves the door mechanism.
The interface shows the detection in real time.
The result is a practical low cost AI security prototype that combines computer vision, embedded hardware, physical interaction, and real-time response.