Free tools Windows power users keep installed
One-click scans. No signup required.
Build this project with an ESP32, a magnetic reed switch, and a buzzer: when an armed door opens, the ESP32 sounds a local alarm and sends a cloud-mediated notification through Blynk. A Blynk dashboard provides arm/disarm control and displays the door and alarm states.
The reed switch detects the door’s physical position; an optional PIR sensor detects motion and should not replace it. Because remote alerts depend on power, Wi-Fi, the ESP32, Blynk.Cloud, and phone notification settings, treat this as a DIY supplemental alarm—not a professionally monitored security system.
As an Amazon Associate I earn from qualifying purchases.
What the project does
The system separates five jobs that are often confused in beginner tutorials:
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →- Door-state detection: A magnetic reed switch detects whether the door is open or closed.
- Motion detection: An optional PIR sensor detects changes in infrared radiation caused by movement. It does not identify an intruder.
- Local alarm: The ESP32 drives a buzzer, warning LED, or suitably powered siren.
- Remote alert: Blynk logs an event that can generate a push notification, subject to Blynk configuration, plan limits, Wi-Fi, and phone settings.
- Remote control and status: A Blynk switch arms or disarms the alarm while dashboard widgets show the door and alarm state.
The signal path is:
Magnetic reed switch ─┐
├─> ESP32 ──Wi-Fi──> Blynk.Cloud ──> phone notification
PIR motion sensor ────┘ │
└─> buzzer / siren / warning LED
Blynk supports ESP32 hardware, mobile and web dashboards, device management, cloud connectivity, and notifications. See the Blynk documentation and its supported-board list for current platform details.
#1 Best Overall
- Powerful ESP32-S3 Microcontroller: The Arduino Nano ESP32 is powered by the ESP32-S3 chip, featuring a dual-core Xtensa 32-bit LX7 processor running at up to 240 MHz. This high-performance microcontroller offers excellent computational power for IoT, wireless communication, and advanced embedded applications like real-time data processing, voice recognition, and machine learning at the edge.
- Comprehensive Wireless Connectivity: The board supports both Wi-Fi and Bluetooth 5.0, enabling seamless communication with other devices, networks, and cloud platforms. Whether you're building a smart home system, wearable tech, or remote sensors, the Nano ESP32 offers reliable and high-speed connectivity for wireless data transfer and control.
- USB-C for Power and Programming: With the modern USB-C port, the Nano ESP32 ensures faster programming, better power delivery, and a more stable connection compared to traditional micro-USB boards. This makes it easier to work with, especially in development and prototyping stages.
- HID Support for Advanced Applications: The board supports Human Interface Device (HID) profiles, making it ideal for projects that require integration with keyboards, mice, or other HID peripherals. This feature allows you to create custom input devices, virtual controllers, or even USB-based projects that interact directly with computers and other devices.
- MicroPython Compatible: The Arduino Nano ESP32 is compatible with MicroPython, a streamlined version of Python designed for embedded systems. This makes the board perfect for rapid prototyping, educational projects, and developers who prefer Python over C/C++ for ease of use and faster development cycles.
Parts and design choices
Minimum prototype
- ESP32 development board with Wi-Fi
- Magnetic reed switch or wired magnetic door contact
- 3.3-V active buzzer or small buzzer module
- LED and suitable series resistor
- Breadboard and jumper wires
- Certified USB power supply
- Enclosure and mounting adhesive
More robust installation
- PIR motion sensor for secondary confirmation
- MOSFET or transistor driver for a louder siren
- Separate supply for a 5-V or 12-V alarm
- Battery backup or UPS-style 5-V supply
- Tamper switch for the enclosure
- Better Wi-Fi positioning or an external antenna where supported
Choose a documented ESP32 board with a clear pinout. GPIO availability and boot-strapping behavior vary between ESP32 variants, so the pin numbers below are examples rather than universal requirements. An Espressif ESP32-DevKitC is one documented starting point.
Reed switch or PIR sensor?
| Sensor | Detects | Strength | Limitation |
|---|---|---|---|
| Reed switch | Physical door opening | Simple, inexpensive, and normally resistant to false alarms | Cannot detect someone near a closed door |
| PIR | Movement and heat changes | Can confirm motion inside an area | May react to pets, sunlight, heat sources, or airflow |
| Vibration sensor | Impact or shaking | Can supplement forced-entry detection | Needs filtering and calibration |
| ESP32-CAM | Images or video | Can provide visual verification | Consumes more power and raises privacy and storage issues |
For a door-open alarm, use the reed switch as the primary trigger. Add a PIR only if its additional information is worth the extra wiring and false-alarm testing.
Wiring the ESP32 alarm
Reed switch using the internal pull-up
Connect the switch between an example GPIO and ground:
ESP32 GPIO27 ───── reed switch ───── GND
Configure it with:
pinMode(DOOR_PIN, INPUT_PULLUP);
This is active-low hardware:
- Switch closed, magnet aligned, door closed: GPIO reads
LOW. - Switch open, magnet separated, door open: GPIO reads
HIGH.
Test the actual contact before permanently mounting it. Some alarm contacts are normally closed and others are normally open, and the mechanical gap between the magnet and switch affects reliability. Mount the two parts firmly on the frame and door so they separate only when the door moves.
Buzzer and LED
ESP32 GPIO26 ───── small buzzer input
ESP32 GND ────── buzzer GND
ESP32 GPIO25 ───── resistor ───── LED anode
LED cathode ───────────────────── GND
Use GPIO26 only for a small, low-current buzzer or a driver input. Never connect a high-current siren directly to an ESP32 GPIO. For a larger alarm, use a correctly rated transistor or MOSFET, a separate supply, a common ground where appropriate, and a flyback diode for inductive loads. A relay module is suitable only when its ratings, isolation, and wiring are appropriate.
Optional PIR
Connect the PIR module’s ground to ESP32 ground, its supply according to the module’s specification, and its digital output to an available GPIO. Confirm that the output voltage is safe for the selected ESP32 board. PIR modules commonly need a settling period after power-up, so do not interpret their first readings as confirmed intrusion.
Rank #2
- 2.4GHz Dual Mode WiFi + Bluetooth Development Board
- Support LWIP protocol, Freertos
- SupportThree Modes: AP, STA, and AP+STA
- Ultra-Low power consumption, Compatible with Arduino IDE
- ESP32 is a safe, reliable, and scalable to a variety of applications
Set up Blynk IoT
1. Create an account and template
Create an account in Blynk.Console or the Blynk mobile app. Enable Developer Mode if the interface requests it, then create a template with:
Template name: ESP32 Door Security Alarm
Hardware: ESP32
Connectivity: WiFi
Blynk’s current ESP32 workflow uses a template, a device created from that template, and device credentials. Copy the template ID, template name, and device authentication token into the firmware without exposing them publicly.
2. Create datastreams
In the template, create virtual-pin datastreams. A virtual pin such as V0 is a software channel in Blynk, not physical GPIO0 on the ESP32.
| Datastream | Type | Purpose |
|---|---|---|
V0 |
Integer, 0–1 | Arm/disarm control |
V1 |
Integer, 0–1 | Door state |
V2 |
Integer, 0–1 | Alarm state |
V3 |
String | Human-readable status |
V4 |
Integer, 0–1 | Optional PIR state |
Blynk describes datastreams as channels between the device and Blynk.Cloud. Its documentation covers datastream setup and the use of virtual pins.
3. Configure the event
Create an event in the template with this identifier:
door_open
Enable push notifications for the event. Creating the event in firmware is not enough: the matching event must exist in the Blynk template, and its notification delivery must be enabled. Blynk’s notification documentation explains device-triggered Events and cloud Automations.
Rank #3
- 2.4GHz Dual Mode WiFi + Bluetooth Development Board
- Support LWIP protocol, Freertos;ESP32 is a safe, reliable, and scalable to a variety of applications
- SupportThree Modes: AP, STA, and AP+STA
- Ultra-Low power consumption, Compatible with Arduino IDE
- 1PCS 30Pin ESP32 Development Board 2.4GHz WiFi Dual Cores Microcontroller Integrated with Antenna RF Low Noise Amplifiers Filters
4. Add dashboard widgets
- Switch connected to
V0for arm/disarm. - LED or value widget connected to
V1for door open/closed. - LED connected to
V2for alarm active. - Label connected to
V3for text status. - Optional LED connected to
V4for motion.
Blynk also provides an Alarm & Sound widget. It is a dashboard feature separate from the device-triggered event used in the example below; configure it in Blynk.Console and disable it by writing zero to its datastream when appropriate. See the widget documentation.
Install the software
- Install Arduino IDE and the ESP32 board package.
- Install the current Blynk library through Library Manager.
- Select the exact ESP32 board variant and its serial port.
- Use the ESP32-specific include files shown below.
Blynk’s current examples use Blynk.begin() to authenticate and connect the device to Wi-Fi and Blynk.Cloud.
Reference firmware
Replace the template values, token, Wi-Fi credentials, and GPIO assignments before compiling.
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →#define BLYNK_TEMPLATE_ID "TMPLxxxxxx"
#define BLYNK_TEMPLATE_NAME "ESP32 Door Security Alarm"
#define BLYNK_AUTH_TOKEN "YourBlynkAuthToken"
#define BLYNK_PRINT Serial
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
char ssid[] = "YourWiFiName";
char pass[] = "YourWiFiPassword";
const int DOOR_PIN = 27; // Reed switch to GND
const int BUZZER_PIN = 26; // Active buzzer or driver input
const int LED_PIN = 25; // Optional warning LED
BlynkTimer timer;
bool armed = false;
bool doorOpen = false;
bool alarmActive = false;
bool lastDoorOpen = false;
unsigned long alarmStartedAt = 0;
const unsigned long ALARM_DURATION = 30000UL;
BLYNK_WRITE(V0)
{
armed = param.asInt();
if (!armed) {
alarmActive = false;
digitalWrite(BUZZER_PIN, LOW);
digitalWrite(LED_PIN, LOW);
Blynk.virtualWrite(V2, 0);
Blynk.virtualWrite(V3, "Disarmed");
} else {
Blynk.virtualWrite(V3, doorOpen ? "Armed - Door open"
: "Armed - Door closed");
}
}
void readDoor()
{
// With INPUT_PULLUP: LOW means closed switch, HIGH means open door.
doorOpen = digitalRead(DOOR_PIN) == HIGH;
Blynk.virtualWrite(V1, doorOpen ? 1 : 0);
if (doorOpen != lastDoorOpen) {
lastDoorOpen = doorOpen;
if (doorOpen) {
Blynk.virtualWrite(V3, armed ? "Armed - Door opened"
: "Disarmed - Door opened");
if (armed) {
alarmActive = true;
alarmStartedAt = millis();
digitalWrite(BUZZER_PIN, HIGH);
digitalWrite(LED_PIN, HIGH);
Blynk.virtualWrite(V2, 1);
Blynk.logEvent("door_open", "The monitored door was opened.");
}
} else {
Blynk.virtualWrite(V3, armed ? "Armed - Door closed"
: "Disarmed - Door closed");
}
}
if (alarmActive && millis() - alarmStartedAt >= ALARM_DURATION) {
alarmActive = false;
digitalWrite(BUZZER_PIN, LOW);
digitalWrite(LED_PIN, LOW);
Blynk.virtualWrite(V2, 0);
}
}
void setup()
{
Serial.begin(115200);
pinMode(DOOR_PIN, INPUT_PULLUP);
pinMode(BUZZER_PIN, OUTPUT);
pinMode(LED_PIN, OUTPUT);
digitalWrite(BUZZER_PIN, LOW);
digitalWrite(LED_PIN, LOW);
Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass);
timer.setInterval(100L, readDoor);
}
void loop()
{
Blynk.run();
timer.run();
}
How the firmware behaves
V0controls the armed state.- The reed switch is sampled every 100 milliseconds.
- The code reacts to a state transition instead of logging an event repeatedly while the door remains open.
- An armed opening turns on the buzzer and LED, reports the state through
V1andV2, and logs thedoor_openevent. - The local alarm stops after 30 seconds.
- Disarming from Blynk stops the local alarm immediately after the command reaches the device.
The timer avoids putting repeated cloud writes inside a tight loop(). Blynk recommends controlled data transmission because excessive messaging can overload or disconnect the cloud connection.
Important improvements for a reliable build
Debounce the reed switch
Mechanical contacts can chatter for several milliseconds. The 100-millisecond polling interval helps, but a more robust version should require the new reading to remain stable for approximately 50–200 milliseconds before accepting it. Trigger the notification only after the state is confirmed.
Limit notification frequency
One event per confirmed closed-to-open transition is safer than logging continuously. If repeated openings are possible, add a cooldown—such as a minimum interval between notifications—and define whether a second alert is allowed after a set number of minutes.
Rank #4
- Powerful ESP-32 Board: Unlock the world of Internet of Things (IoT) and advanced electronics with the heart of this kit: the ESP-32 board. It features a powerful dual-core processor, integrated Wi-Fi and Bluetooth 4.2, making it perfect for building connected, smart devices that communicate with your phone or the cloud. It's fully compatible with the Arduino IDE for easy programming.
- Super Starter Kit: This kit contains over 35 different modules and electronic components, including sensors, displays, motors, and input devices. From LEDs and buttons to an OLED screen, servo motor, and keypad, you have everything needed to explore a vast range of projects in one box.
- Step by Step Online Tutorial: Jump right in with our detailed, beginner-friendly tutorial. Access 30+ projects with complete code, clear circuit diagrams, and step-by-step instructions. Learn the fundamentals of electronics, coding, and how to utilize the ESP-32's unique capabilities without any prior experience.
- Hands-on Learning for All Skill Levels: Perfect for students, makers, engineers, and hobbyists. Start with basic circuits and coding, then progress to intermediate and advanced IoT applications. Build practical projects like weather stations, smart home controllers, remote-controlled devices, and interactive gadgets. The skills you learn are the foundation for real-world innovation.
- Quality & Great Support: Elegoo is committed to quality. We provide a clear, detailed tutorial guide, refined code, and a well-organized component kit. All modules are carefully selected for reliability and ease of use. Our dedicated technical support team and active online community are ready to help you succeed in your learning journey.
Keep the alarm local-first
The reed switch and buzzer should continue operating when Wi-Fi, Blynk.Cloud, or the phone is unavailable. The cloud path is an additional notification channel, not the only safety mechanism. Test this deliberately by switching off the router and closing the Blynk app.
Define startup behavior
The example starts disarmed after power is restored. That is safer during commissioning, but it is not the only valid policy. A finished design could restore the previous state from nonvolatile storage or require a deliberate arm action. Decide what should happen if power returns while the door is open, and publish the initial door state without treating every reset as a new intrusion unless that is intentional.
Show connectivity status
Add a dashboard indicator or local LED for connection state. A useful operational distinction is:
Local buzzer: may still work
Remote notification: unavailable until connectivity returns
Blynk documents TLS-protected communication and device-specific authentication, but encrypted communication does not make the physical installation tamper-proof. See Blynk’s security documentation.
Testing checklist
- Open Serial Monitor at 115200 baud.
- Read the reed switch locally and verify that closed and open states are correct.
- Confirm the buzzer and LED outputs without connecting a large siren.
- Confirm that the device appears online in Blynk.Console.
- Verify that
V1changes when the door moves. - Arm the system through the
V0switch. - Open the door and confirm the local alarm.
- Confirm that
V2changes and thedoor_openevent is logged. - Close the door, disarm the system, and repeat the test.
- Test Wi-Fi loss, phone disconnection, and power restoration separately.
Troubleshooting
No Blynk notification
- Confirm that the ESP32 has Wi-Fi access and is online in Blynk.Console.
- Check that
door_openexactly matches the event identifier in the template. - Verify that notification delivery is enabled for the event.
- Check phone notification permissions.
- Confirm that the device is armed and that the door changed from closed to open after arming.
- Check for notification limits or rate limiting.
Wi-Fi works but Blynk does not connect
Check the Template ID, Auth Token, library, board-specific include, and copied credentials. Remove accidental spaces from the token. Also check whether the network filters outbound connections. Avoid old tutorials that use the retired classic Blynk workflow, legacy token screens, or obsolete widget names.
Recommended Free Tools
The door state is inverted
With the pull-up wiring, the expected expression is:
Best Value
- 2.4GHz Dual Mode WiFi + Bluetooth Development Board
- Ultra-Low power consumption, works perfectly with the Arduino IDE
- Support LWIP protocol, Freertos
- SupportThree Modes: AP, STA, and AP+STA
- ESP32 is a safe, reliable, and scalable to a variety of applications
bool doorOpen = digitalRead(DOOR_PIN) == HIGH;
If the contact is wired or constructed differently, reverse the logic after checking the real electrical state.
The alarm triggers repeatedly
Look for switch bounce, a loose magnet, door vibration, long unshielded wires, or code that triggers from the current level instead of a transition. Debounce the input and call Blynk.logEvent() only once per confirmed opening.
The buzzer is quiet or resets the ESP32
The load may draw too much current or cause a supply-voltage drop. Do not power a large buzzer or siren from a GPIO. Use a driver, separate supply, common ground where appropriate, and a flyback diode for inductive loads.
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallCrashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteSecurity, privacy, and practical limits
A reed switch reports door position; it does not prove that the door is locked, prevent forced entry, or detect every attack. A push notification is near-real-time at best: delivery depends on Wi-Fi, Blynk.Cloud, event configuration, cloud limits, and the phone.
- Keep the ESP32 in a protected enclosure and consider a tamper switch.
- Do not publish Wi-Fi credentials, template identifiers, or Auth Tokens in a repository or screenshot. Rotate exposed credentials.
- Use a local timeout or physical shutoff for a loud siren so a fault cannot create prolonged nuisance noise.
- Do not connect high-current or mains-powered loads without suitable isolation and electrical protection.
- A cloud alert is not professional monitoring or emergency dispatch.
- A camera extension requires appropriate notice, consent, access control, and careful handling of captured images.
When Blynk is the right platform
Blynk is a fast route to a mobile and web dashboard without building a backend, broker, and notification service yourself. Its trade-off is cloud dependence and possible plan limits. Blynk’s pricing page currently lists a Free plan at $0 with up to five devices, one user, one week of data retention, and 100,000 messages; plans and included features can change, so verify them before deployment. SMS availability should not be assumed on the Free plan.
| Platform | Best fit | Trade-off |
|---|---|---|
| Blynk IoT | Quick dashboard and cloud notifications | Cloud dependency and plan limits |
| Home Assistant | Local automation and broad home integration | Needs more setup and usually a continuously running host |
| ESPHome | Local Home Assistant devices | Less suitable as a standalone mobile-app product |
| MQTT | Vendor-neutral, extensible systems | Requires a broker and dashboard or automation layer |
| Telegram or email API | Simple notifications | Does not replace a device dashboard and management model |
Use a local alternative when the alarm must continue without an internet account, or when a single sensor does not justify cloud dependence. Wi-Fi is appropriate for a mains-powered indoor prototype but is a poor fit for remote sites, frequent outages, weak router coverage, or months-long battery operation. Cellular or LoRaWAN can address those cases, but they become different projects with additional hardware and deployment requirements.
Quick Recap
Useful upgrade paths
- PIR confirmation: Require door opening and motion before sending a second alert, while retaining the reed switch as the door trigger.
- Tamper detection: Add a normally closed enclosure switch and report its state separately.
- Battery backup: Use a protected, properly charged battery system or certified USB UPS rather than an unprotected lithium cell.
- Camera verification: Add an ESP32-CAM only after considering bandwidth, privacy, storage, and access control.
- Local integration: Connect to Home Assistant or MQTT when local automation and ownership of the data matter more than the quickest dashboard.
- Stronger alarm: Drive a properly supplied 12-V siren through a correctly rated MOSFET or relay circuit.
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.




