
Remote Door Alert System from 13 mile 21 km Away With LoRa – Off the Grid! (Heltec WiFi LoRa 32 V3)
Imagine monitoring the status of a front door, garden gate, or barn door from up to 13 miles (20 km) away without using Wi-Fi or SIM cards. In this tutorial, you'll learn how to build a secure wireless door alert system using Heltec WiFi LoRa 32 V3 modules. This system uses AES-encrypted LoRa communication to send alerts when a door is opened or closed, and works completely off-grid.
Project Overview
This project uses two LoRa32 boards:
Transmitter (TX): Detects door open/close state using a magnetic switch and sends encrypted alerts.
Receiver (RX): Decrypts the message, displays the status on OLED, and controls a digital pin for external triggers (e.g., buzzer, LED).
This is a reliable and low-power solution ideal for remote monitoring locations like farms, workshops, and outdoor gates.
Required Library
This project uses the Robojax_HeltecLoRa32 library. The library and all code files are included below this article.
Install the ZIP library using Arduino IDE before uploading the sketches.
Wiring Instructions
Transmitter Wiring:
Magnetic switch (or push button) connected to GPIO0
OLED display connected via default I2C pins (SDA/SCL)
Receiver Wiring:
GPIO4 goes HIGH when door is OPEN and LOW when CLOSED
Connect GPIO4 to an LED, buzzer, or external input for action
📷 Image Caption: Wiring diagram showing the transmitter detecting door state via magnetic switch on GPIO0 and receiver activating alert on GPIO4.
TX Code Breakdown
The transmitter sketch (Door_Alarm_TX.ino
) reads the state of GPIO0 to determine if the door is open or closed.
When the magnetic switch is open (door opened), it sends the string
"ON"
When the door is closed, it sends
"OFF"
The OLED display shows "OPEN" or "CLOSED" accordingly
Encryption is handled using:
robojaxDevice.setSecurityKey("hyhT676#h~_876s");
robojaxDevice.sendSecureMessage("ON");
RX Code Breakdown
The receiver sketch (Door_Alarm_RX.ino
) listens for secure messages and displays the result on an OLED display:
String message = robojaxDevice.receiveSecureMessage();
Then it triggers GPIO4:
if (message == "ON") {
digitalWrite(4, HIGH);
oledDisplay.println("Door is OPEN");
} else {
digitalWrite(4, LOW);
oledDisplay.println("Door is CLOSED");
}
This setup provides both visual and digital output for the door state.
📚 Chapter Index
[00:00] Introduction and Use Case
[00:06] Range Capabilities of LoRa
[00:10] Door Sensor Concept
[00:20] Wiring and Components Used
[00:40] Installing Robojax Library
[01:00] TX Code Explanation
[01:20] RX Code and Alert Trigger
[01:40] Real-Time Demonstration
This project is a great entry point into secure IoT with LoRa, ideal for anyone needing reliable door or gate monitoring over long distances. The required code and library are available below this article. Watch the full video to build and test your system!
Related Tutorials in This Series:
WiFi LoRa 32 Tutorials
Related Links
- Purchase a WiFi LoRa 32 from Amazon USA
- Purchase a WiFi LoRa 32 shell from Amazon USA
- Purchase a WiFi LoRa 32 from Amazon Canada
- Purchase a WiFi LoRa 32 from Amazon Europe
- Purchase Wi-Fi LoRa 32 from Meshnology
- Purchase WiFi LoRa 32 V3 with N32 Case and 3000mA Battery
- AO7801 Dual P-Channel Enhancement Mode Field Effect Transistor Datasheet This is the datasheet for AO7801 Dual P-Channel Enhancement Mode Field Effect Transistor
Downloads
- Download
-
Robojax Heltec LoRa 32 V3 Library 1.0 - 2025-05-20 0.09 MB This is library for Heltec WiFi LoRa 32 V3. It contains the example codes for projects. Please watch video for instructions on how to install it.Download
Comments will be displayed here.