# vunhutien/chisage-modbus-v2 architecture

> Architecture diagram of the GitHub repository vunhutien/chisage-modbus-v2, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/vunhutien/chisage-modbus-v2
- Repository: https://github.com/vunhutien/chisage-modbus-v2

## Overview

##### Project type and purpose
- The project is an embedded firmware system running on an ESP8266 microcontroller. It serves to read Modbus data from an inverter via a MAX485 module and then expose a simple dashboard (accessible via a web browser) showing the inverter’s status.
- Its purpose primarily is to allow inverters (with Modbus support) to be monitored without needing a full Home Assistant installation.

##### File structure
- The file tree consists of only two files: README.md and chisage_basic.ino. This indicates that the project is a single sketch (firmware) for the ESP8266.
- The .ino file contains the actual code that sets up the WiFi connection, reads Modbus data, and serves the dashboard.

##### README for insights into architecture and connectivity
- The README details hardware connections between the ESP8266 and the MAX485 module, including the wiring for Modbus communication.
- The instructions also indicate that, once flashed, the ESP8266 is accessible on the network, providing a dashboard that indicates the inverter’s status.

a. Main components to include:
- ESP8266 Microcontroller running the chisage_basic.ino sketch.
- MAX485 Module that acts as the RS485 transceiver to handle Modbus communication.
- Inverter (Chisage ESS inverter) that is connected via the Modbus interface.
- USB power supply connection used to power the ESP8266.
- WiFi network which the ESP8266 uses to broadcast the web dashboard.
- (Optionally) the end-user’s web browser that interacts with the dashboard.

b. Relationships and interactions:

c. Architectural patterns and design principles:
- While the project is simple, the design emphasizes a tightly integrated hardware-software system embedded in a microcontroller.
- Separation of the communication layer (Modbus over RS485) and the presentation layer (web dashboard served over WiFi).

d. Relevant technologies:
- ESP8266 microcontroller (firmware written in Arduino style using the chisage_basic.ino file)
- MAX485 module for converting RS485 signals for Modbus communication.
- Modbus protocol (for inverter communication)
- WiFi connectivity and a lightweight web server on the ESP8266.
- USB as power supply.

## Diagram (Mermaid)

```mermaid
flowchart TD
    USB["USB Power Supply"]:::power
    MCU["ESP8266 (Firmware)"]:::microcontroller
    MAX485["MAX485 Module"]:::module
    Inverter["Chisage Inverter"]:::device
    WiFi["WiFi Network"]:::network
    Browser["User's Web Browser"]:::device
    Docs["Hardware & Wiring Documentation"]:::docs

    USB -->|"powers"| MCU
    MCU <-->|"serial_comm"| MAX485
    MAX485 -->|"Modbus_connection"| Inverter
    MCU -->|"connects"| WiFi
    WiFi -->|"access_dashboard"| Browser
    Docs -.->|"informs"| MCU

    click MCU "https://github.com/vunhutien/chisage-modbus-v2/blob/main/chisage_basic.ino"
    click Docs "https://github.com/vunhutien/chisage-modbus-v2/blob/main/README.md"

    classDef microcontroller fill:#f9e79f,stroke:#d35400,stroke-width:2px;
    classDef module fill:#aed6f1,stroke:#2471a3,stroke-width:2px;
    classDef device fill:#a9dfbf,stroke:#27ae60,stroke-width:2px;
    classDef network fill:#e8daef,stroke:#8e44ad,stroke-width:2px;
    classDef power fill:#fcf3cf,stroke:#f1c40f,stroke-width:2px;
    classDef docs fill:#d5f5e3,stroke:#1e8449,stroke-width:2px;
```
