This project implements a movement detection system using GPS and LoRa, built with LilyGO T-Beam modules. The transmitter tracks GPS coordinates and transmits data via LoRa whenever it detects movement exceeding 4 meters. The receiver then sends a notification to Telegram through WiFi using the Telegram Bot API.
- Real-time GPS tracking using TinyGPSPlus
- Long-range wireless communication via LoRa (SX1276 @ 923 MHz)
- Automatic movement detection when distance > 4 meters
- Telegram notifications with location and Google Maps link
- WiFi auto-reconnect for reliable message delivery
- Compatible with LilyGO T-Beam ESP32
| Component | Quantity | Description |
|---|---|---|
| LilyGO T-Beam ESP32 | 2 | One as transmitter, one as receiver |
| LoRa Antenna | 2 | For long-range communication |
| GPS Antenna | 1 | For accurate location detection |
| WiFi Network | 1 | Receiver uses WiFi to send messages to Telegram |
- Reads GPS coordinates.
- Calculates movement distance using the Haversine formula.
- Sends data via LoRa if the distance moved > 4 meters.
- Listens for LoRa packets from the transmitter.
- Parses incoming GPS coordinates.
- Connects to WiFi and sends location + alert message to Telegram.
-
Open Telegram and search for BotFather.
-
Create a new bot using
/newbot. -
Copy the Bot Token.
-
Get your Chat ID using @userinfobot.
-
Add your Bot Token and Chat ID to the receiver code:
const char* botToken = "YOUR_BOT_TOKEN"; const char* chatID = "YOUR_CHAT_ID";
-
Frequency: 923 MHz (for Malaysia/Southeast Asia)
-
Pins (for LilyGO T-Beam):
#define LORA_SS 18 #define LORA_RST 23 #define LORA_DIO0 26
-
Transmitter continuously reads GPS data.
-
Calculates distance between last position and current position.
-
If movement exceeds 4 meters, transmitter sends new coordinates via LoRa.
-
Receiver receives the data and sends:
- Latitude
- Longitude
- Google Maps link
- Optional alert message ("Movement Detected!") to Telegram.
📍 Latitude: 2.904685
📍 Longitude: 101.864059
🌐 Google Maps:
https://maps.google.com/?q=2.904685,101.864059
⚠️ Movement Detected! Device moved more than 4 meters.
The distance between two GPS points is calculated as: [ d = 2R \times \arcsin\left(\sqrt{\sin^2\left(\frac{Δφ}{2}\right) + \cos(φ1) \cdot \cos(φ2) \cdot \sin^2\left(\frac{Δλ}{2}\right)}\right) ] Where:
- ( R = 6371000 , m ) (Earth’s radius)
- ( φ1, φ2 ) = latitude in radians
- ( λ1, λ2 ) = longitude in radians
This project is open-source under the MIT License. Feel free to use, modify, and share with proper attribution.
Muhammad Aqil 📬 Contact: Telegram (optional) 💡 Project Goal: To create a compact, low-power, and reliable GPS-based movement detection system using LoRa and Telegram integration.