pH alarm for a hydroponic tank that swings every time the dosing pump runs
Our student society runs a small hydroponic rig (NFT, lettuce and basil). Pi 4 with Atlas Scientific EZO pH and EC circuits on I2C, readings every 30 s to Hermetry as ph and ec_ms.
Two problems. First, the pH readings jump by 0.3-0.4 whenever the EC probe is in the tank, take the EC probe out and pH is steady. Second, I want an alarm when pH leaves 5.5 to 6.5. I tried a threshold rule with ph < 5.5 and it works, but then I don’t see how to also do above 6.5 in the same rule, and when the dosing pump adds pH down the reading dips for a minute and the alarm fires for nothing.
The pH jumping with the EC probe in is a ground loop. Both EZO circuits share the Pi’s ground and the EC probe drives current through the water, which shifts the pH reference. Atlas sells an isolated carrier board for exactly this, put at least one of the two on it.
I’m still learning this stuff, but I set up the same kind of alarm for the pool chemistry at our hotel, so I can do the second half.
There’s no “between” in alarm conditions, you write it as a group. The form does one comparison per severity, so switch the rule to JSON mode:
"severities": [
{ "severity": "MAJOR",
"condition": { "any": [
{ "key": "ph", "op": "<", "value": 5.5 },
{ "key": "ph", "op": ">", "value": 6.5 } ] } }
],
"debounce": { "mode": "duration", "raise": 300, "clear": 60 },
"hysteresis": 0.1
The duration debounce is what stops the dosing dip. The condition has to be true for 300 seconds by the device’s own timestamps before the alarm opens. Our chlorine dose dip lasts about two minutes, so 5 minutes was safe. Since you report every 30 s that’s ten readings in a row, plenty.
Hysteresis 0.1 means it clears at 5.6 or above on the low side, 6.4 or below on the high side, so it doesn’t flap at the edge.
All of this is on Alarm conditions reference, and the debounce part on the page next to it.
Both fixed. The society bought the isolated carrier for the pH circuit and the 0.3 jumps are gone. The JSON rule with the any group saved fine, and the pump ran three times today without a single alarm. Then I dropped the probe in pH 4 buffer to test and it opened after five minutes, as expected.
- Bu konuyu yanıtlamak için giriş yapmış olmalısınız.
Sohbete katılın
Soru sormak ve yanıtlamak, yararlı gönderileri beğenmek ve sorununuzu çözen yanıtı işaretlemek için oturum açın. Her katkı puan ve seviye kazandırır.

