| Name | Modified | Size | Downloads / Week |
|---|---|---|---|
| Heltec V4 | 2026-11-12 | ||
| TECHNIQUE.md | 2026-11-12 | 42.7 kB | |
| README.md | 2026-11-12 | 46.5 kB | |
| LICENSE | 2026-11-04 | 35.6 kB | |
| Totals: 4 Items | 124.8 kB | 6 |
Station météo LoRa autonome — Heltec WiFi LoRa 32 V4
Station météo autonome qui fait sa propre prévision locale à 12 h à partir de ses seuls capteurs. Elle avertit en cas de coup de vent, de gel ou de brouillard, puis diffuse un court bulletin sur les canaux publics Meshtastic et MeshCore, et dans le groupe public du pays sur ROCS.
Elle ne dépend d'aucun service Internet ni d'aucune source de prévision extérieure. Les modèles qu'elle embarque ont été appris et validés sur 10 ans d'observations réelles (Météo-France et NOAA GHCNh).
English summary at the end of this file.
19h30 1030hPa +1.6/3h 7°C 69% : Temps sec (pluie 2%, 0°C min sur 12h ⚠ gel possible) Dans 38h : 3°C min.
18h40 1004hPa -4.2/3h 11°C 88% : Pluie probable (pluie 78%, 9°C min sur 12h) ⚠ Coup de vent poss.
Sommaire
- Fonctionnalités
- Matériel et câblage
- Installation et flashage
- Premier démarrage
- Utilisation
- Comment fonctionne la prévision
- Utilisation hors de France
- Limites
- Outils Python
- Licence et crédits
- English summary
Fonctionnalités
Mesures
- Pression, température, humidité et point de rosée.
- Pression ramenée au niveau de la mer (QNH), avec sa tendance sur 1 h, 3 h et 6 h.
Prévision à 12 h
- Probabilité de pluie, donnée par un modèle appris.
- Repli sur l'algorithme de Zambretti si le capteur d'humidité manque.
- Température minimale des 12 h suivantes, et minimale de la nuit de demain (prévue à 19 h).
Alertes
- Coup de vent possible (rafales parmi les 3 % les plus fortes du lieu).
- Gel en cours, et gel possible dans les 12 h (minimale prévue).
- Brouillard probable.
Diffusion LoRa
- Bulletin en émission seule sur Meshtastic (LongFast EU_868) et MeshCore (EU/UK Narrow, canal Public).
- Le même bulletin sur ROCS, dans le groupe public du pays (
public-fr...). Le pays et la fréquence sont trouvés d'après la position GPS.
Affichage et réglages
- Écran OLED : valeurs, prévision, alertes et courbe de pression.
- Réglages par une page Wi-Fi, ouverte par un appui de 5 s sur PRG, sans recompiler.
- Interface et bulletins en français ou en anglais.
GPS
- Heure, altitude moyennée, nom de station (locator Maidenhead), fuseau horaire.
- Choix automatique du modèle de vent selon le climat.
Autonomie
- Deep sleep entre deux mesures (toutes les 5 min).
Matériel et câblage
| Élément | Modèle | Remarque |
|---|---|---|
| Carte | Heltec WiFi LoRa 32 V4 (ESP32-S3R2 + SX1262) | V4.2 et V4.3 reconnues. Pas la V4-R8, dont le brochage diffère. |
| Pression | BMP390 (ou BMP388), BME280 ou BMP280 | Le BMP390 est le plus juste (±0,5 hPa). |
| Humidité | SHT41 ou SHT31 (recommandé) | Sans SHT : l'humidité du BME280, sinon Zambretti seul. |
| GNSS | Kit Heltec du connecteur 8 broches (L76K / CM121, 9600 bauds) | Nécessaire pour l'heure et l'altitude. |
| Antenne | 868 MHz | Ne jamais émettre sans antenne. |
| Alimentation | Batterie Li-ion 3,7 V sur le connecteur JST, ou USB |
Câblage I2C. Les capteurs sont détectés automatiquement au démarrage, à l'adresse 0x76/0x77 (pression) ou 0x44/0x45 (SHT), sur l'un des deux bus :
| Bus | SDA | SCL | Remarque |
|---|---|---|---|
| Bus OLED | GPIO 17 | GPIO 18 | Partagé avec l'écran |
| Second bus | GPIO 4 | GPIO 3 | Connecteur QuickLink |
Alimentation des capteurs en 3,3 V.
GNSS. Le kit se branche sur le connecteur dédié :
- TX vers le GPS : GPIO 38 ;
- RX depuis le GPS : GPIO 39 ;
- EN : GPIO 34, actif bas.
Installation physique.
- Placer le SHT dans un abri ventilé, à l'ombre et à l'écart de la carte, qui chauffe un peu.
- Le capteur de pression peut rester dans le boîtier, à condition que celui-ci ne soit pas étanche à l'air.
Installation et flashage
Deux possibilités :
- A. Flasher l'image prête à l'emploi (
station_meteo_heltec_v4_merged.bin). Rien à compiler. - B. Compiler depuis les sources avec PlatformIO.
A. Flasher l'image complète
L'image fusionnée contient le bootloader, la table de partitions et le firmware. Elle se flashe à l'adresse 0x0.
Depuis un navigateur (Chrome ou Edge, sans rien installer) :
- Ouvrir https://espressif.github.io/esptool-js/.
- Brancher la carte en USB et cliquer Connect.
- Choisir le port, puis le fichier
station_meteo_heltec_v4_merged.binà l'adresse0x0. - Cliquer Program.
En ligne de commande avec esptool (Linux ou Windows) :
pip install esptool
# Linux
esptool.py --chip esp32s3 --port /dev/ttyACM0 write_flash 0x0 station_meteo_heltec_v4_merged.bin
# Windows (PowerShell) : remplacer COM5 par le port vu dans le Gestionnaire de périphériques
esptool --chip esp32s3 --port COM5 write_flash 0x0 station_meteo_heltec_v4_merged.bin
Si la carte n'est pas reconnue ou si le flashage échoue : passer la carte en mode téléchargement.
- Maintenir le bouton PRG (BOOT).
- Appuyer brièvement sur RST.
- Relâcher PRG.
- Relancer le flashage.
- Après le flashage, appuyer sur RST pour démarrer.
Sous Linux, si le port est refusé, ajouter l'utilisateur au groupe dialout, puis se reconnecter :
sudo usermod -aG dialout $USER
Les réglages sont gardés en mémoire NVS et survivent à un reflashage. Pour tout remettre à zéro, y compris l'altitude apprise :
esptool.py --chip esp32s3 erase_flash
B. Compiler (Linux)
pipx install platformio # ou : pip install --user platformio
git clone <dépôt> && cd meteo-v4 # ou décompresser l'archive
pio run -e heltec_v4 # compiler
pio run -e heltec_v4 -t upload # compiler et flasher en USB
pio device monitor # journal série à 115200 bauds
pio run -e heltec_v4 -t mergebin # produire station_meteo_heltec_v4_merged.bin
Les bibliothèques (RadioLib, U8g2, Adafruit BMP3XX/BMP280/BME280/SHT4x/SHT31, TinyGPSPlus) sont téléchargées automatiquement.
Environnements :
| Environnement | Rôle |
|---|---|
heltec_v4 |
Firmware normal, avec deep sleep. |
heltec_v4_banc |
Banc d'essai : sans sommeil, l'USB reste connecté, mêmes cadences. |
Valeurs par défaut au premier démarrage. Ce sont des -D dans platformio.ini, tous modifiables ensuite sur la page Wi-Fi :
| Paramètre | Rôle |
|---|---|
PERIODE_MIN |
Période de mesure. |
ALTITUDE_FIXE_M |
Altitude connue. |
VENT_ZAMBRETTI |
Vent dominant pour Zambretti. |
OLED_PERMANENT |
Écran toujours allumé. |
ENVOI_MESH, ENVOI_MESHTASTIC, ENVOI_MESHCORE |
Diffusion des bulletins. |
PERIODE_ENVOI_MIN |
Cadence des bulletins. |
FENETRE_ENVOI_S |
Fenêtre d'émission aléatoire après la mesure (120 s). |
LORA_PUISSANCE_DBM |
Puissance d'émission. |
LANGUE |
0 = français, 1 = anglais. |
Remarque. La V4 utilise l'USB natif de l'ESP32-S3 : le port série disparaît pendant le deep sleep. Pour suivre le journal en continu, utiliser l'environnement heltec_v4_banc.
Premier démarrage
- Écran « Capteurs » (4 s) : modèle, adresse et broches de chaque capteur trouvé, avec sa première mesure. Le même rapport part sur la liaison série.
- Recherche GPS, à faire en extérieur, ciel dégagé. La station attend l'heure, puis 40 échantillons d'altitude de bonne qualité. Le premier fix peut prendre quelques minutes.
- Mesure toutes les 5 min. La station s'endort entre deux mesures.
- Tendance disponible après 2 h 30 à 3 h d'historique. Le premier bulletin régulier part à ce moment-là.
- Alerte vent disponible après environ 6 h 15 d'historique.
Nom de la station. Par défaut, c'est le locator Maidenhead calculé par le GPS (ex. « JN17va »). Avant le premier fix : « Meteo-XXXX ».
Altitude. Elle sert à ramener la pression au niveau de la mer.
- Par défaut, l'altitude GPS est moyennée sur plusieurs sessions.
- Pour plus de précision, saisir l'altitude exacte du lieu (carte IGN / Géoportail) sur la page de réglages.
Utilisation
Bouton PRG
| Appui | Action |
|---|---|
| Bref | Allume l'écran : valeurs et prévision, puis courbe de pression (10 s par page). |
| 2 s | Envoi immédiat du bulletin. |
| 5 s | Ouvre la page de réglages Wi-Fi. |
Page de réglages Wi-Fi
- Appuyer 5 s sur PRG. L'écran affiche le nom du réseau ouvert « Meteo-XXXX », sans mot de passe.
- S'y connecter avec un téléphone ou un PC. La page s'ouvre seule (portail captif). Sinon, aller sur http://192.168.4.1.
- Régler, puis Enregistrer. Le Wi-Fi s'éteint après validation, sur un appui de PRG ou après 5 min.
Réglages disponibles :
- Langue.
- Nom et nom court de la station.
- Altitude connue, et oubli de l'altitude GPS apprise.
- Vent dominant.
- Diffusion oui/non, Meshtastic et/ou MeshCore et/ou ROCS.
- Meshtastic et MeshCore : fréquence, bande, SF et CR (par défaut LongFast EU_868 et EU/UK Narrow ; une case rétablit ces valeurs).
- ROCS : groupe public du pays, ou son groupe d'essai
test-xxpour vérifier la réception ; pays imposé (code ISO) ou trouvé d'après le GPS. - Cadence des bulletins (15 min à 24 h).
- Puissance d'émission.
- Écran permanent.
- Modèle d'alerte vent (automatique, une famille de climat, ou désactivé).
- Fuseau horaire (automatique ou chaîne POSIX).
Lire le bulletin
19h30 1030hPa +1.6/3h 7°C 69% : Temps sec (pluie 2%, 0°C min sur 12h ⚠ gel possible) Dans 38h : 3°C min.
| Élément | Signification |
|---|---|
19h30 |
Heure locale de la mesure. |
1030hPa |
Pression ramenée au niveau de la mer. |
+1.6/3h |
Variation de pression sur 3 h. Hausse = amélioration, baisse marquée = dégradation. |
7°C 69% |
Température et humidité relative. |
Temps sec |
Prévision à 12 h : Temps sec / Faible risque de pluie / Risque de pluie / Pluie probable. |
(pluie 2%, 0°C min sur 12h …) |
Sur les 12 prochaines heures : probabilité de pluie et température la plus basse prévue (à 1 ou 2 °C près). |
⚠ gel possible |
La minimale prévue annonce du gel (≤ 0,5 °C). |
⚠ … |
Alerte éventuelle : Coup de vent poss., GEL, Gel possible, Brouillard probable. |
Dans 38h : 3°C min |
Température la plus basse prévue pour la nuit suivante (20 h - 9 h), d'ici les heures indiquées (fin de cette nuit). Calculée à 19 h, donnée jusqu'au lendemain 19 h. Plus incertaine : 2 à 3 °C près. |
Diffusion :
- Meshtastic : le bulletin part en message texte sur le canal primaire LongFast. La station apparaît comme un nœud CLIENT_MUTE.
- MeshCore : il part sur le canal Public, sous la forme « NOM: bulletin ».
- ROCS : il part en message texte dans le groupe public du pays (
public-fren France), coupé à 120 octets. Il part avec un TTL de 0 : les relais ROCS ne le réémettent pas, seuls les nœuds à portée directe le reçoivent. La station s'annonce avec son nom toutes les heures et apparaît sur la carte au centre de son locator (à ~3 km près).
Hors d'Europe : ROCS passe sur la fréquence du pays (915 MHz aux Amériques, 920 MHz au Japon...). Meshtastic et MeshCore ne sont pas émis dans la sous-bande européenne 869,4–869,65 MHz (leur réglage par défaut) quand le préréglage du pays n'est pas EU_868 ; on peut leur donner la fréquence et les paramètres du réseau local sur la page Wi-Fi.
Cadence :
- Un bulletin toutes les 15 min par défaut. Il est répété même inchangé.
- Il part à un instant tiré au hasard dans les 2 minutes qui suivent la mesure, pour que des stations voisines n'émettent pas toutes en même temps. La station se rendort en attendant. L'envoi manuel (appui de 2 s) part aussitôt.
- Une alerte nouvelle part plus tôt.
- La station fait une écoute avant émission (CAD). Chaque envoi occupe l'antenne environ 1 s par protocole.
- La station n'écoute ni ne relaie rien.
Écran
Après un appui sur PRG : page des valeurs (pression, température, humidité, prévision de pluie et minimale), courbe de pression, puis page des températures (minimale des 12 h, nuit de demain, mémoire disponible).
Coupure d'alimentation
L'historique (mesures des 6 dernières heures et relevés horaires des 48 dernières heures) est recopié en flash toutes les heures. Après une coupure, dès que le GPS donne l'heure, la station reprend les relevés encore assez récents pour servir : au pire une heure de mesures est perdue, et la tendance de pression et la mémoire de 48 h repartent aussitôt. Une mise à jour du firmware ne fait plus perdre l'historique non plus.
Journal série (CSV)
Brancher en USB à 115200 bauds. Une ligne par mesure :
epoch,local,p_station,t_bmp,t_air,rh,td,qnh,d3h,Z,p_pluie,p_vent,alt,vbat,alerte
Comment fonctionne la prévision
Une station isolée ne voit que sa pression, sa température et son humidité. Toute la prévision repose sur l'évolution de ces trois grandeurs, sur la date et sur l'heure.
Pluie à 12 h.
- Régression logistique sur la pression mer, la tendance 3 h, l'humidité, l'écart au point de rosée et les variations sur 3 h.
- Apprise sur 75 000 cas d'observations Météo-France réelles.
- Jugée sur une période non vue, sa justesse (HSS) est de +0,43, contre +0,31 pour Zambretti seul.
- Sans SHT, la station se replie sur Zambretti.
Coup de vent à 12 h.
- Même principe, avec les tendances 1 h, 3 h et 6 h de la pression.
- L'événement prédit est relatif au lieu : « rafales parmi les 3 % les plus fortes de la station ». Cela fait environ 60 km/h à Nevers, 80 km/h à Brest et 130 km/h au cap Béar. La station n'a donc pas besoin de connaître son seuil.
- Validation sur 10 ans et 71 stations Météo-France. Chaque station et chaque saison ont été jugées par un modèle qui ne les avait jamais vues, et seuls les cas où la rafale n'avait pas encore commencé ont été comptés :
| Méthode | HSS |
|---|---|
| Modèle de la station | +0,20 |
| Règle classique « chute de 3 hPa en 3 h » | +0,15 |
| Climatologie seule | +0,04 |
- Une alerte tient tant que la probabilité reste au-dessus de 75 % du seuil (hystérésis).
Température minimale.
- Régression linéaire de l'écart entre la minimale et la température actuelle, sur les mesures de la station (point de rosée, refroidissement de la dernière heure, tendances de pression, humidité...) et, quand elle a 48 h d'historique horaire, sur sa mémoire (minimales et maximales des 24 h et de la veille, variations sur 24 h).
- Validation sur 10 ans et 71 stations Météo-France, station et saison inconnues :
| Minimale | Station | Référence |
|---|---|---|
| des 12 h (cas où elle baisse vraiment) | 1,6 °C d'erreur moyenne | 2,3 °C (climatologie) |
| de la nuit (prévue à 19 h) | 1,75 °C, 64 % à ±2 °C | 2,35 °C (nuit passée) |
| de la nuit de demain | 2,4 °C | 3,0 °C (nuit passée) |
- Sans 48 h d'historique (premiers jours, longue coupure), modèle à 6 h de mémoire : environ 0,2 °C de plus d'erreur.
Gel, brouillard.
- Gel : air ≤ 0 °C.
- Gel possible : minimale prévue des 12 h ≤ 0,5 °C (0,75 °C sans la mémoire de 48 h). Il détecte 73 % des nuits de gel contre 49 % pour l'ancienne règle « gelée blanche » (air ≤ 3 °C et point de rosée ≤ 1 °C), avec un peu plus de fausses alertes (31 % contre 19 %). L'ancienne règle sert tant que la prévision n'est pas disponible.
- Brouillard : écart au point de rosée ≤ 2 °C et HR ≥ 90 %, sans baisse de pression.
Le détail des méthodes et des chiffres de validation se trouve dans TECHNIQUE.md.
Utilisation hors de France
Le firmware est universel. Avec le réglage « Automatique », le GPS choisit le modèle d'alerte vent :
| Lieu | Modèle | HSS validé |
|---|---|---|
| France, Corse | Modèle France (10 ans Météo-France) | +0,20 |
| Îles Britanniques, Benelux, Allemagne, Scandinavie | Océanique | +0,21 |
| Europe centrale, Japon, Amérique du Nord | Continental | +0,21 |
| Péninsule ibérique, Italie | Méditerranéen | +0,14 |
| Sud du Brésil, Argentine | Subtropical | +0,13 |
| Tropiques (|lat| < 23,5°) | Pas d'alerte vent | (+0,02 : rien de fiable) |
| Ailleurs | Modèle commun, signalé « hors des régions validées » | +0,15 |
Ces chiffres viennent de 96 stations NOAA GHCNh et Météo-France, sur 10 ans. Chaque région a été jugée par un modèle appris sans elle.
Hémisphère sud. Les saisons sont inversées automatiquement.
Fuseau horaire. Il est déduit de la région, sinon de la longitude. Il est réglable sur la page.
Pluie et Zambretti. Le modèle de pluie et Zambretti restent ceux appris en France : ils sont indicatifs ailleurs.
Limites
Ce qu'il faut savoir avant de se fier aux alertes :
- C'est une aide, pas une prévision officielle. En cas de vigilance Météo-France ou d'alerte officielle, c'est elle qui compte.
- Alerte vent :
- elle annonce environ 30 % des coups de vent à l'avance ;
- environ 4 alertes sur 5 ne sont pas suivies d'un vrai coup de vent ;
- c'est nettement mieux que la règle de la chute de pression, mais cela reste un signal « soyez attentifs ».
- Orages et pluies intenses : pas prévisibles avec ces seuls capteurs (HSS +0,03 et +0,07). La station ne les annonce donc pas.
- Été et montagne : l'alerte vent y est faible. En été, les rafales sont surtout orageuses.
- Température minimale : à 1 ou 2 °C près. Elle dépend de l'emplacement du capteur (fond de vallée, abri). Sur la côte méditerranéenne exposée (Cap Béar, Sète, Nice), le modèle prévoit trop froid de 1 à 2 °C.
- Brouillard : seuils empiriques.
Outils Python
Le dossier outils/ permet de vérifier et de réapprendre les modèles sur des données réelles. Il faut Python 3 et numpy (pip install numpy). Les outils fonctionnent sous Linux comme sous Windows.
| Outil | Rôle |
|---|---|
valider_alertes.py |
Apprend et valide les modèles de vent et de pluie. Sources : Météo-France (--source meteofrance), NOAA GHCNh (--source ghcnh) ou les deux (--source les-deux). Produit un .json. |
ghcnh.py |
Choisit et télécharge les stations GHCNh (aéroports d'abord, bonne couverture, réparties dans la région). |
exporter_modele_vent.py |
Convertit les .json en src/modele_vent.h pour le firmware. |
valider_temperature.py |
Étude : la station peut-elle prévoir la minimale (nuit, lendemain, 12 h) ? Comparée à la persistance, à la climatologie et à la formule de Craddock-Pritchard. |
generer_pays.py |
Produit src/pays.h (frontières des pays et préréglages ROCS) à partir de Natural Earth. |
zambretti_test.py |
Même calcul que le firmware : rejouer un journal CSV, écouter la station sur le port série, tester sur Open-Meteo. |
station_virtuelle.py |
Simule une station à partir d'Open-Meteo, sans matériel. |
affinage.py |
Ajuste les seuils d'après les mesures réelles d'une station. |
Exemple : réapprendre puis exporter le modèle de vent.
cd outils
python valider_alertes.py --deps etendu --pas 6 --vent-relatif 0.97 --sortie modele_france.json
python valider_alertes.py --source les-deux --vent-relatif 0.97 --sortie modele_monde.json
python exporter_modele_vent.py modele_france.json modele_monde.json ../src/modele_vent.h
Le test des trames radio sur PC est décrit dans TECHNIQUE.md.
Licence et crédits
Licence.
- Copyright © 2026 Arnaud Trybou (F4NLJ).
- Ce programme est un logiciel libre, sous GNU General Public License v3.0 ou ultérieure. Voir LICENSE.
- Il est fourni sans aucune garantie. Ne pas s'en servir pour la sécurité des personnes ou des biens.
Données utilisées pour l'apprentissage et la validation :
- Météo-France : données d'observation, sous Licence Ouverte Etalab 2.0 (https://meteo.data.gouv.fr).
- NOAA NCEI : Global Historical Climatology Network hourly (GHCNh), domaine public.
- Open-Meteo (https://open-meteo.com) : réanalyses, pour la station virtuelle. Données CC BY 4.0.
- Textes de prévision Zambretti : d'après Negretti & Zambra (1915).
Bibliothèques, téléchargées à la compilation, chacune sous sa propre licence :
| Bibliothèque | Licence |
|---|---|
| RadioLib (Jan Gromeš) | MIT |
| U8g2 (olikraus) | BSD 2 clauses |
| Bibliothèques Adafruit BMP3XX, BMP280, BME280, SHT4x, SHT31 | BSD / MIT |
| TinyGPSPlus (Mikal Hart) | LGPL 2.1 |
| Arduino-ESP32 (Espressif) | LGPL 2.1 / Apache 2.0 |
| libsodium (fournie par l'ESP-IDF, chiffrement ROCS) | ISC |
Frontières des pays (src/pays.h) : Natural Earth 1:50m, domaine public.
Compatibilité radio. Les formats de trame sont réimplémentés pour l'interopérabilité :
- Meshtastic : marque de Meshtastic LLC ;
- MeshCore ;
- ROCS.
Ce projet n'est affilié ni à Meshtastic ni à MeshCore.
Réglementation.
- Bande 869,4–869,65 MHz : 500 mW PAR maximum, cycle d'activité de 10 %.
- La puissance par défaut et la cadence respectent ces limites. Vérifier la réglementation du pays d'utilisation.
English summary
What it is. A battery-powered weather station on a Heltec WiFi LoRa 32 V4. It makes its own 12-hour local forecast from its sensors only: pressure, temperature and humidity.
Sensors.
- Pressure: BMP390, BME280 or BMP280.
- Humidity: SHT41 or SHT31.
- A GNSS module.
Forecast and alerts.
- Rain probability.
- Strong-wind alert: gusts in the top 3 % for the site. Validated over 10 years: HSS +0.20, against +0.15 for the classic "3 hPa drop" rule.
- Frost and fog alerts.
Broadcast.
- A short bulletin goes out on the public Meshtastic (LongFast EU_868) and MeshCore (EU Narrow, Public) channels, and in the country's public ROCS group (country and frequency found from GPS).
- Transmit only.
Use worldwide.
- The wind model is picked from the GPS position by climate family: oceanic, continental, Mediterranean, subtropical. It is disabled in the tropics.
- Seasons are flipped in the southern hemisphere.
- The timezone is set automatically.
Interface. Screen, web settings page and bulletins in English or French.
Flashing. Write station_meteo_heltec_v4_merged.bin at 0x0, with https://espressif.github.io/esptool-js/ or:
esptool.py --chip esp32s3 --port /dev/ttyACM0 write_flash 0x0 station_meteo_heltec_v4_merged.bin
If flashing fails: hold PRG, press RST, release PRG, retry.
Building.
pio run -e heltec_v4 -t upload
pio run -e heltec_v4 -t mergebin
PRG button.
| Press | Action |
|---|---|
| Short | Show the screens. |
| 2 s | Send the bulletin now. |
| 5 s | Open the Wi-Fi network "Meteo-XXXX" (no password). The settings page is at http://192.168.4.1. |
Licence. GPL-3.0-or-later, with no warranty. This is not an official warning service.
---
Autonomous LoRa Weather Station — Heltec WiFi LoRa 32 V4
An autonomous weather station that generates its own 12-hour local forecast based solely on its own sensor data. It issues alerts for strong winds, frost, or fog, and broadcasts a brief weather bulletin via the public Meshtastic and MeshCore channels, as well as to the national public group on ROCS.
It does not rely on any Internet services or external forecasting sources. The onboard models were trained and validated using 10 years of real-world observational data (from Météo-France and NOAA GHCNh).
English summary at the end of this file.
19:30 1030 hPa +1.6/3h 7°C 69% : Dry weather (2% chance of rain, 0°C min. over 12h ⚠ frost possible) In 38h: 3°C min.
18:40 1004 hPa -4.2/3h 11°C 88% : Rain likely (78% chance of rain, 9°C min. over 12h) ⚠ Strong winds possible.
``` ```
---
## Table of Contents
1. [Features](#features)
2. [Hardware and Wiring](#hardware-and-wiring)
3. [Installation and Flashing](#installation-and-flashing)
4. [Initial Startup](#initial-startup)
5. [Usage](#usage)
6. [How the Forecast Works](#how-the-forecast-works)
7. [Usage Outside of France](#usage-outside-of-france)
8. [Limitations](#limitations)
9. [Python Tools](#python-tools)
10. [License and Credits](#license-and-credits)
11. [English Summary](#english-summary)
---
## Features
**Measurements**
- Pressure, temperature, humidity, and dew point.
- Sea-level pressure (QNH), including trends over 1, 3, and 6 hours.
**12-Hour Forecast**
- Probability of rain, calculated using a trained model.
- Fallback to the Zambretti algorithm if a humidity sensor is unavailable.
- Minimum temperature for the next 12 hours, as well as the minimum temperature for the following night (forecasted at 7:00 PM).
**Alerts**
- Potential high winds (gusts falling within the top 3% of historical wind speeds for the location).
- Ongoing frost, or potential frost within the next 12 hours (based on the forecasted minimum).
- Likely fog.
**LoRa Transmission**
- Broadcasts weather bulletins via Meshtastic (LongFast EU_868) and MeshCore (EU/UK Narrow, Public channel).
- Sends the same bulletin to the ROCS network, within the public group for the specific country (e.g., `public-fr`). The country and frequency are determined based on GPS coordinates.
``` **Display and Settings**
- OLED screen: current values, forecast, alerts, and pressure trend curve.
- Configuration via a Wi-Fi page—accessed by holding the "PRG" button for 5 seconds—without requiring recompilation.
- Interface and weather reports available in French or English.
**GPS**
- Time, averaged altitude, station location (Maidenhead locator), and time zone.
- Automatic selection of the wind model based on the local climate.
**Battery Life**
- Deep sleep mode between measurements (taken every 5 minutes).
---
## Hardware and Wiring
| Component | Model | Note |
|---|---|---|
| Board | Heltec WiFi LoRa 32 **V4** (ESP32-S3R2 + SX1262) | Compatible with V4.2 and V4.3. Not compatible with V4-R8 (different pinout). |
| Pressure | **BMP390** (or BMP388), **BME280**, or **BMP280** | The BMP390 is the most accurate (±0.5 hPa). |
| Humidity | **SHT41** or **SHT31** (recommended) | If no SHT sensor is present, the BME280’s humidity reading is used; otherwise, the system relies solely on the Zambretti algorithm. |
| GNSS | Heltec 8-pin connector kit (L76K / CM121, 9600 baud) | Required for time and altitude data. |
| Antenna | 868 MHz | **Never transmit without an antenna connected.** |
| Power Supply | 3.7V Li-ion battery (via JST connector) or USB | | **I2C Wiring.** Sensors are automatically detected at startup at address 0x76/0x77 (pressure) or 0x44/0x45 (SHT) on one of the two buses:
| Bus | SDA | SCL | Note |
|---|---|---|---|
| OLED Bus | GPIO 17 | GPIO 18 | Shared with the display |
| Second Bus | GPIO 4 | GPIO 3 | QuickLink connector |
Sensors are powered at 3.3 V.
**GNSS.** The kit connects to the dedicated port:
- TX to the GPS: GPIO 38;
- RX from the GPS: GPIO 39;
- EN: GPIO 34, active-low.
**Physical Installation.**
- Place the SHT sensor in a ventilated, shaded shelter, away from the board (which generates some heat).
- The pressure sensor can remain inside the enclosure, provided the enclosure is not airtight.
---
## Installation and Flashing
Two options:
- **A. Flash the ready-to-use image** (`station_meteo_heltec_v4_merged.bin`). No compilation required.
- **B. Compile from source** using PlatformIO.
### A. Flashing the Complete Image
The merged image contains the bootloader, partition table, and firmware. It should be flashed **at address 0x0**.
**Using a web browser** (Chrome or Edge; no installation required):
1. Open <https://espressif.github.io/esptool-js/>.
2. Connect the board via USB and click **Connect**. 3. Select the port, then the file `station_meteo_heltec_v4_merged.bin` at address `0x0`.
4. Click **Program**.
*Via the command line using esptool* (Linux or Windows):
pip install esptool
# Linux
esptool.py --chip esp32s3 --port /dev/ttyACM0 write_flash 0x0 station_meteo_heltec_v4_merged.bin
# Windows (PowerShell): replace COM5 with the port shown in Device Manager
esptool --chip esp32s3 --port COM5 write_flash 0x0 station_meteo_heltec_v4_merged.bin
**If the board is not recognized or the flashing process fails:** put the board into download mode.
1. Hold down the **PRG** (BOOT) button.
2. Briefly press the **RST** button.
3. Release the **PRG** button.
4. Retry the flashing process.
5. After flashing, press the **RST** button to start the device.
**On Linux**, if access to the port is denied, add your user to the `dialout` group, then log out and log back in:
sudo usermod -aG dialout $USER
Settings are stored in NVS memory and **persist even after re-flashing**. To reset everything, including the learned altitude:
esptool.py --chip esp32s3 erase_flash
### B. Compiling (Linux)
pipx install platformio # or: pip install --user platformio
git clone <repository> && cd meteo-v4 # or extract the archive
pio run -e heltec_v4 # compile
pio run -e heltec_v4 -t upload # compile and flash via USB
pio device monitor # serial log at 115200 baud
pio run -e heltec_v4 -t mergebin # produce station_meteo_heltec_v4_merged.bin
Libraries (RadioLib, U8g2, Adafruit BMP3XX/BMP280/BME280/SHT4x/SHT31, TinyGPSPlus) are downloaded automatically.
**Environments:**
| Environment | Role |
|---|---|
| `heltec_v4` | Standard firmware, with deep sleep. |
| `heltec_v4_banc` | Test bench: no sleep, USB remains connected, same timing/intervals. |
**Default values upon first startup.** These are defined as `-D` flags in `platformio.ini` and can all be modified later via the Wi-Fi configuration page:
| Parameter | Role |
|---|---|
| `PERIODE_MIN` | Measurement interval. |
| `ALTITUDE_FIXE_M` | Known altitude. |
| `VENT_ZAMBRETTI` | Prevailing wind for the Zambretti algorithm. |
| `OLED_PERMANENT` | Keeps the display on at all times. |
| `ENVOI_MESH`, `ENVOI_MESHTASTIC`, `ENVOI_MESHCORE` | Broadcasting of weather reports. |
| `PERIODE_ENVOI_MIN` | Frequency of data transmissions. |
| `FENETRE_ENVOI_S` | Random transmission window following a measurement (120 s). |
| `LORA_PUISSANCE_DBM` | Transmission power. |
| `LANGUE` | 0 = French, 1 = English. |
**Note.** The V4 uses the ESP32-S3's native USB; the serial port **disappears during deep sleep**. To monitor the log continuously, use the `heltec_v4_banc` environment.
---
## Initial Startup
1. **"Sensors" screen (4 s)**: Displays the model, address, and pins for each detected sensor, along with its initial reading. This same report is also sent via the serial connection.
2. **GPS Search**: Must be performed outdoors under an open sky. The station waits to acquire the time, followed by 40 high-quality altitude samples. The initial GPS fix may take a few minutes.
3. Measurements are taken every 5 minutes. The station enters sleep mode between readings.
4. **Trend data** becomes available after 2.5 to 3 hours of recorded history. The first regular report is transmitted at this point.
5. **Wind alerts** become available after approximately 6 hours and 15 minutes of recorded history.
**Station Name.** By default, this is the Maidenhead locator calculated via GPS (e.g., "JN17va"). Before the initial fix, it appears as "Meteo-XXXX."
**Altitude.** Used to calculate sea-level pressure.
- By default, the GPS-derived altitude is averaged over several sessions.
- For greater accuracy, enter the precise altitude of your location (using an IGN map or the Géoportail website) on the settings page.
---
## Operation
### PRG Button
| Press Duration | Action |
|---|---|
| Short press | Turns on the display: shows current values and forecasts, followed by the pressure trend curve (10 seconds per page). |
| 2 seconds | Triggers an immediate report transmission. |
| 5 seconds | Opens the Wi-Fi settings page. |
### Wi-Fi Settings Page
1. Press and hold the PRG button for 5 seconds. The screen will display the name of an **open** (unsecured) network: "Meteo-XXXX."
2. Connect to this network using a phone or PC. The settings page will open automatically (via a captive portal). Alternatively, go to **http://192.168.4.1**.
3. Adjust settings, then select **Save**. The Wi-Fi will turn off after confirmation, upon pressing the PRG button, or after 5 minutes.
**Available settings:**
- Language.
- Station name and short name.
- Known altitude; option to discard the previously learned GPS altitude.
- Prevailing wind.
- Broadcast (yes/no) for Meshtastic, MeshCore, and/or ROCS.
- Meshtastic and MeshCore: frequency, band, SF, and CR (defaults are "LongFast EU_868" and "EU/UK Narrow"; a checkbox is provided to restore these values).
- ROCS: public group for the country, or a `test-xx` group to verify reception; country can be set manually (ISO code) or determined via GPS.
- Bulletin frequency (15 minutes to 24 hours).
- Transmission power.
- Always-on display.
- Wind alert model (automatic, climate-based, or disabled).
- Time zone (automatic or POSIX string).
### Reading the Bulletin
19:30 1030 hPa +1.6/3h 7°C 69% : Dry weather (2% chance of rain, 0°C min over 12h ⚠ frost possible) In 38h: 3°C min. ```
| Element | Meaning |
|---|---|
19:30 |
Local time of the measurement. |
1030 hPa |
Pressure adjusted to sea level. |
+1.6/3h |
Pressure change over 3 hours. A rise indicates improving conditions; a significant drop indicates deteriorating conditions. |
7°C 69% |
Temperature and relative humidity. |
Dry weather |
12-hour forecast: Dry weather / Low risk of rain / Risk of rain / Rain likely. |
(2% chance of rain, 0°C min over 12h …) |
For the next 12 hours: probability of rain and the lowest forecasted temperature (within 1–2°C). |
⚠ frost possible |
The forecasted minimum indicates frost (≤ 0.5°C). |
⚠ … |
Potential alert: Strong winds possible, FROST, Frost possible, Fog likely. |
In 38h: 3°C min |
Lowest forecasted temperature for the following night (8 PM – 9 AM), by the time indicated (end of that night). Calculated at 7 PM, valid until 7 PM the next day. Less precise: within 2–3°C. |
Distribution:
- Meshtastic: The bulletin is sent as a text message on the primary "LongFast" channel. The station appears as a CLIENT_MUTE node.
- MeshCore: transmitted on the Public channel in the format "NAME: bulletin".
- ROCS: transmitted as a text message within the country-specific public group (e.g.,
public-frfor France), truncated to 120 bytes. It is sent with a TTL of 0; ROCS relays do not retransmit it, so it is received only by nodes within direct range. The station broadcasts its name hourly and appears on the map at the center of its locator (with an accuracy of ~3 km).
Outside Europe: ROCS operates on the frequency designated for the specific country (915 MHz in the Americas, 920 MHz in Japan, etc.). Meshtastic and MeshCore do not transmit within the European sub-band of 869.4–869.65 MHz (their default setting) when the country preset is not set to EU_868; however, local network frequencies and parameters can be configured via the Wi-Fi page.
Transmission Schedule:
- By default, a bulletin is sent every 15 minutes, even if the data remains unchanged.
- Transmissions occur at a randomly selected time within 2 minutes following the measurement to prevent neighboring stations from transmitting simultaneously. The station then returns to a low-power (sleep) state. Manual transmission (triggered by a 2-second button press) occurs immediately.
- New alerts are transmitted with higher priority (sooner).
- The station performs a Channel Activity Detection (CAD) check before transmitting. Each transmission occupies the airwaves for approximately 1 second per protocol.
- The station does not listen for or relay any traffic.
Display Pressing the PRG button cycles through the following screens: a page displaying current values (pressure, temperature, humidity, rain forecast, and minimum temperature) along with a pressure trend curve, followed by a page showing temperature data (12-hour minimum, forecast for the following night, and available memory). ### Power Outage The history (measurements from the last 6 hours and hourly readings from the last 48 hours) is backed up to flash memory every hour. Following a power outage, as soon as the GPS provides the time, the station resumes using any readings that are still sufficiently recent; at worst, one hour of measurements is lost, while the pressure trend and the 48-hour memory are restored immediately. Furthermore, firmware updates no longer result in the loss of history.
Serial Log (CSV)
Connect via USB at 115200 baud. One line per measurement:
epoch,local,p_station,t_bmp,t_air,rh,td,qnh,d3h,Z,p_pluie,p_vent,alt,vbat,alerte
How the forecasting works
An isolated weather station only "sees" its own pressure, temperature, and humidity. The entire forecast is based on how these three variables change, along with the date and time.
Rain within 12 hours
- Uses logistic regression based on sea-level pressure, the 3-hour pressure trend, humidity, the dew-point spread, and 3-hour variations.
- Trained on 75,000 actual observation records from Météo-France.
- Evaluated on a separate, unseen dataset, it achieves an accuracy (HSS) of +0.43, compared to +0.31 for the Zambretti method alone.
- If the SHT (Smart-Hygro-Temperature) data is unavailable, the station defaults to the Zambretti method.
Strong winds within 12 hours
- Follows the same principle, incorporating 1-hour, 3-hour, and 6-hour pressure trends.
- The predicted event is location-specific: "gusts falling within the top 3% of the station's historical extremes." This corresponds to approximately 60 km/h in Nevers, 80 km/h in Brest, and 130 km/h at Cap Béar. Consequently, the station does not need to be pre-configured with a specific threshold value.
- Validated using 10 years of data from 71 Météo-France stations. Each station and season was evaluated using a model that had not encountered that specific data before; only instances where the gust had not yet begun were included in the assessment:
| Method | HSS |
|---|---|
| Station model | +0.20 |
| Classic rule ("3 hPa drop over 3 hours") | +0.15 |
| Climatology alone | +0.04 |
- An alert remains active as long as the probability stays above 75% of the threshold (using hysteresis). Minimum temperature.
- Linear regression of the difference between the minimum temperature and the current temperature, based on station measurements (dew point, cooling over the last hour, pressure trends, humidity, etc.) and—when 48 hours of hourly historical data are available—on the station’s own recorded history (24-hour and previous-day minimums/maximums, 24-hour variations).
- Validated over 10 years across 71 Météo-France stations, with the specific station and season unknown:
| Minimum | Station | Benchmark |
|---|---|---|
| 12-hour minimum (in cases of a significant drop) | 1.6°C mean error | 2.3°C (climatology) |
| Nighttime minimum (forecast at 7:00 PM) | 1.75°C; 64% within ±2°C | 2.35°C (previous night) |
| Minimum for the following night | 2.4°C | 3.0°C (previous night) |
- In the absence of 48 hours of historical data (e.g., during the first few days or following a long outage), a model with a 6-hour memory is used; this results in an error increase of approximately 0.2°C.
Frost, fog.
- Frost: air temperature ≤ 0°C.
- Potential frost: forecast 12-hour minimum ≤ 0.5°C (or ≤ 0.75°C if 48-hour historical data is unavailable). This method detects 73% of nights with frost, compared to 49% using the previous "hoarfrost" rule (air temperature ≤ 3°C and dew point ≤ 1°C). It does, however, produce a higher rate of false alarms (31% versus 19%). The previous rule remains in use until the forecast becomes available. - Fog: dew point depression ≤ 2 °C and relative humidity (RH) ≥ 90%, with no drop in pressure.
Details regarding the methods and validation figures can be found in TECHNIQUE.md.
Usage outside of France
The firmware is universal. When set to "Automatic," the GPS determines the appropriate wind alert model:
| Location | Model | Validated HSS |
|---|---|---|
| France, Corsica | France Model (based on 10 years of Météo-France data) | +0.20 |
| British Isles, Benelux, Germany, Scandinavia | Oceanic | +0.21 |
| Central Europe, Japan, North America | Continental | +0.21 |
| Iberian Peninsula, Italy | Mediterranean | +0.14 |
| Southern Brazil, Argentina | Subtropical | +0.13 |
| Tropics (|lat| < 23.5°) | No wind alerts | (+0.02: no reliable data) |
| Elsewhere | General model; flagged as "outside validated regions" | +0.15 |
These figures are derived from 10 years of data from 96 NOAA GHCNh and Météo-France stations. Each region was evaluated using a model trained on data excluding that specific region.
Southern Hemisphere. Seasons are automatically inverted.
Time zone. This is determined based on the region or, alternatively, the longitude. It can be adjusted on the settings page.
Rain and Zambretti. The rain and Zambretti models remain those trained in France; when used elsewhere, they should be considered indicative only. ---
Limitations
Things to keep in mind before relying on these alerts:
- This is an aid, not an official forecast. In the event of an official warning or alert issued by Météo-France, that official information takes precedence.
- Wind alerts:
- They provide advance notice for approximately 30% of wind events.
- About 4 out of 5 alerts are not followed by an actual significant wind event.
- While this is a clear improvement over the traditional "pressure drop" rule, it should be viewed as a "stay alert" signal rather than a definitive prediction.
- Thunderstorms and heavy rain: These cannot be predicted using only these sensors (HSS +0.03 and +0.07). Consequently, the station does not issue alerts for them.
- Summer and mountainous regions: Wind alerts are less reliable here. In summer, gusts are primarily associated with thunderstorms.
- Minimum temperature: Accurate within 1–2°C. The reading depends on the sensor's specific location (e.g., valley floor, sheltered area). Along the exposed Mediterranean coast (e.g., Cap Béar, Sète, Nice), the model tends to forecast temperatures that are 1–2°C too low.
- Fog: Based on empirical thresholds.
Python Tools
The outils/ (tools) directory allows for verifying and retraining models using real-world data. It requires Python 3 and numpy (pip install numpy). These tools work on both Linux and Windows.
| Tool | Purpose |
|---|---|
valider_alertes.py |
Trains and validates wind and rain models. Sources: Météo-France (--source meteofrance), NOAA GHCNh (--source ghcnh), or both (--source les-deux). Produces a .json file. |
ghcnh.py |
Selects and downloads GHCNh weather stations (prioritizing airports, ensuring good coverage and regional distribution). |
exporter_modele_vent.py |
Converts .json files into src/modele_vent.h for use in the firmware. |
valider_temperature.py |
Analysis: can the station predict the minimum temperature (for the following night/day, 12-hour window)? Compares results against persistence, climatology, and the Craddock-Pritchard formula. |
generer_pays.py |
Generates src/pays.h (containing country borders and ROCS presets) using data from Natural Earth. |
zambretti_test.py |
Performs the same calculations as the firmware: replay a CSV log, monitor the station via a serial port, or test using Open-Meteo data. |
station_virtuelle.py |
Simulates a weather station using Open-Meteo data—no physical hardware required. |
affinage.py |
Fine-tunes thresholds based on actual measurements from a specific station. |
Example: retraining and then exporting the wind model. cd outils python valider_alertes.py --deps etendu --pas 6 --vent-relatif 0.97 --sortie modele_france.json python valider_alertes.py --source les-deux --vent-relatif 0.97 --sortie modele_monde.json python exporter_modele_vent.py modele_france.json modele_monde.json ../src/modele_vent.h
Testing radio frames on a PC is described in TECHNIQUE.md.
License and Credits
License.
- Copyright © 2026 Arnaud Trybou (F4NLJ).
- This program is free software, licensed under the GNU General Public License v3.0 or later. See LICENSE.
- It is provided without any warranty. Do not use it for the safety of persons or property.
Data used for training and validation:
- Météo-France: observation data, under the Etalab Open License 2.0 (https://meteo.data.gouv.fr).
- NOAA NCEI: Global Historical Climatology Network hourly (GHCNh), public domain.
- Open-Meteo (https://open-meteo.com): reanalysis data, for the virtual station. Data licensed under CC BY 4.0.
- Zambretti forecast texts: based on Negretti & Zambra (1915).
Libraries, downloaded during compilation, each under its own license:
| Library | License |
|---|---|
| RadioLib (Jan Gromeš) | MIT |
| U8g2 (olikraus) | BSD 2-Clause |
| Adafruit BMP3XX, BMP280, BME280, SHT4x, SHT31 libraries | BSD / MIT |
| TinyGPSPlus (Mikal Hart) | LGPL 2.1 |
| Arduino-ESP32 (Espressif) | LGPL 2.1 / Apache 2.0 |
| libsodium (provided by ESP-IDF, ROCS encryption) | ISC |
Country borders (src/pays.h): Natural Earth 1:50m, public domain.
Radio compatibility. Frame formats are re-implemented for interoperability:
- Meshtastic: a trademark of Meshtastic LLC;
- MeshCore;
- ROCS.
This project is not affiliated with Meshtastic or MeshCore.
Regulations.
- 869.4–869.65 MHz band: 500 mW ERP maximum, 10% duty cycle.
- Default power and transmission rate comply with these limits. Please check the regulations of the country where the device is used.