A simple IoT-based security system using a Raspberry Pi 3 Model B, a PIR motion sensor, an alarm (LED), and an IP camera.
When motion is detected, the system activates the alarm and attempts to capture an image from the provided camera URL.
- Detects motion using a PIR sensor
- Triggers an alarm signal on motion detection
- Fetches a snapshot from an IP camera
- Saves the captured image locally
- Clean GPIO shutdown on exit
- Raspberry Pi 3 Model B
- PIR Motion Sensor (connected to BCM pin 4)
- Alarm/Buzzer (connected to BCM pin 5)
- Wi-Fi or Ethernet connection
- IP Camera (supports snapshot URL, e.g. via Android IP Webcam app)
| Component | Raspberry Pi Pin |
|---|---|
| PIR Sensor OUT | GPIO 4 (BCM) |
| Alarm/Buzzer | GPIO 5 (BCM) |
| PIR VCC | 5V |
| PIR GND | GND |
| Buzzer VCC | GPIO 5 |
| Buzzer GND | GND |
- Proteus (this project was created using Proteus 8 Professional)
- When simulating the PIR sensor in Proteus, make sure to load the provided HEX file into the PIR module so the sensor behaves correctly during simulation.
- IP Camera App (optional):
- If you want to use an IP camera like I did, install IP Webcam from the Android Play Store.
- You can also modify the script to use your laptop’s webcam instead.
- Python Packages (for Raspberry Pi):
sudo apt update
sudo apt install python3-pip
pip3 install RPi.GPIO requests
Update the IP camera URL in the script if needed:
IP_CAMERA_URL = "http://<your-ip-camera-ip>/shot.jpg"