WeatherStation2Meshtastic
August 18, 2026 · View on GitHub
Gateway modulare che riceve sensori meteo wireless a 868 MHz (GFSK) e li ritrasmette sulla rete Meshtastic (LoRa), con display OLED, sincronizzazione oraria dalla rete e bollettini meteo/astronomici automatici. Hardware supportato: Heltec WiFi LoRa 32 V3 / V4 (ESP32‑S3 + Semtech SX1262, con display OLED) e Seeed XIAO nRF52840 + Wio‑SX1262 Kit (nRF52840 + SX1262, senza display: nessuna schermata/grafico/menu di invio manuale, feedback della sincronizzazione oraria sul LED RGB onboard).
Modular gateway that receives 868 MHz wireless weather sensors (GFSK) and bridges them onto the Meshtastic LoRa network, with network time‑sync and automatic weather/astronomy bulletins. Supported hardware: Heltec WiFi LoRa 32 V3 / V4 (ESP32‑S3 + Semtech SX1262, with OLED display) and Seeed XIAO nRF52840 + Wio‑SX1262 Kit (nRF52840 + SX1262, no display: no screens/graphs/manual‑send menu, time‑sync feedback on the onboard RGB LED instead).
Versione attuale: v1.2.2
Novità in questa release:
- Fix: l'avviso fulmini viene ora inviato su entrambi i canali (principale
- testo), non più solo sul canale testo (METEOLAZIO).
Current version: v1.2.2
What's new in this release:
- Fix: the lightning alert is now sent on both channels (primary + text), no longer only on the text channel (METEOLAZIO).
🇮🇹 Italiano
Funzionalità
- Multi‑sensore selezionabile: scegli quali sensori decodificare; il firmware compila solo i parser e le schermate necessari (build modulare).
- 20 sensori supportati su due gruppi radio (vedi tabella sotto).
- Gateway Meshtastic hand‑made: AES‑128/256‑CTR, protobuf, due canali (telemetria + testo), NodeInfo, posizione fissa sulla mappa.
- Telemetria nativa:
EnvironmentMetrics+AirQualityMetrics(temperatura, umidità, pressione, vento, pioggia 1h/24h, luce, suolo, PM2.5/PM10, CO₂). - Sincronizzazione oraria senza RTC né GPS: estrae l'ora dal traffico Meshtastic all'avvio, con algoritmo a conferme multiple (immune al "poison first sample") e finestra valida derivata dalla data di build.
- Bollettini automatici: 3 bollettini astronomici al giorno (alba+1h, mezzogiorno, tramonto−1h) sul canale principale + bollettino a intervallo fisso sul canale testo, con emoji e data e orario locale di invio (📅 🕒). Il testo non supera mai il limite Meshtastic di 200 byte: a corto di spazio si scartano per intero (mai a metà) prima i campi meno essenziali — astro, data/ora, link — mantenendo sempre i dati sensore.
- Avvisi fulmini su entrambi i canali (principale + testo) con soglia configurabile.
- Invio manuale dei bollettini: pressione prolungata del tasto PRG → menu a finestra per scegliere il canale (Ch0/Ch1) → conferma invio; ogni sottomenu ha la voce "Indietro" e si chiude da solo dopo 10 s di inattività.
- Effemeridi offline: alba/tramonto, fase lunare (crescente/calante).
- Display OLED con schermate a rotazione guidate dalle capability: panoramica, temp/umidità, pressione, pioggia, vento, UV/luce, fulmini, qualità aria, suolo, perdita acqua, grafici 24h (temperatura, umidità, pioggia, fulmini), orario+data, astro, stato Meshtastic (short name + countdown al prossimo invio + batteria %/alimentazione USB). Ogni schermata mostra modello e ID del sensore ricevuto (utile a distinguere la propria stazione da quella di un vicino).
- Splash screen all'avvio (5 s) con logo, nome del progetto e versione firmware.
- Configuratore web build‑time (
tools/configurator/index.html) per generare l'interosettings.ini.
Vincolo fondamentale: un SX1262 = un bitrate
I sensori 868 si dividono in due gruppi per bitrate, entrambi con sync word 0x2DD4.
Un solo SX1262 tiene una sola configurazione alla volta: i due gruppi non
sono ricevibili insieme. La scelta del gruppo è una scelta di build (un
environment per gruppo); lo script di pre‑build rifiuta una selezione mista.
| Gruppo | Bitrate | Sensori |
|---|---|---|
| A | ~17.241 kbps | Fine Offset / Ecowitt + LaCrosse IT+/TFA |
| B | ~8.06 kbps | Bresser |
Sensori supportati
Gruppo A (groupA_*)
| id | Modello | Misure |
|---|---|---|
WH32 | Fine Offset WH32 / WH25 / WH32B | temp / umidità / pressione |
WH31E | Ambient WH31E / WH31B | temp / umidità |
WH40 | Ecowitt WH40 | pioggia |
WH57 | Ecowitt WH57 / WH31L | fulmini |
WH51 | Ecowitt WH51 / WN31 / SM23 | umidità suolo |
WH45 | Ecowitt WH45 | PM2.5 / PM10 / CO₂ / temp / umidità |
WH46 | Ecowitt WH46 | PM1/2.5/4/10 / CO₂ / temp / umidità |
WN34 | Fine Offset WN34S/L/D | sonda temperatura (suolo/acqua) |
WS68 | Ecowitt WS68 | vento / luce / UV |
WS80 | Fine Offset WS80 | temp / umidità / vento / UV / luce |
WS85 | Fine Offset WS85 | vento / pioggia |
WS90 | Fine Offset WS90 (Wittboy) | come WS80 + pioggia |
WH65B | Fine Offset WH24 / WH65B / WS69 | stazione all‑in‑one (temp / umid / vento / pioggia / UV) |
TX35 | LaCrosse TX35 / TX29 / TFA 30.3155/30.3159 | temp / umidità |
Gruppo B (groupB_*)
| id | Modello | Misure |
|---|---|---|
BRESSER_5IN1 | Bresser 5‑in‑1 | temp / umidità / vento / pioggia |
BRESSER_6IN1 | Bresser 6‑in‑1 (+ new 5‑in‑1 / 3‑in‑1 wind / soil) | temp / umidità / vento / pioggia / UV / suolo |
BRESSER_7IN1 | Bresser 7‑in‑1 meteo | temp / umidità / vento / pioggia / UV |
BRESSER_7IN1_AQ | Bresser 7‑in‑1 Air Quality | PM2.5 / PM10 / CO₂ |
BRESSER_LIGHTNING | Bresser Lightning | fulmini |
BRESSER_LEAKAGE | Bresser Leakage | perdita acqua |
Configurazione (settings.ini)
Scelta dei sensori (devono appartenere allo stesso gruppo):
[sensors]
enabled = WH32, WH40, WH57
La sezione [meshtastic] configura frequenza, preset, intervalli, nomi/chiavi
dei canali, posizione, fuso orario e soglie fulmini. Puoi generare l'intero
file con tools/configurator/index.html (pagina statica che gira sul PC e
valida il vincolo di gruppo dal vivo).
A ogni build due script di pre‑build aggiornano la configurazione:
apply_settings.py (rete → include/user_config.h) e configure_sensors.py
(sensori → src/config/generated_config.h + build_src_filter).
Compilazione
pio run -e groupA_heltec_v3 -t upload # Gruppo A, Heltec V3
pio run -e groupA_heltec_v4 -t upload # Gruppo A, Heltec V4
pio run -e groupA_xiao_wiosx1262 -t upload # Gruppo A, XIAO nRF52840 + Wio-SX1262
pio run -e groupB_heltec_v3 -t upload # Gruppo B, Heltec V3
pio run -e groupB_heltec_v4 -t upload # Gruppo B, Heltec V4
pio run -e groupB_xiao_wiosx1262 -t upload # Gruppo B, XIAO nRF52840 + Wio-SX1262
How‑to: flashare la scheda Heltec
Prerequisiti
- PlatformIO (estensione VS Code o
pip install platformio). - Cavo USB‑C dati (non solo carica) e una Heltec WiFi LoRa 32 V3 o V4.
- Driver USB‑seriale: le Heltec recenti usano il CP2102/CH9102; su Windows installa il driver del produttore se la porta COM non compare.
Passi
- Collega la scheda via USB‑C.
- Modifica
settings.ini(sensori + parametri Meshtastic), oppure generalo con il configuratore web. - Compila e carica con l'environment giusto per gruppo e scheda:
PlatformIO rileva da solo la porta; per forzarla aggiungipio run -e groupA_heltec_v4 -t upload--upload-port COM5(Windows) o--upload-port /dev/ttyUSB0(Linux/macOS). - Apri il monitor seriale per verificare:
pio device monitor -b 115200 - Modalità boot (solo se l'upload fallisce): tieni premuto il tasto BOOT (PRG), premi e rilascia RST, poi rilascia BOOT; rilancia l'upload. La V3/V4 di solito entra in download mode da sola, quindi serve di rado.
All'avvio la scheda mostra la splash screen (5 s) e apre una finestra di ~5 minuti per sincronizzare l'orario dalla rete Meshtastic; premi PRG per scorrere le schermate. A sincronizzazione conclusa, una pressione prolungata di PRG apre il menu di invio manuale (breve = scorri voce, lunga = seleziona).
How‑to: flashare la scheda XIAO nRF52840 + Wio‑SX1262
Prerequisiti
- PlatformIO.
- Kit Seeed XIAO nRF52840 + Wio‑SX1262 (SKU 102010710/113010003, modulo radio a pin‑header, non il connettore B2B della variante ESP32‑S3).
- Cavo USB‑C dati.
Passi
- Collega la scheda via USB‑C.
- Modifica
settings.inicome per la Heltec. - Compila e carica:
Se l'upload non parte, entra manualmente in bootloader UF2 con un doppio‑tap del tasto RST (comportamento standard delle schede XIAO), poi rilancia l'upload.pio run -e groupA_xiao_wiosx1262 -t upload - Apri il monitor seriale (
pio device monitor -b 115200) per verificare l'inizializzazione radio e la ricezione dei sensori.
Nessun display, nessuna schermata/grafico e nessun tasto utente generico su questa scheda: la navigazione schermate e il menu di invio manuale non sono disponibili. Durante i ~5 minuti di sincronizzazione oraria il LED RGB onboard dà il feedback al posto dello schermo: blu lampeggiante = in ascolto, verde fisso (~3 s) = orario confermato, rosso lampeggiante = finestra scaduta senza conferma.
Matrice hardware
| Heltec V3 | Heltec V4 | XIAO nRF52840 + Wio‑SX1262 | |
|---|---|---|---|
| MCU / radio | ESP32‑S3 + SX1262 | ESP32‑S3 + SX1262 | nRF52840 + SX1262 |
| Display | OLED SSD1306 128×64 | OLED SSD1306 128×64 | assente (feedback su LED RGB) |
| Tasto utente / menu invio manuale | sì (PRG) | sì (PRG) | non disponibile |
| Gruppo A | groupA_heltec_v3 | groupA_heltec_v4 | groupA_xiao_wiosx1262 |
| Gruppo B | groupB_heltec_v3 | groupB_heltec_v4 | groupB_xiao_wiosx1262 |
Note
- L'SX1262 è packet‑oriented: si configura in GFSK packet mode (preamble
detect + sync word) e il parsing del payload avviene nel firmware (niente
rtl_433_ESP, che richiede SX127x in continuous mode). - La radio è una sola, condivisa fra tre modalità (RX‑GFSK sensori, TX‑LoRa Meshtastic, RX‑LoRa time‑sync) gestite da un unico owner, senza interrompere il timing dei pacchetti Meshtastic.
- I parser seguono i formati di riferimento di
merbanan/rtl_433. - Per il Gruppo B (Bresser) deviazione e banda RX restano i valori comuni di default: la ricezione funziona, ma per la massima sensibilità andranno affinati sull'hardware reale.
🇬🇧 English
Features
- Selectable multi‑sensor: pick which sensors to decode; the firmware compiles only the needed parsers and screens (modular build).
- 20 supported sensors across two radio groups (see table below).
- Hand‑made Meshtastic gateway: AES‑128/256‑CTR, protobuf, two channels (telemetry + text), NodeInfo, fixed map position.
- Native telemetry:
EnvironmentMetrics+AirQualityMetrics(temperature, humidity, pressure, wind, rainfall 1h/24h, lux, soil, PM2.5/PM10, CO₂). - Time‑sync without RTC or GPS: derives the clock from Meshtastic traffic at boot, multi‑confirmation algorithm, with the valid window derived from the build date.
- Automatic bulletins: 3 daily astronomy bulletins (sunrise+1h, noon, sunset−1h) on the primary channel + a fixed‑interval bulletin on the text channel, with emoji and the local send date and time (📅 🕒). The text never exceeds the Meshtastic 200‑byte limit: when space runs short, the least essential fields — astro, date/time, link — are dropped whole (never mid‑field), always keeping the actual sensor data.
- Lightning alerts on both channels (primary + text) with a configurable threshold.
- Manual bulletin send: long‑press the PRG button → windowed menu to pick the channel (Ch0/Ch1) → confirm; every submenu has a "Back" entry and auto‑closes after 10 s of inactivity.
- Offline ephemeris: sunrise/sunset, moon phase (waxing/waning).
- OLED display with capability‑driven rotating screens: overview, temp/humidity, pressure, rain, wind, UV/light, lightning, air quality, soil, leak, 24h graphs (temperature, humidity, rain, lightning), time+date, astro, Meshtastic status (short name + countdown to next send + battery %/USB power). Each data screen shows the model and ID of the received sensor (handy to tell your own station apart from a neighbour's).
- Boot splash screen (5 s) with logo, project name and firmware version.
- Build‑time web configurator (
tools/configurator/index.html) to generate the wholesettings.ini.
Key constraint: one SX1262 = one bitrate
868 MHz sensors split into two bitrate groups, both using sync word 0x2DD4. A
single SX1262 holds one configuration at a time: the two groups cannot be
received together. The group is a build‑time choice (one environment per
group); the pre‑build script rejects a mixed selection.
| Group | Bitrate | Sensors |
|---|---|---|
| A | ~17.241 kbps | Fine Offset / Ecowitt + LaCrosse IT+/TFA |
| B | ~8.06 kbps | Bresser |
Supported sensors
Group A (groupA_*)
| id | Model | Measures |
|---|---|---|
WH32 | Fine Offset WH32 / WH25 / WH32B | temp / humidity / pressure |
WH31E | Ambient WH31E / WH31B | temp / humidity |
WH40 | Ecowitt WH40 | rain |
WH57 | Ecowitt WH57 / WH31L | lightning |
WH51 | Ecowitt WH51 / WN31 / SM23 | soil moisture |
WH45 | Ecowitt WH45 | PM2.5 / PM10 / CO₂ / temp / humidity |
WH46 | Ecowitt WH46 | PM1/2.5/4/10 / CO₂ / temp / humidity |
WN34 | Fine Offset WN34S/L/D | temperature probe (soil/water) |
WS68 | Ecowitt WS68 | wind / light / UV |
WS80 | Fine Offset WS80 | temp / humidity / wind / UV / light |
WS85 | Fine Offset WS85 | wind / rain |
WS90 | Fine Offset WS90 (Wittboy) | like WS80 + rain |
WH65B | Fine Offset WH24 / WH65B / WS69 | all‑in‑one station (temp / humidity / wind / rain / UV) |
TX35 | LaCrosse TX35 / TX29 / TFA 30.3155/30.3159 | temp / humidity |
Group B (groupB_*)
| id | Model | Measures |
|---|---|---|
BRESSER_5IN1 | Bresser 5‑in‑1 | temp / humidity / wind / rain |
BRESSER_6IN1 | Bresser 6‑in‑1 (+ new 5‑in‑1 / 3‑in‑1 wind / soil) | temp / humidity / wind / rain / UV / soil |
BRESSER_7IN1 | Bresser 7‑in‑1 weather | temp / humidity / wind / rain / UV |
BRESSER_7IN1_AQ | Bresser 7‑in‑1 Air Quality | PM2.5 / PM10 / CO₂ |
BRESSER_LIGHTNING | Bresser Lightning | lightning |
BRESSER_LEAKAGE | Bresser Leakage | water leak |
Configuration & build
Pick sensors (same group) in settings.ini:
[sensors]
enabled = WH32, WH40, WH57
The [meshtastic] section configures frequency, preset, intervals, channel
names/keys, position, timezone and lightning thresholds. Two pre‑build scripts
run on every build: apply_settings.py (network → include/user_config.h)
and configure_sensors.py (sensors → src/config/generated_config.h +
build_src_filter).
pio run -e groupA_heltec_v4 -t upload # or _v3 / groupB_*
pio run -e groupA_xiao_wiosx1262 -t upload # Seeed XIAO nRF52840 + Wio-SX1262
How‑to: flashing the Heltec board
- Install PlatformIO and connect the Heltec (V3/V4) over a data USB‑C cable. Install the CP2102/CH9102 USB‑serial driver if no COM port shows up.
- Edit
settings.ini(or generate it with the web configurator). - Build & upload with the right environment:
Addpio run -e groupA_heltec_v4 -t upload--upload-port COMx//dev/ttyUSBxto force the port. - Open the serial monitor:
pio device monitor -b 115200. - Boot mode (only if upload fails): hold BOOT (PRG), tap RST, release BOOT, then re‑run the upload. The V3/V4 usually enters download mode on its own, so this is rarely needed.
At boot the board shows the splash screen (5 s), then opens a ~5‑minute window to sync time from the Meshtastic network; press PRG to cycle through the screens. Once time‑sync is done, long‑press PRG to open the manual send menu (short press = next item, long press = select).
How‑to: flashing the XIAO nRF52840 + Wio‑SX1262 board
- Install PlatformIO and connect the Seeed XIAO nRF52840 + Wio‑SX1262 Kit (SKU 102010710/113010003, pin‑header radio module, not the ESP32‑S3's B2B variant) over USB‑C.
- Edit
settings.inias for the Heltec. - Build & upload:
If the upload doesn't start, enter the UF2 bootloader manually with a double‑tap of the RST button (standard XIAO behaviour), then re‑run the upload.pio run -e groupA_xiao_wiosx1262 -t upload - Open the serial monitor (
pio device monitor -b 115200) to check radio init and sensor reception.
No display, no screens/graphs and no general‑purpose user button on this board: screen navigation and the manual‑send menu aren't available. During the ~5‑minute time‑sync window the onboard RGB LED gives feedback instead: blinking blue = listening, solid green (~3 s) = time confirmed, blinking red = window expired without confirmation.
Struttura del progetto / Project layout
platformio.ini # env: groupA/B × heltec_v3/v4/xiao_wiosx1262
settings.ini # [meshtastic] (parità EcoWitt) + [sensors]
sensors_catalog.json # FONTE DI VERITÀ: sensori, gruppi, capability, sorgenti
tools/
apply_settings.py # [meshtastic] -> include/user_config.h (MESH_*, RX_*)
configure_sensors.py # [sensors] + catalogo -> generated_config.h + src_filter
configurator/index.html # configuratore web (genera tutto il settings.ini)
include/user_config.h # generato (rete/nodo)
src/
main.cpp # dispatch: match -> parse -> uiSubmit -> meshSubmit
board_config.h # pin per scheda (Heltec V3/V4, XIAO+Wio-SX1262)
config/generated_config.h # generato (RADIO_*, ENABLE_*, SCREEN_*)
radio/ # gestore unico SX1262 a 3 modalità
sensors/ # sensor_types.h, registry, sensor_util.h, fineoffset/ lacrosse/ bresser/
display/ # display.h, ui.{h,cpp}, splash_logo.h, screens/ (incl. grafici 24h)
# display_oled.cpp (HAS_OLED) / display_none.cpp (senza display)
mesh/ # meshtastic_pack.{h,cpp}
timesync.{h,cpp} astro.{h,cpp} history.h
battery.h battery_esp32.cpp battery_nrf52.cpp
led_status.{h,cpp} # feedback time-sync su LED RGB (schede senza display)
Autore / Author
IZ0KEW
Licenza / License
Licenza MIT — vedi il file LICENSE. MIT License — see the LICENSE file.