PH Sensor (not working properly / Voltage just stable)

Hello Forum,
I googled a lot and couldn’t find any good knowledge about the AliExpress ph sensor with esp32 boards and home assistant. First I will sum up what I could find out and then I ask you all of it for help :wink:

Alright here we go: Well the Aliexpress PH sensor works with 2-5V and the Output from the Sensor is also a 0-5V Range. This means you can’t use the ESP32 Analog Pins and need to use a AnalogtoDigital Converter. I used a ADS1115 BreakoutBoard (ADS1115 Sensor — ESPHome) cause there is also Documentation on the ESPHome Website. The communication works via i2c.

So I connected everything the right way and getting some signal, but the voltage is stable at 4.931V. If I out the PH probe into water it should actually read 2.5V, but it doesn’t.

Now I have no idea what’s wrong. Somebody had that same issue once?

Thank you and greetings!

There are hundreds of aliexpress ph sensors. Be specific please.

Hello!
This is the one!

Sure you can. You just put the signal through a voltage divider composed of two resistors that divides 5V down to to 3.3V.

Though the ESP32 ADC is non-linear at the extremes of its range (near 0 and 3.3V) so you may be better off with an external ADC.

My guess would be that you have not.

Yeah I know you can but as you said because of the non linear extremes and the resolution it’s better to use the ADC. Ok well I think at least I connected it the right way and I used a lot of different source to double check but I will sketch you my setup real quick (maybe im missing something):

First here is the code:

i2c:
  sda: 21
  scl: 22
  scan: true
  id: bus_a
  
ads1115:
  - address: 0x48

# Temp Sensor
dallas:
  - pin: GPIO23

sensor:
  - platform: dallas
    address: 0x8b3c01a816b52728
    name: "Temperature Sensor"

  - platform: dht
    pin: 2
    temperature:
      name: "DHT11 Temperature"
    humidity:
      name: "DHT11 Humidity"
    update_interval: 60s
    
  - platform: adc
    pin: A4
    id: tds
    name: "TDS Sensor"
    update_interval: 5s
    unit_of_measurement: ppm
    accuracy_decimals: 1
    filters:
      - calibrate_linear:
        - 0.0 -> 0
        - 0.42 -> 457

    
#PH SENSOR
  - platform: ads1115
    multiplexer: 'A0_GND'
    gain: 6.144
    name: "ADS1115 Channel A0-GND"
    update_interval: 5s

    
# LED Dimmer
output:
  - platform: ledc
    pin: 19
    frequency: 1220HZ
    inverted: true
    id: growlight_pwm
    channel: 0
    
light:
  - platform: monochromatic
    name: "White GrowLight"
    output: growlight_pwm
    gamma_correct: 1.0
    
    
# Relais
switch:
  - platform: gpio
    pin: 25
    name: "Relais Growlight"
    inverted: yes
  - platform: gpio
    pin: 15
    name: "Relais Growlight"
    inverted: yes

With this code I get readings in my HA and when I plug the Voltage Output of the PH Board to the 2.5V Source I get 3.xxV readings. So I recognises the change at least.

My Hardware setup:

Hope I explained it good enough :slight_smile:

one extra note: the schematic form the PH Board with the real board does not match. The schematic has 7 pins but the real one only 6. the schematic is the one on their AliExpress site.

Please post your code properly. ``` before and after.

I updated the code now! Thank you :slight_smile:

1 Like

hi, I’m doing the same project but with ESP8266, in my case the voltage variation goes from 3,2v to 3,8v measuring in continuous, I don’t know if it is normal or not… Do you have the same variation? did you write the calibration to put as PH?

I am using this exact same sensor with an ESP32. I am using a simple voltage divider circuit to bring the signal down to 0 - 3.3V. I have even managed to calibrate the sensor but it gives incorrect values for different solutions.

Yes I have experienced it to fluctuate alot.

i’ve read that ADS1115 compare Ax Input voltages with its VCC voltage.
Because of this, if your ESP Vin is not stable, then measurement will have variation issues.
It is recommanded to place a 0.1µF capacitor between gnd and VCC pins.
see the ADS1115 datasheet on page5 last line of the table :

Did u got any solution

Hello, maybe this will help somebody who is struggling with big fluctuation…

I have used before also PH4502C board with pH probe from Aliexpress and that gave me results like described here:

Now I switched to DFRobot Gravity Analog pH Sensor and results are awesome:

Fluctuation is only about 0,05 pH which is very accurate…
To be clear I’m using it with ESP32 and ADS1115 (with 0.1µF capacitor between GND and VCC as hinted above).

More info about DFRobot Gravity Analog pH Sensor here:

Recommend it for you all :slight_smile:

1 Like