gs-node-esp is the firmware for a LoRa-based mesh networking node designed for low-power, long-range telemetry and communication. It runs on the ESP32-C6 SoC and integrates a bunch of environmental sensors, power management ICs, and a GPS module, and a custom mesh protocol.
The system is built around a shared I2C bus architecture managed by a multiplexer to support address-conflicting sensors and power domains.
-
MCU: ESP32-C6
-
Radio: SX1262 (LoRa)
-
Power Management: BQ25798
-
IO Expansion: MCP23017 (16-bit GPIO Expander)
-
Timekeeping: DS3231 (RTC)
-
Sensors:
- BME280: Temperature, Humidity, Pressure
- VEML7700: Ambient Light Sensor
- ADS1115: ADC for analog sensors
- Capacitive Soil moisture
- DS18B20: Soil temperature
-
GPS: UART-based GPS module (power controlled via MCP23017)
-
Bus Management: TCA9548A I2C Multiplexer
The project follows the ESP-IDF component-based structure.
main/: Entry point and application-level logic.main.c: System boot, logging, and task spawning.app/: High-level application modules (Peripheral init, Battery Monitor, Interrupt Dispatcher).app_self_test: Self-test hardware and build a sample packet stream.test_mode: Tests LoRa communication.
components/: Reusable drivers and system modules.- Drivers:
sx126x_driver,bq25798,ds3231,mcp23017,bme280,veml7700,ads1115,gps_uart. - System:
i2c_handler(Bus locking),app_devices(Shared handles),app_nvs,app_littlefs. - Mesh/Logic:
packets(Protocol definitions),node_sync_store,node_distance_map.
- Drivers:
- Mesh Networking: Custom LoRa mesh protocol (
docs/mesh_packet_protocol.md) supporting fragmentation, reliability, and flooding. Not currently implemented - Power Management: Active monitoring of battery state and charger telemetry via
battery_monitor_task. - Interrupt Handling: Centralized
interrupt_dispatcherto handle GPIO events from the radio, charger, and IO expander efficiently. - Persistent Storage:
- LittleFS: Stores node synchronization data and logs.
- NVS: Stores configuration flags (e.g.,
INSTALLEDstatus).
- GPS Integration: Daily GPS sync task for location and time correction.
- Peripheral Drivers: Full support for all hardware components (Sensors, RTC, Charger, Radio).
- I2C Management: Robust bus locking and multiplexer handling (
i2c_handler,tca9548a). - Protocol: Packet encoding/decoding, frame layout, and basic types defined.
- Interrupts Shared ISR handling for MCP23017 and direct GPIOs.
- Storage: LittleFS and NVS wrappers are functional.
- Self-Test: Basic smoke tests for sensors and radio.
- Full Mesh Routing: The routing logic (A* using distance and SNR as H-costs) and dynamic pathfinding
- Install Flow: The "Mesh INSTALL" sequence (GPS sync -> Broadcast -> ACK -> Persist); first-time setup.
- Production Payload: Finalizing the sensor data payload structure for the mesh.
- Switch to LR-FHSS: Write a parser for the LR-FHSS packets.