# Calibration Problem pH-4502C with ESP32

Hello everyone,
I am an absolute beginner at programming.
little research on my thesis I got the pH-sensor = PH-4502C. I try this module for monitoring and controlling pH on my project, but I can't calibration this module.
in advance, I used DOIT ESP32 DEVKIT V1 as a microcontroller
with this wiring :
3v3 to V+
GND to GND
D35 to Po
I used the following code to measure the pH:

``````int pHSense = 35;
int samples = 10;

void setup()
{
Serial.begin(9600);
delay(100);
Serial.println("pH Sense");
}

float ph (float voltage) {
return 7 + ((2.50 - voltage) / 0.18);
}

void loop()
{
int measurings=0;

for (int i = 0; i < samples; i++)
{
delay(10);

}

float voltage = 3.3 / adc_resolution * measurings/samples;
Serial.print("pH= ");
Serial.println(ph(voltage));
delay(1000);
}
``````

Before measurement, I've tried to calibrate PH-4502C.
Therefore I used the following sketch:

``````int pH_Value;
float Voltage;

void setup()
{
Serial.begin(9600);
pinMode(pH_Value, INPUT);
}

void loop()
{
Voltage = pH_Value * (3.3 / 4095.0);
Serial.println(Voltage);
delay(500);
}
``````

You have to put the pH-electrode in a calibration liquid with pH = 7,00. Then you have to adjust the offset potentiometer of PH-4502C until P0 measures 2.5V: Arduino pH-meter using PH-4502C In this case I used D35 pin

My Problem :
When I do this D35-reading while turning the potentiometer, sometimes the values don’t go down to 2.5V. They just stop at 2.52V or something, even if I am still turning the screw. With a 2.52V, I took measurements on distilled water, and the result did not show pH = 7,00 as the following image below :

And I took measurements with the pH 6.86 @ 25° C buffer,
the results show as the following image below :

Does anyone know that problem? I am glad about any help. Thank you!

I will take a SWAG since I do not have one of these I did some quick checking and found this. It shows that it needs 5V and the data with it says the same thing. I checked several locations and they all showed this:
DO – 3.3V pH limit trigger
PO – PH analog output
Gnd – Gnd for PH probe
Gnd – Gnd for board
VCC – 5V DC
Try it with 5V and let us know.

Hello gilshultz,
Thank you for your quick reply. Can you recommend a certain power source? I was trying to use Vin on DOIT ESP32 DEVKIT V1 and powering my board via the USB port.

"Vin means you can power the board from that pin, when you dont use USB power, so when you power your board via the USB port, you will have 5V on the Vin pin and I have used it to power some motor driver modules without any problem." -ESP32 VIN pin as 5V output

And the result, worse than my expectation :

Personally I use Vin whenever possible, the additional filtering etc helps. I am very leary of 5V power with wire leads, they are sensitive to noise. The Vin pin is generally for a voltage higher than the operating voltage of the Arduino. A UNO you can connect it to +12 and the onboard regulator will reduce it to the 5V and 3.3 volts the board uses. If you read further into your link you will find this: The VIN pin is only labeled as VIN, there is nowhere saying it could be used as output and assume it's for 5V input purpose." Your board is rated for an Input Voltage of: 7-12V. You can use a wall wart to power your board. A 9V would work great but you can use up to 12V. Remember an Arduino a Power Supply it is NOT!

Okay, I'm going to use this converter logic immediately to get 5V and I will give an update later. Thanks in advance for your reply, I really appreciate it

I am not familiar with this one but it should work and do what you need. If you posted a link to the technical specifications I would know for sure.

I think I know where is my problem. The voltage generated by pH 4.01 and pH 6.86 shows the same value, that's why I can't determine the upper and lower limit of the voltage value. hmm, is my probe damaged?

It sounds like it might be. Was it ok when you got it, if not you may be able to exchange it.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.