Abnormal ph sensor analog input value

userHead Hiroto.Akiyama 2023-08-28 09:51:16 624 Views6 Replies

Abnormal ph sensor analog input value


With reference to the link below, I connected the ph sensor to the ESP32 and used the sample program almost as it was, but tap water (Japan)
has a pH of 36. The analog input value is quite high even when the sensor is not connected. What should I do?

↓Reference link


2023-08-30 18:45:54


I have just noticed that you are using the SEN0161 sensor, and the sample code on the wiki is for Arduino.

So you need to change some parameter of the sample code.

Because the 5.0 is the ADC reference voltage for Arduino, and on ESP32 the ADC reference voltage is 3.3V

As for the 1024, this is because the ADC on the Arduino is 10 bit(2^10=1024), while the ADC on the ESP32 is 12 bit(2^12=4096)


Hope this suggestion could be helpful.

userHeadPic Yeez_B
Hiroto.Akiyama wrote:

Thank you for your reply.  I'll try it and see if it works.

2023-09-12 08:40:26
Hiroto.Akiyama wrote:

The ph sensor itself is connected to the 5V pin of the esp32 (actually outputs about 4.8V), but I wrote it with 3.3/4096. As a result, the pH of tap water was about 6.81, but is this a correct result? When I tried running it with 4.8/4096, the pH of tap water was about 9.97.

2023-09-13 15:14:07
KenMullins wrote:

Hi Yeez_B

I am also having issues with the probe. I'm using a firebeetle ESP32 with an Gravity I/O Expansion Shield - FireBeetle Covers (3.3v). I have changed the code as suggested above and set the offset for the PH4 solution to 1.38 and get PH 4.0 when the probe is in a PH4 solution. But when I move it to a PH7.0 solution it only reads 5.27 :-( I do rinse it when moving between the 2 PH solutions.

I don't know if I'm doing something wrong or if the probe is damaged as there was very little/no water covering the sensor in the enclosure when I received it.

Any ideas?

2023-11-01 15:04:40
3 Replies
2023-08-28 14:43:32

Hello Hiroto,

For connecting esp32 with the pH sensor, you could try to calibrate it first. You can refer to the following video.


userHeadPic xingzhao.zhu
Hiroto.Akiyama wrote:

Thank you for your reply.Since the analog input value of the probe terminal source is originally a large value, I do not know if this method will improve it well, but I will try it.

2023-08-30 07:50:54
1 Replies