Introduction: ESP32+RC522+IFTTT=Home Security
Hi! I made this small project with ESP32 development board, RC522 RFID reader, hall senor and IFTTT.
You will receive notification or SMS on smart device if someone opens Your door and doesn`t put correct RFID tag in 10 seconds.
Step 1: Get All the Parts
2. RC522 RFID
3. Wires
4. Hall Sensor
5. Magnet (I used neodymium but any magnet would be fine)
Links are just for reference. You can get these parts much cheaper from e-bay ;)
Step 2: Wire All Connections
1.Connect ESP32 to RC522:
P5 <-> SDA
P18 <-> SCK
P23 <-> MOSI
P19 <-> MISO
P22 <-> RESET
GND <-> GND
3V3 <-> 3V3
2.Connect hall sensor (check Datasheet if You use different sensor):
Connect ESP32 P21 to Vout of hall senor and 3V3 to V+ and GND to V- . Put 1k to 10k resistor between P21 and 3V3
Step 3: Create IFTTT Account and Make Applet
1.Go to IFTTT.com and register (if You haven`t already, basic version is for free);
2.Create Applet -> go to "My Applets" -> "New Applet" ;
3.Press "this";
4.Search for "webhooks"';
5.Enter name : "DoorAlarm" //this will be added in our ESP32 programm
6.Press "that";
7.Search for "notification" (You can also search for SMS or e-mail);
8.Choose action: "Send a notification from the IFTTT app".
9.Complete action fields: enter message that will be delivered to Your smart device.
10.Press "Finish".
Step 4: Programming
1.prepere arduino IDE: ESP32 With Arduino IDE
2.download code;
3.Go to: https://ifttt.com/maker_webhooks and press "Documentation" and get Your key. Copy key to ESP32 code;
4.Change Your network credentials;
5.Read Your RFID cards UID and change these lines for Your card:
if (rfid.uid.uidByte[0] == 61 &&
rfid.uid.uidByte[1] == 102 &&
rfid.uid.uidByte[2] == 14 &&
rfid.uid.uidByte[3] == 194 )
5.Programm ESP and in Arduino IDE open Serial Monitor to check how it works.
Attachments
Step 5: Finish Your Project
If everything works as expected solder all connections and put it close to doors (You can also hide it somewhere). Attach magnet to doors and put hall sensor close to it. When doors will be opened hall sensor will detect that and it will send signal to ESP32. ESP32 then connects over wireless to IFTTT and IFTTT sends You notification or SMS.
Things to improve:
1.Implement some kind of device heart beat so You can be notified if device is not working properly;
2.Make 3d printed case for this;
3.Attach alarm or audio notifications: ESP32 audio project
Useful links:
Installing the ESP32 Board in Arduino IDE (Windows instructions)