# aquatwix/ploughmeter architecture

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

- Interactive diagram: https://gitdiagram.com/aquatwix/ploughmeter
- Repository: https://github.com/aquatwix/ploughmeter

## Overview

Ploughmeter is an Arduino prototype for acquiring ploughing measurements, transmitting sensor frames over 169 MHz radio, and manually decoding and plotting received data. The documented workflow runs the board example, captures frames with Radiocrafts tools, copies frame/RSSI/timestamp data into the decoder input file, then runs the Python analysis. The embedded implementation and decoder are sampled; receiver-tool behavior and the example sketch internals are not, so those links reflect README documentation rather than inspected code.

Main entry points: [`decoder/main.py`](https://github.com/aquatwix/ploughmeter/blob/main/decoder/main.py) (Analysis runner), [`decoder/Functions.py`](https://github.com/aquatwix/ploughmeter/blob/main/decoder/Functions.py) (Analysis utilities), [`Ploughmeter-Library/Ploughmeter.cpp`](https://github.com/aquatwix/ploughmeter/blob/main/Ploughmeter-Library/Ploughmeter.cpp) (Sensor acquisition), [`decoder/Decoder.py`](https://github.com/aquatwix/ploughmeter/blob/main/decoder/Decoder.py) (Frame decoder)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_embedded["Embedded acquisition"]
  node_example["Board example"]
  node_sensors{{"Sensor suite"}}
  node_ploughmeter["Sensor acquisition<br/>[Ploughmeter.cpp]"]
  node_frame["Frame encoder<br/>[Ploughmeter.cpp]"]
end

subgraph group_radio["Radio transport"]
  node_modem["RF modem"]
  node_receiver["Receiver modem"]
  node_radiocrafts["MBUS tools"]
end

subgraph group_analysis["Offline analysis"]
  node_datafile["Frame input<br/>[dataframe.txt]"]
  node_main["Analysis runner<br/>[main.py]"]
  node_decoder["Frame decoder<br/>[Decoder.py]"]
  node_functions["Analysis utilities<br/>[Functions.py]"]
end

subgraph group_visualization["Analysis output"]
  node_series[("Sensor series<br/>[main.py]")]
  node_plots["Plots<br/>[Functions.py]"]
end

node_operator(("Operator"))

node_operator -.->|"runs on board"| node_example
node_sensors -->|"provides readings"| node_ploughmeter
node_ploughmeter -->|"encodes readings"| node_frame
node_frame -->|"sends serial frame"| node_modem
node_modem -->|"transmits by RF"| node_receiver
node_receiver -->|"captures frames"| node_radiocrafts
node_operator -->|"collects data"| node_radiocrafts
node_radiocrafts -->|"manual entry"| node_datafile
node_operator -->|"runs analysis"| node_main
node_main -->|"reads input"| node_functions
node_functions -->|"reads frames"| node_datafile
node_main -->|"decodes frames"| node_decoder
node_decoder -->|"checks CRC/converts"| node_functions
node_main -->|"collects valid readings"| node_series
node_main -->|"plots sensor series"| node_functions
node_functions -->|"renders charts"| node_plots
node_main -->|"plots RSSI"| node_plots

click node_example "https://github.com/aquatwix/ploughmeter/blob/main/Ploughmeter-Library/examples/Ploughmeter_example/Ploughmeter_example.ino"
click node_ploughmeter "https://github.com/aquatwix/ploughmeter/blob/main/Ploughmeter-Library/Ploughmeter.cpp"
click node_frame "https://github.com/aquatwix/ploughmeter/blob/main/Ploughmeter-Library/Ploughmeter.cpp"
click node_datafile "https://github.com/aquatwix/ploughmeter/blob/main/decoder/dataframe.txt"
click node_main "https://github.com/aquatwix/ploughmeter/blob/main/decoder/main.py"
click node_decoder "https://github.com/aquatwix/ploughmeter/blob/main/decoder/Decoder.py"
click node_functions "https://github.com/aquatwix/ploughmeter/blob/main/decoder/Functions.py"
click node_series "https://github.com/aquatwix/ploughmeter/blob/main/decoder/main.py"
click node_plots "https://github.com/aquatwix/ploughmeter/blob/main/decoder/Functions.py"

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_example,node_sensors,node_ploughmeter,node_frame toneBlue
class node_modem,node_receiver,node_radiocrafts toneAmber
class node_datafile,node_main,node_decoder,node_functions toneMint
class node_series,node_plots toneRose
class node_operator toneIndigo
```

## Components

### Embedded acquisition

- [Board example](https://github.com/aquatwix/ploughmeter/blob/main/Ploughmeter-Library/examples/Ploughmeter_example/Ploughmeter_example.ino): `Ploughmeter-Library/examples/Ploughmeter_example/Ploughmeter_example.ino`
- **Sensor suite**
- [Sensor acquisition](https://github.com/aquatwix/ploughmeter/blob/main/Ploughmeter-Library/Ploughmeter.cpp): `Ploughmeter-Library/Ploughmeter.cpp`
- [Frame encoder](https://github.com/aquatwix/ploughmeter/blob/main/Ploughmeter-Library/Ploughmeter.cpp): `Ploughmeter-Library/Ploughmeter.cpp`

### Radio transport

- **RF modem**
- **Receiver modem**
- **MBUS tools**

### Offline analysis

- [Frame input](https://github.com/aquatwix/ploughmeter/blob/main/decoder/dataframe.txt): `decoder/dataframe.txt`
- [Analysis runner](https://github.com/aquatwix/ploughmeter/blob/main/decoder/main.py): `decoder/main.py`
- [Frame decoder](https://github.com/aquatwix/ploughmeter/blob/main/decoder/Decoder.py): `decoder/Decoder.py`
- [Analysis utilities](https://github.com/aquatwix/ploughmeter/blob/main/decoder/Functions.py): `decoder/Functions.py`

### Analysis output

- [Sensor series](https://github.com/aquatwix/ploughmeter/blob/main/decoder/main.py): `decoder/main.py`
- [Plots](https://github.com/aquatwix/ploughmeter/blob/main/decoder/Functions.py): `decoder/Functions.py`

### Other components

- **Operator**

## Connections

- Operator → Board example: runs on board (evidence: `README.md`)
- Sensor suite → Sensor acquisition: provides readings (evidence: `Ploughmeter-Library/Ploughmeter.cpp`)
- Sensor acquisition → Frame encoder: encodes readings (evidence: `Ploughmeter-Library/Ploughmeter.cpp`)
- Frame encoder → RF modem: sends serial frame (evidence: `Ploughmeter-Library/Ploughmeter.cpp`)
- RF modem → Receiver modem: transmits by RF (evidence: `README.md`)
- Receiver modem → MBUS tools: captures frames (evidence: `README.md`)
- Operator → MBUS tools: collects data (evidence: `README.md`)
- MBUS tools → Frame input: manual entry (evidence: `README.md`)
- Operator → Analysis runner: runs analysis (evidence: `README.md`)
- Analysis runner → Analysis utilities: reads input (evidence: `decoder/main.py`)
- Analysis utilities → Frame input: reads frames (evidence: `decoder/Functions.py`)
- Analysis runner → Frame decoder: decodes frames (evidence: `decoder/main.py`)
- Frame decoder → Analysis utilities: checks CRC/converts (evidence: `decoder/Decoder.py`)
- Analysis runner → Sensor series: collects valid readings (evidence: `decoder/main.py`)
- Analysis runner → Analysis utilities: plots sensor series (evidence: `decoder/main.py`)
- Analysis utilities → Plots: renders charts (evidence: `decoder/Functions.py`)
- Analysis runner → Plots: plots RSSI (evidence: `decoder/main.py`)
