Table of Contents
- System Architecture
- Sensor Suite
- Camera Integration
- Mobile Notifications
- Arm and Disarm
- Power and Backup
- FAQ
System Architecture
An all-in-one ESP32 home security system integrates door/window sensors, PIR motion detection, camera capture, keypad arming, and mobile notifications in a single cost-effective build. The dual-core ESP32 handles sensor polling on Core 1 and network communication on Core 0 simultaneously – avoiding the 15-30 second sensor blind spots that plague single-core Arduino security systems where SMS sending blocks everything else. Build cost: Rs 2,000-4,000 for a comprehensive 8-zone system. Commercial equivalent from Honeywell, DSC, or Bosch: Rs 15,000-50,000.
Sensor Suite
| Sensor | Type | Zone | Cost (Rs) |
|---|---|---|---|
| NC Reed Switch | Door/Window | Entry/Perimeter | 15-40 |
| PIR (MH-SR602) | Motion | Interior | 80-150 |
| Glass Break (KP-601) | Acoustic | Window | 200-400 |
| Smoke (MQ2) | Gas/Smoke | 24h Fire Zone | 40-100 |
| Flood Sensor | Water | 24h Flood Zone | 30-80 |
| Vibration (SW-420) | Impact | Perimeter | 15-40 |
Camera Integration
Connect OV2640 or use an ESP32-CAM module (Rs 250-400, all-in-one with onboard camera). On alarm trigger, capture a JPEG and send to Telegram bot. Telegram Bot API allows sending photos directly to your Telegram chat – free, no server required, works on Jio/Airtel 4G.
// Send image to Telegram Bot API on alarm trigger
void sendTelegramPhoto(){
WiFiClientSecure client;
client.setInsecure(); // skip cert validation
camera_fb_t* fb=esp_camera_fb_get();
if(!fb) return;
// POST multipart/form-data to:
// https://api.telegram.org/botTOKEN/sendPhoto
// with chat_id and photo JPEG data
esp_camera_fb_return(fb);
}
Mobile Notifications
Three notification channels ranked by reliability for Indian connections:
- Telegram bot (best): Works on any 4G data. Free. Instant delivery. Supports photo + text. Create bot with @BotFather, get chat ID from @userinfobot.
- WhatsApp via Twilio API: 100 free messages/month. More familiar to Indian users. Requires Twilio account and verified WhatsApp number.
- SMS via SIM800L: Works without internet, reaches feature phones, works in poor signal areas. Slower delivery (5-30s). Rs 0.10-0.30 per SMS on Indian carriers.
Arm and Disarm
- Physical keypad: 4×4 matrix, PIN code. Most reliable fallback when Wi-Fi is down.
- RFID card: Quick swipe to arm/disarm without typing PIN. Add MFRC522 reader (Rs 60-120).
- Telegram command: Send /arm or /disarm to the bot for remote control from anywhere.
- Auto-arm schedule: DS1307 RTC enables automatic arm at 11pm and disarm at 6am.
Power and Backup
ESP32 system total draw: 350-500mA (awake, Wi-Fi active). Use 12V/2A adapter with 7Ah SLA battery and automatic changeover relay for backup. LM2596 buck converter steps 12V to 5V for ESP32. At 350-500mA draw, 7Ah battery provides 14-20 hours backup. For areas with 6-8h daily power cuts common in rural India, upgrade to 17Ah or two 7Ah batteries in parallel.
Frequently Asked Questions
Can I build this without any soldering?
Yes – use breadboards and jumper wires for prototyping, and screw terminal boards with DuPont connectors for permanent installation. ESP32 DevKit, PIR modules, reed switches, and most sensor modules come with header pins ready for breadboard use.
How does the system handle Wi-Fi outages?
Always maintain local operation: door sensor triggers siren without needing Wi-Fi. Queue notifications locally in SPIFFS and send when Wi-Fi reconnects. Use watchdog timer to auto-reboot ESP32 if firmware hangs. Maintain SIM800L GSM SMS as a completely independent fallback that works without home broadband.
What is the ESP32 input voltage tolerance for sensors?
ESP32 GPIO pins are 3.3V logic – never connect 12V or 5V signals directly without a voltage divider or logic level shifter. For reed switches and PIR sensors, use 3.3V supply. For 12V sensors, use an opto-isolator (PC817, Rs 5-10 each) or resistor voltage divider to interface safely to ESP32 GPIO.
How do I prevent the system from being disabled by cutting power?
Power redundancy: 12V mains plus SLA battery with automatic changeover inside the alarm control box. Keep battery inside the locked box. Add tamper switch on enclosure that triggers alarm if opened. Use supervised wiring (EOL resistors) so wire cutting triggers alarm rather than silencing it.
Add comment