Remote Door Alert System from 13 mile 21 km Away With LoRa – Off the Grid! (Heltec WiFi LoRa 32 V3)

Video thumbnail for Remote Door alert using Heltec WiFi LoRa 32 V3 and Meshnology N32

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

  1. [00:00] Introduction and Use Case

  2. [00:06] Range Capabilities of LoRa

  3. [00:10] Door Sensor Concept

  4. [00:20] Wiring and Components Used

  5. [00:40] Installing Robojax Library

  6. [01:00] TX Code Explanation

  7. [01:20] RX Code and Alert Trigger

  8. [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!



Downloads

Comments will be displayed here.