The ESP32 NodeMCU WROOM-32 development board is a powerful dual-core microcontroller with built-in WiFi and Bluetooth, now featuring a modern USB-C interface with CH340C USB-to-serial converter. It is ideal for IoT projects, Home Assistant integrations, smart sensors, automation systems and embedded development.
Compatible with Arduino IDE, ESP-IDF, MicroPython, ESPHome and PlatformIO.
ESP32 NodeMCU Magnetic Door Sensor ---------------------------------------- 3V3 ─────────► (not used) GND ─────────► GND GPIO13 ─────────► Signal Notes: • Configure GPIO13 as INPUT_PULLUP • Door CLOSED = LOW (connected to GND) • Door OPEN = HIGH • ESP32 uses 3.3 V logic only
This example demonstrates how the ESP32 can be used as a smart door or window monitor. When the door opens or closes, a message is instantly sent to Telegram over WiFi.
This is a popular real-world use case for home security, sheds, garages, server rooms and automation projects.
esphome:
name: esp32_door_monitor
platform: ESP32
board: esp32dev
wifi:
ssid: "YOUR_SSID"
password: "YOUR_PASSWORD"
logger:
api:
ota:
binary_sensor:
- platform: gpio
pin:
number: 13
mode: INPUT_PULLUP
inverted: true
name: "Door Sensor"
device_class: door
on_press:
- http_request.post:
url: "https://api.telegram.org/botYOUR_BOT_TOKEN/sendMessage"
headers:
Content-Type: application/json
json:
chat_id: "YOUR_CHAT_ID"
text: "Door CLOSED 🔒"
on_release:
- http_request.post:
url: "https://api.telegram.org/botYOUR_BOT_TOKEN/sendMessage"
headers:
Content-Type: application/json
json:
chat_id: "YOUR_CHAT_ID"
text: "Door OPEN 🔓"
http_request:
useragent: esphome/door-monitor
timeout: 10s
Note: Replace WiFi credentials, Telegram bot token and chat ID. ESPHome allows easy Home Assistant integration and OTA updates.
#include <WiFi.h>
#include <HTTPClient.h>
const char* WIFI_SSID = "YOUR_WIFI_SSID";
const char* WIFI_PASS = "YOUR_WIFI_PASSWORD";
const char* BOT_TOKEN = "YOUR_BOT_TOKEN"; // Telegram bot token
const char* CHAT_ID = "YOUR_CHAT_ID"; // Numeric chat ID or channel
const int DOOR_PIN = 13; // GPIO13
int lastState = HIGH;
void setup() {
Serial.begin(115200);
pinMode(DOOR_PIN, INPUT_PULLUP);
WiFi.begin(WIFI_SSID, WIFI_PASS);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
}
sendTelegram("ESP32 door monitor online");
}
void loop() {
int state = digitalRead(DOOR_PIN);
if (state != lastState) {
lastState = state;
if (state == LOW) {
sendTelegram("Door CLOSED 🔒");
} else {
sendTelegram("Door OPEN 🔓");
}
delay(500);
}
}
void sendTelegram(String message) {
if (WiFi.status() != WL_CONNECTED) return;
HTTPClient http;
String url = "https://api.telegram.org/bot" + String(BOT_TOKEN) + "/sendMessage?chat_id=" + CHAT_ID + "&text=" + message;
http.begin(url);
http.GET();
http.end();
}
Note: Arduino sketch provided as a simple reference implementation. No external libraries are required.
Order now — a versatile ESP32 development board ideal for smart monitoring, IoT automation and wireless notification projects.