# jake-herrera/weather-station-firmware architecture

> Architecture diagram of the GitHub repository jake-herrera/weather-station-firmware, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jake-herrera/weather-station-firmware
- Repository: https://github.com/jake-herrera/weather-station-firmware

## Overview

This is ESP32 weather-station firmware: it connects to Wi-Fi, samples a BME280, and periodically POSTs readings to a backend. The firmware entry point coordinates these stages; the sensor and network services provide the internal acquisition and transport layers. The README documents the workflow, but the entry-point source and configuration values are not in the tree, so those orchestration links rely on README evidence.

Main entry points: [`weather-station-firmware.ino`](https://github.com/jake-herrera/weather-station-firmware/blob/main/weather-station-firmware.ino) (Firmware loop), [`sensor_service.cpp`](https://github.com/jake-herrera/weather-station-firmware/blob/main/sensor_service.cpp) (Sensor service), [`wifi_service.cpp`](https://github.com/jake-herrera/weather-station-firmware/blob/main/wifi_service.cpp) (Wi-Fi service), [`api_service.cpp`](https://github.com/jake-herrera/weather-station-firmware/blob/main/api_service.cpp) (HTTP API service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_orchestration["Device orchestration"]
  node_firmware["Firmware loop"]
  node_config["Shared config<br/>[config.h]"]
end

subgraph group_acquisition["Sensor acquisition"]
  node_sensor["Sensor service<br/>[sensor_service.cpp]"]
  node_reading["Reading model<br/>[sensor_service.h]"]
  node_bme280["BME280 sensor"]
end

subgraph group_connectivity["Connectivity and API"]
  node_wifi["Wi-Fi service<br/>[wifi_service.cpp]"]
  node_api["HTTP API service<br/>[api_service.cpp]"]
end

node_wifi_network(("Wi-Fi network"))
node_backend["Weather backend"]

node_firmware -->|"connects through"| node_wifi
node_firmware -->|"initializes and reads"| node_sensor
node_firmware -->|"sends readings"| node_api
node_firmware -->|"uses send interval"| node_config
node_sensor -->|"reads over I2C"| node_bme280
node_sensor -->|"produces"| node_reading
node_wifi -->|"reads credentials"| node_config
node_wifi -->|"connects to"| node_wifi_network
node_api -->|"reads endpoint and ID"| node_config
node_api -->|"POSTs reading"| node_backend

click node_firmware "https://github.com/jake-herrera/weather-station-firmware/blob/main/weather-station-firmware.ino"
click node_config "https://github.com/jake-herrera/weather-station-firmware/blob/main/config.h"
click node_sensor "https://github.com/jake-herrera/weather-station-firmware/blob/main/sensor_service.cpp"
click node_reading "https://github.com/jake-herrera/weather-station-firmware/blob/main/sensor_service.h"
click node_wifi "https://github.com/jake-herrera/weather-station-firmware/blob/main/wifi_service.cpp"
click node_api "https://github.com/jake-herrera/weather-station-firmware/blob/main/api_service.cpp"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_firmware,node_config toneBlue
class node_sensor,node_reading,node_bme280 toneAmber
class node_wifi,node_api toneMint
class node_wifi_network,node_backend toneIndigo
```

## Components

### Device orchestration

- [Firmware loop](https://github.com/jake-herrera/weather-station-firmware/blob/main/weather-station-firmware.ino): `weather-station-firmware.ino`
- [Shared config](https://github.com/jake-herrera/weather-station-firmware/blob/main/config.h): `config.h`

### Sensor acquisition

- [Sensor service](https://github.com/jake-herrera/weather-station-firmware/blob/main/sensor_service.cpp): `sensor_service.cpp`
- [Reading model](https://github.com/jake-herrera/weather-station-firmware/blob/main/sensor_service.h): `sensor_service.h`
- **BME280 sensor**

### Connectivity and API

- [Wi-Fi service](https://github.com/jake-herrera/weather-station-firmware/blob/main/wifi_service.cpp): `wifi_service.cpp`
- [HTTP API service](https://github.com/jake-herrera/weather-station-firmware/blob/main/api_service.cpp): `api_service.cpp`

### Other components

- **Wi-Fi network**
- **Weather backend**

## Connections

- Firmware loop → Wi-Fi service: connects through (evidence: `README.md`)
- Firmware loop → Sensor service: initializes and reads (evidence: `README.md`)
- Firmware loop → HTTP API service: sends readings (evidence: `README.md`)
- Firmware loop → Shared config: uses send interval (evidence: `README.md`)
- Sensor service → BME280 sensor: reads over I2C (evidence: `sensor_service.cpp`)
- Sensor service → Reading model: produces (evidence: `sensor_service.cpp`)
- Wi-Fi service → Shared config: reads credentials (evidence: `wifi_service.cpp`)
- Wi-Fi service → Wi-Fi network: connects to (evidence: `README.md`)
- HTTP API service → Shared config: reads endpoint and ID (evidence: `api_service.cpp`)
- HTTP API service → Weather backend: POSTs reading (evidence: `README.md`)
