A motion-detection security alarm system built for ESP8266/ESP32 microcontrollers. This system detects motion, provides audible warnings, and sends push notifications when suspicious activity is detected.
- Motion detection with PIR sensor
- Escalating alert levels (warning tone, extended warning, full alarm)
- Push notifications via Pushover service
- Web interface for remote control
- Arming/disarming functionality
- Configurable alarm durations
- ESP8266 or ESP32 development board
- PIR motion sensor
- Piezo buzzer
- Breadboard and jumper wires
- Micro USB cable for power and programming
- PIR Sensor: Connect to pin D7
- Piezo Buzzer: Connect to pin D2
- Both sensors need to be connected to VCC (3.3V) and GND
- Arduino IDE installed
- ESP8266 board support installed in Arduino IDE
- Required libraries:
- ESP8266WiFi (or ESP32WiFi if using ESP32)
- ESP8266WebServer (or WebServer if using ESP32)
- ESP8266HTTPClient (or HTTPClient if using ESP32)
- Clone or download this repository
- Create a
secrets.h
file in thesrc
folder (see below) - Open the
Alarm.ino
file in Arduino IDE - Select the correct board and port
- Upload the sketch to your ESP8266/ESP32
You need to create a secrets.h
file containing your WiFi credentials and Pushover API keys. This file is not included in the repository for security reasons.
Create a new file named secrets.h
in the src
folder with the following content:
#ifndef SECRETS_H
#define SECRETS_H
#define WIFI_SSID "YourWiFiName"
#define WIFI_PASSWORD "YourWiFiPassword"
#define PUSHOVER_USER_KEY "YourPushoverUserKey"
#define PUSHOVER_API_TOKEN "YourPushoverAPIToken"
#endif
Replace the placeholder values with your actual credentials:
YourWiFiName
: Your WiFi network nameYourWiFiPassword
: Your WiFi passwordYourPushoverUserKey
: Your Pushover user key (obtained from Pushover account)YourPushoverAPIToken
: Your Pushover API token (create an application at Pushover)
- Create an account at Pushover
- After logging in, you'll find your User Key in the dashboard
- Create a new application to get an API token
- Add these values to your
secrets.h
file
- Power on the device
- Connect to the device's web interface using its IP address (shown in Serial Monitor during startup)
- Use the web interface to:
- Arm/disarm the system
- Trigger a full alarm manually
- Check system status and motion detection count
When armed, the system will:
- Sound a short warning tone when motion is first detected
- Trigger an extended warning if multiple motions are detected in a short period
- Send push notifications for significant events
- If notifications aren't working, verify your Pushover credentials and internet connection
- If the motion sensor is too sensitive, try adjusting the sensor's sensitivity knob or the detection thresholds in the code
- Check the Serial Monitor (9600 baud) for debugging information
This project is available for hackerspace members and contributors.
The secrets.h
file contains sensitive information. Never commit this file to public repositories or share it in public forums.