Zing Forum

Reading

ESP32 Vehicle IoT Gateway: End-to-End Real-Time Telemetry Solution from LoRa to Cloud

A complete vehicle monitoring solution based on NodeMCU ESP32, integrating LoRa wireless communication, JSON data parsing, Firestore cloud storage, and offline queue mechanism, suitable for logistics fleet management and asset tracking scenarios

ESP32IoTLoRaFirebaseFirestorevehicle monitoringtelemetrygatewayembedded systems
Published 2026-06-13 10:39Recent activity 2026-06-13 10:53Estimated read 8 min
ESP32 Vehicle IoT Gateway: End-to-End Real-Time Telemetry Solution from LoRa to Cloud
1

Section 01

ESP32 Vehicle IoT Gateway: Introduction to End-to-End Real-Time Telemetry Solution from LoRa to Cloud

This project is a complete vehicle monitoring solution based on NodeMCU ESP32, integrating LoRa wireless communication, JSON data parsing, Firestore cloud storage, and offline queue mechanism, suitable for logistics fleet management and asset tracking scenarios. The project is maintained by TruongNguyenHoangAnh, with source code hosted on GitHub (link: https://github.com/TruongNguyenHoangAnh/IoT-Transportation-Monitoring-Vehicle-Command), released on 2026-06-13. The core goal is to address the pain points of real-time vehicle status monitoring in the modern logistics industry, providing a low-cost, high-reliability edge-to-cloud telemetry system.

2

Section 02

Project Background: IoT Requirements for Fleet Management

The modern logistics and transportation industry faces core challenges: how to grasp the status of scattered vehicles in real time. Traditional cellular network solutions have problems such as coverage blind spots, high power consumption, and high costs. This project provides an edge-to-cloud vehicle monitoring architecture, using LoRa long-distance low-power technology to collect data, which is aggregated and uploaded to Firebase Firestore via the ESP32 gateway, realizing low-cost and high-reliability fleet telemetry.

3

Section 03

System Architecture and Hardware Configuration

System Architecture: Three-layer design: Vehicle sensor node (LoRa TX) → LoRa RX gateway (ASR6601) → ESP32 WiFi gateway → Firestore cloud database. Layered advantages: LoRa layer solves long-distance low-power transmission; gateway layer is responsible for protocol conversion, data parsing, and cloud synchronization; cloud layer provides real-time database capabilities.

Core Hardware: Main control board NodeMCU-32S, LoRa module ASR6601, communication interface UART (baud rate 115200).

Pin Connections: ESP32 GPIO3 (RX) ← ASR6601 TX; GPIO1 (TX) → ASR6601 RX; GND interconnected; GPIO2 → LED indicator; GPIO0 → reset button.

4

Section 04

Detailed Software Implementation

Dependency Libraries: Built based on PlatformIO, using ArduinoJson (^6.19.4) and Firebase ESP32 Client (^4.4.5).

Core Modules: 1. Serial data reading: Listen to LoRa gateway data, extract node ID, seq, rssi, snr, and JSON payload; 2. JSON parsing: Process sensor data including vehicle ID, temperature and humidity, GPS, acceleration, etc.; 3. Firestore data model: Telemetry data is stored by vehicle ID and timestamp (vehicles/{node_id}/telemetry/{timestamp}), and statistical information records the latest status, number of data packets, etc. (statistics/{node_id}).

5

Section 05

Key Design Highlights

Offline Queue Mechanism: When WiFi is disconnected, data is temporarily stored locally, attempts to synchronize every 30 seconds, and automatically batch uploads after connection is restored to ensure data integrity.

Real-Time Statistical Tracking: Record the total number of data packets, latest signal strength, signal-to-noise ratio, and online status of each vehicle for monitoring communication health.

Heartbeat Indicator: LED status: always on (initialization), blinking (normal operation), fast blinking (uploading), off (fault/sleep).

6

Section 06

Configuration and Deployment Guide

Sensitive Information Isolation: General configuration is stored in config.h (WiFi SSID/PASS, etc.), Firebase credentials are stored in firestore_secrets.h (project ID, API Key, etc.), and the latter is added to .gitignore to prevent leakage.

Firebase Setup: Create a project → enable Firestore → select region → get project ID and API Key → create an authentication account.

Build and Upload: Use PlatformIO commands: platformio run (build), platformio run --target upload (upload), platformio device monitor (monitor serial port).

7

Section 07

Application Scenarios and Expansion Directions

Typical Scenarios: Logistics fleet management (location, temperature, vibration monitoring), shared mobility (vehicle status, battery, fault alarm), construction machinery (operation time, maintenance warning), agricultural machinery (location, operation area, fuel consumption).

Expansion Features: TinyML edge inference (anomaly detection), two-way communication (cloud command sending), geofencing (area alarm), predictive maintenance (fault prediction).

8

Section 08

Technical Summary and Value

This project implements end-to-end vehicle monitoring from edge sensors to cloud databases. The design highlights include layered architecture (LoRa+WiFi), offline fault tolerance (intelligent queue), real-time synchronization (Firestore), and security practices (credential isolation). For developers, this is a directly deployable reference implementation with clear code and complete documentation, facilitating secondary development and customization, suitable for quickly building fleet monitoring systems.