# laskakit/esplan architecture

> Architecture diagram of the GitHub repository laskakit/esplan, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/laskakit/esplan
- Repository: https://github.com/laskakit/esplan

## Overview

ESPlan v2.1 is an industrial ESP32 development board; the README documents its power, wired networking, RS485, storage, and expansion interfaces. The repository also includes firmware examples for relay control and weather/wind sensing. The sampled Modbus implementations show RS485 serial transactions, but the example entry points’ wiring to their helpers was not excerpted, so those calls are not asserted. Hardware relationships below follow the README; firmware relationships are limited to those visible in sampled source.

Main entry points: [`SW/ESPlan_RS485_Relay/mb_client.cpp`](https://github.com/laskakit/esplan/blob/main/SW/ESPlan_RS485_Relay/mb_client.cpp) (Relay Modbus client), [`SW/ESPlan_WeatherStation/mb_client.cpp`](https://github.com/laskakit/esplan/blob/main/SW/ESPlan_WeatherStation/mb_client.cpp) (Weather Modbus client), [`SW/ESPlan_ZTS3000_WindSensor/mb_client.cpp`](https://github.com/laskakit/esplan/blob/main/SW/ESPlan_ZTS3000_WindSensor/mb_client.cpp) (Wind Modbus client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_board["Board hardware"]
  node_usb["USB-C power"]
  node_terminal["Terminal power"]
  node_poe["Optional PoE module"]
  node_power["Power rails"]
  node_esp32["ESP32 module"]
end

subgraph group_interfaces["Connectivity and expansion"]
  node_lan["Ethernet PHY"]
  node_rs485["RS485 transceiver"]
  node_sd["microSD interface"]
  node_expansion["I²C, SPI, GPIO"]
end

subgraph group_firmware["Firmware examples"]
  node_relay_app["Relay firmware"]
  node_weather_app["Weather firmware"]
  node_wind_app["Wind firmware"]
end

subgraph group_drivers["Firmware drivers"]
  node_relay_ops["Relay operations<br/>[relay.cpp]"]
  node_weather_sensors["Weather sensor logic<br/>[snr.cpp]"]
  node_wind_sensors["Wind sensor logic<br/>[snr.cpp]"]
  node_relay_modbus["Relay Modbus client<br/>[mb_client.cpp]"]
  node_weather_modbus["Weather Modbus client<br/>[mb_client.cpp]"]
  node_wind_modbus["Wind Modbus client<br/>[mb_client.cpp]"]
end

node_user(("Integrator"))
node_field(("Field devices"))

node_user -->|"integrates"| node_esp32
node_usb -->|"supplies 5V"| node_power
node_terminal -->|"steps down"| node_power
node_poe -->|"feeds converter"| node_power
node_power -->|"powers"| node_esp32
node_esp32 -->|"connects Ethernet"| node_lan
node_esp32 -->|"connects RS485"| node_rs485
node_field -->|"exchanges bus data"| node_rs485
node_esp32 -->|"uses SPI"| node_sd
node_esp32 -->|"exposes interfaces"| node_expansion
node_relay_modbus -->|"writes serial frames"| node_rs485
node_weather_modbus -->|"writes serial frames"| node_rs485
node_wind_modbus -->|"writes serial frames"| node_rs485

click node_relay_app "https://github.com/laskakit/esplan/blob/main/SW/ESPlan_RS485_Relay/ESPlan_RS485_Relay.ino"
click node_weather_app "https://github.com/laskakit/esplan/blob/main/SW/ESPlan_WeatherStation/ESPlan_WeatherStation.ino"
click node_wind_app "https://github.com/laskakit/esplan/blob/main/SW/ESPlan_ZTS3000_WindSensor/ESPlan_ZTS3000_WindSensor.ino"
click node_relay_ops "https://github.com/laskakit/esplan/blob/main/SW/ESPlan_RS485_Relay/relay.cpp"
click node_weather_sensors "https://github.com/laskakit/esplan/blob/main/SW/ESPlan_WeatherStation/snr.cpp"
click node_wind_sensors "https://github.com/laskakit/esplan/blob/main/SW/ESPlan_ZTS3000_WindSensor/snr.cpp"
click node_relay_modbus "https://github.com/laskakit/esplan/blob/main/SW/ESPlan_RS485_Relay/mb_client.cpp"
click node_weather_modbus "https://github.com/laskakit/esplan/blob/main/SW/ESPlan_WeatherStation/mb_client.cpp"
click node_wind_modbus "https://github.com/laskakit/esplan/blob/main/SW/ESPlan_ZTS3000_WindSensor/mb_client.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_usb,node_terminal,node_poe,node_power,node_esp32 toneBlue
class node_lan,node_rs485,node_sd,node_expansion toneAmber
class node_relay_app,node_weather_app,node_wind_app toneMint
class node_relay_ops,node_weather_sensors,node_wind_sensors,node_relay_modbus,node_weather_modbus,node_wind_modbus toneRose
class node_user,node_field toneIndigo
```

## Components

### Board hardware

- **USB-C power**
- **Terminal power**
- **Optional PoE module**
- **Power rails**
- **ESP32 module**

### Connectivity and expansion

- **Ethernet PHY**
- **RS485 transceiver**
- **microSD interface**
- **I²C, SPI, GPIO**

### Firmware examples

- [Relay firmware](https://github.com/laskakit/esplan/blob/main/SW/ESPlan_RS485_Relay/ESPlan_RS485_Relay.ino): `SW/ESPlan_RS485_Relay/ESPlan_RS485_Relay.ino`
- [Weather firmware](https://github.com/laskakit/esplan/blob/main/SW/ESPlan_WeatherStation/ESPlan_WeatherStation.ino): `SW/ESPlan_WeatherStation/ESPlan_WeatherStation.ino`
- [Wind firmware](https://github.com/laskakit/esplan/blob/main/SW/ESPlan_ZTS3000_WindSensor/ESPlan_ZTS3000_WindSensor.ino): `SW/ESPlan_ZTS3000_WindSensor/ESPlan_ZTS3000_WindSensor.ino`

### Firmware drivers

- [Relay operations](https://github.com/laskakit/esplan/blob/main/SW/ESPlan_RS485_Relay/relay.cpp): `SW/ESPlan_RS485_Relay/relay.cpp`
- [Weather sensor logic](https://github.com/laskakit/esplan/blob/main/SW/ESPlan_WeatherStation/snr.cpp): `SW/ESPlan_WeatherStation/snr.cpp`
- [Wind sensor logic](https://github.com/laskakit/esplan/blob/main/SW/ESPlan_ZTS3000_WindSensor/snr.cpp): `SW/ESPlan_ZTS3000_WindSensor/snr.cpp`
- [Relay Modbus client](https://github.com/laskakit/esplan/blob/main/SW/ESPlan_RS485_Relay/mb_client.cpp): `SW/ESPlan_RS485_Relay/mb_client.cpp`
- [Weather Modbus client](https://github.com/laskakit/esplan/blob/main/SW/ESPlan_WeatherStation/mb_client.cpp): `SW/ESPlan_WeatherStation/mb_client.cpp`
- [Wind Modbus client](https://github.com/laskakit/esplan/blob/main/SW/ESPlan_ZTS3000_WindSensor/mb_client.cpp): `SW/ESPlan_ZTS3000_WindSensor/mb_client.cpp`

### Other components

- **Integrator**
- **Field devices**

## Connections

- Integrator → ESP32 module: integrates (evidence: `README.md`)
- USB-C power → Power rails: supplies 5V (evidence: `README.md`)
- Terminal power → Power rails: steps down (evidence: `README.md`)
- Optional PoE module → Power rails: feeds converter (evidence: `README.md`)
- Power rails → ESP32 module: powers (evidence: `README.md`)
- ESP32 module → Ethernet PHY: connects Ethernet (evidence: `README.md`)
- ESP32 module → RS485 transceiver: connects RS485 (evidence: `README.md`)
- Field devices → RS485 transceiver: exchanges bus data (evidence: `README.md`)
- ESP32 module → microSD interface: uses SPI (evidence: `README.md`)
- ESP32 module → I²C, SPI, GPIO: exposes interfaces (evidence: `README.md`)
- Relay Modbus client → RS485 transceiver: writes serial frames (evidence: `SW/ESPlan_RS485_Relay/mb_client.cpp`)
- Weather Modbus client → RS485 transceiver: writes serial frames (evidence: `SW/ESPlan_WeatherStation/mb_client.cpp`)
- Wind Modbus client → RS485 transceiver: writes serial frames (evidence: `SW/ESPlan_ZTS3000_WindSensor/mb_client.cpp`)
