I added pH monitoring to my reef tank for about $80. I bought a pH probe and the associated PCB from Atlas Scientific and integrated it into my reef tank controller using ESPHome and Home Assistant. My tank is pretty young and not fully stocked so you don’t see much variation in pH right now. At the time of writing this about the only thing consuming CO2 in the tank is nuisance algae.
Configuring ESPHome for the pH probe is pretty straightforward.
- I added a good bit of signal averaging and it could probably use a little more – it collects a measurement every 5 seconds and averages 60 measurements. That average is reported every 5 minutes.
- The attenuation is only necessary when using an ESP32. 6dB allows measuring up to 2.2V.
- The calibrate linear settings were determined by making some calibration solutions, letting the probe equilibrate in them, and then watching the logs to get the voltage. I used 6.86 and 9.18 pH solutions since I happened to have those on hand.
sensor:
#pH sensor
- platform: adc
pin: GPIO34
name: "Reef pH"
attenuation: 6db
unit_of_measurement: "pH"
update_interval: 5s
accuracy_decimals: 2
filters:
- calibrate_linear:
# Map 0.0 (from sensor) to 0.0 (true value)
- 1.68 -> 6.86
- 1.21 -> 9.18
- sliding_window_moving_average:
window_size: 60
send_every: 60
I shared the probe holder I made on thingiverse. It uses rectangular plastic coated magnets I purchased from K&G Magnetics.
Update:
I ended up adding an RC filter to the pH probe analog signal. This helped tremendously with noise. 100 kOhm and 10uF with a time constant of 2.3 seconds.