pH Measurement, has anyone got this right?

Hi guys, I’ve been looking on an off for the past 4 months for a way to measure pH and get that data accurately into home assistant. I don’t know arduino that well but if someone can tell me everything I need to get and provide me with the relevant code I’ll be able to figure it out. Otherwise something that integrates simply into HA would be fantastic of course.

If this has been done and I’m just not able to find the thread please point me in the right direction, thanks everyone!

Some time ago I did look into installing a pH sensor into my swimming pool, and would have connected that to an ESP. However, I couldn’t find any affordable pH sensors that would not require regular calibration - either the sensor is industrial grade, costs hundreds of dollars and does not require to be recalibrated all the time, or the sensor is cheap(-er) but would require a recalibration before every single use which involves sticking the sensor into 2-3 water probes with known pH value. This is of course not feasible in a static swimming pool installation.
So, I shelved this idea for now…

1 Like

Not encouraging…I ran into this same issue trying to put a TDS sensor together.

I have some experience doing this exct thing, and although manufacturers specify calibration before each measuring cycle, this is only indicated for laboratory grade accuracy. For keeping track of pool pH a regular E-201 probe should be OK. These can be had for 5-10 USD at your preferred chinese supplier. For reasonable accuracy it should be calibrated at least once every 2 months, although once a month is preferrable. You will also need to replace the probe once it starts aging as the response will become slower over time. In my experience, you should expect to go through a probe a year depending on your conditions.

To get the data into a useful format you will require an amplifier as the probes deliver very low current. These can also be had from chinese suppliers, although my recommendation is going for an Atlas Scientific device as my experience with them have been very good. Along with the pH circuit you will need to galvanically isolate it, which they also have a module for, together these two are somewhere in the region of 70USD.

As for integrating it with Home Assistant, Atlas provides some code to get the values into the microcontroller, after tht you will need to add some extra sauce to get the rest of the way. My recommendation would be to grab the code from Atlas and edit it into an MQTT example for an ESP32 or Esp8266 and then grab the MQTT data in HA.

Hope this is helpful:)


I have released a Swimmig Pool Automation System based on raspberry pi + HA that has a component to measure pH, based on the Atlas Scientific EZO circuit.

1 Like

Does that little board go directly into water or is there exterior probe that must be attached

Atlas Scientific EZO-pH Embedded pH Circuit .001-14

Look like exterior probe

Ahh this looks promising, I will look into it as soon as possible. Good work! :slight_smile:

The pH cirtuit has to be inside a board (carrier board) to comunicate with de rpi (via UART or USB-UART). The pH probe (electrode) has to be inside water, and conected to de carrier board with a BNC cable.
Im going to include a picture in wiki of github project.

Maybe you’ve got this done by now, but I use an ESP32 with ESPHome to do pH and TDS for my hot tub using cheap sensors.

Here’s the schematic I finally wound up with:


How often you need to replace sensors?

Dunno, only had it running for a few months now. But commercial sensors using the same technology are recommended to replace every 3-5 years. This sensor was C$35 so if I get a year out of it I’m happy!

glbaily, is that a kit or something you put together yourself? This is something I want to do with our hot tub, and you’ve got a super clean looking setup!

All home baked except the probes and the TDS sensor. I think DFRobot has a pH probe with sensor electronics prebuilt, instead of building your own from scratch. So their TDS module and the pH probe module with an ESP32 is all that is needed. Plus a bit of creative plumbing to tap into the recirculation line of the tub and back into the tub. Plus a bit of 3D printing for case and brackets.