Mini Security System
To design a simple security system using an Arduino Nano that detects motion with a PIR sensor and provides an alert using a buzzer and OLED display.
Supplies
Deshbot shield
Arduino Nano
PIR Motion Sensor
128×64 OLED Display
Buzzer (inbuild)
Jumper Wires
Pin Connections
ComponentArduino Nano
PIR VCC - 5V
PIR GND - GND
PIR OUT - D9
Buzzer + - D11
Buzzer − GND
OLED VCC - 5V
OLED GND - GND
OLED SDA - A4
OLED SCL - A5
Downloads
Working Principle
The PIR sensor continuously checks for movement in its surroundings.
When no movement is detected:
- The buzzer remains OFF.
- The OLED displays SYSTEM SAFE.
When motion is detected:
- The PIR sensor sends a HIGH signal to the Arduino Nano.
- The Arduino turns ON the buzzer.
- The OLED displays WARNING! MOTION DETECTED.
When the motion is no longer detected, the buzzer turns OFF and the OLED returns to the safe state.
Program Flow
- Start the Arduino Nano.
- Initialize the PIR sensor and buzzer.
- Initialize the OLED display.
- Display SECURITY SYSTEM ON.
- Read the PIR sensor.
- If motion is detected:
- Turn ON the buzzer.
- Display the warning message.
- If no motion is detected:
- Turn OFF the buzzer.
- Display SYSTEM SAFE.
- Repeat continuously.
OLED Display
When the system starts:
When there is no motion:
When motion is detected:
Conclusion
This project demonstrates how an Arduino Nano can be used with a PIR sensor, buzzer, and OLED display to create a simple motion-based security system. The PIR sensor detects movement, the buzzer provides an audible alert, and the OLED provides a visual indication of the security status.