How yv798an/tiny_rtgw_rv307 works
Tiny_RTGW_RV307 is an IoT gateway: edge firmware samples temperature, humidity, and light, displays readings locally, and exchanges data and LED commands over UART with an ESP32-C6 MQTT bridge; a Flask web service provides live monitoring, history, and remote control. The README documents the bridge and end-to-end protocol, but its firmware is absent from the supplied tree. The sampled firmware entry point and sensor service support the edge flow; unsampled subsystem wiring is included only where documented.
Main entry points: app.py Flask and SocketIO · sensor_service.c Sensor Service · uart2.c UART2 Service · main.c RT-Thread Main
Components 17
Edge Firmware
- RT-Thread Main
Internet_Edge/User/main.c - UART2 Service
Internet_Edge/equipment/usart/uart2.c - LED GPIO
Internet_Edge/drivers/drv_gpio.c
Sensing and State
- Sensor Service
Internet_Edge/equipment/sensor/sensor_service.c - Shared Sensor State
Internet_Edge/equipment/sensor/sensor_data.c - DHT20 Driver
Internet_Edge/equipment/DHT20/DHT20.c - ADC Sampling
Internet_Edge/equipment/ADC/bsp_adc.c - ADC Trigger
Internet_Edge/equipment/TIM/bsp_tim.c
Web Service
- Flask and SocketIO
iot_web/app.py - SQLite History
iot_web/app.py
Local Display
- GUI Initialization
Internet_Edge/GUI/GUI_init.c - LCD Dashboard
Internet_Edge/GUI/GUI_dashboard.c - ILI9341 Display
Internet_Edge/GUI/ili9341.c
Other components
- Browser User
- ESP32-C6 Bridge
- MQTT Broker
- Web Dashboard
Connections 22
- RT-Thread Main → Sensor Service: starts thread
- RT-Thread Main → UART2 Service: starts thread
- RT-Thread Main → GUI Initialization: initializes
- Sensor Service → DHT20 Driver: reads
- Sensor Service → ADC Sampling: samples
- Sensor Service → ADC Trigger: initializes
- Sensor Service → Shared Sensor State: updates state
- UART2 Service → Shared Sensor State: reads state
- UART2 Service → LED GPIO: controls
- GUI Initialization → LCD Dashboard: initializes
- LCD Dashboard → ILI9341 Display: renders
- UART2 Service → ESP32-C6 Bridge: UART frames
- ESP32-C6 Bridge → UART2 Service: UART commands
- ESP32-C6 Bridge → MQTT Broker: publishes data
- MQTT Broker → ESP32-C6 Bridge: delivers commands
- MQTT Broker → Flask and SocketIO: delivers telemetry
- Flask and SocketIO → MQTT Broker: publishes control
- Flask and SocketIO → SQLite History: writes readings
- Flask and SocketIO → SQLite History: queries history
- Flask and SocketIO → Web Dashboard: pushes live data
- Web Dashboard → Flask and SocketIO: requests history
- Web Dashboard → Flask and SocketIO: sends LED control