1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
#+TITLE: FAPG DAQ system
#+AUTHOR: Marius PETER
#+DATE: <2026-06-27 Sat>
* Overview
The goal of this project is to deploy a DAQ network at the FAPG.
Sensor nodes periodically send readings to a central DAQ hub. An
external VPS obtains these readings, and displays them on a web
dashboard.
* Architecture
#+begin_src plantuml :file docs/architecture.png
@startuml
title FAPG DAQ - from reading to web dashboard
actor "Farm user/browser" as Browser
participant "EZO probe\npH / EC / DO / Redox" as Probe
participant "Pi Zero 2W\nfapg-daq service" as Zero
participant "Pi 5\nMosquitto MQTT broker" as Broker
participant "VPS\nMQTT subscriber service" as VPSSubscriber
database "Readings database\nSQLite / PostgreSQL" as DB
participant "VPS\nLive dashboard app" as Dashboard
== DAQ acquisition ==
Zero -> Probe : Request UART reading
Probe --> Zero : Return raw sensor value
Zero -> Zero : Normalize reading
== MQTT publication ==
Zero -> Broker : MQTT PUBLISH\nfapg/daq/<probe>/<node>/reading\nJSON payload
note right of Zero
Example payload:
{
"schema": "fapg.daq.reading.v1",
"node": "fapg-zero-ph-01",
"probe": "ph",
"value": 7.12,
"unit": "pH",
"timestamp": "2026-06-27T13:45:00Z"
}
end note
VPSSubscriber -> Broker : MQTT SUBSCRIBE\nfapg/daq/+/+/reading
Broker --> VPSSubscriber : MQTT MESSAGE\nreading topic + JSON payload
VPSSubscriber -> VPSSubscriber : Validate topic and payload\nparse probe, node, value, timestamp
== Database storage ==
VPSSubscriber -> DB : INSERT reading
DB --> VPSSubscriber : OK
== Live dashboard presentation ==
Browser -> Dashboard : Open HTTPS dashboard
Dashboard -> DB : SELECT recent readings
DB --> Dashboard : Return recent readings
Dashboard --> Browser : Initial HTML + Chart.js data
loop live updates
VPSSubscriber -> Dashboard : Notify new reading\nWebSocket / SSE / app event
Dashboard --> Browser : Push new reading\nWebSocket or Server-Sent Events
Browser -> Browser : Append point to Chart.js chart
end
@enduml
#+end_src
#+RESULTS:
[[file:docs/architecture.png]]
** Hosts
*** Raspberry Pi Zero 2W
These hosts collect DAQ readings, and publish them via MQTT on the
LAN.
| Pi Zero | Probe |
|---------+-------|
| 01 | PH |
| 02 | EC |
| 03 | DO |
| 04 | ORP |
*** Raspberry Pi 5
This host brokers MQTT messages sent on the LAN.
*** VPS
This host establishes a VPN connection with the Pi 5 host, subscribes
to all MQTT topics, saves messages to a database, and exposes a
realtime web dashboard available over the internet.
|