I set up the pH sensor using an ESP32. I connected VCC to 3.3V, GND to GND and PO to PIN39 (ADC1_CH3) and extended my pH probe using four meters of alarm cable.
When I do not connect the probe with the module I get a good analog reading, with the voltage measured by using an ammeter (ignoring noise and linearity of the ESP32.)
When I plug the probe in to the module, then the analog reading will jump to either 0 or 4095.
What is the problem? Is the probe broken or is the module broken or are both broken?
This is the module I used:
My program:
/*!
* @file DFRobot_PH_Test.h
* @brief This is the sample code for Gravity: Analog pH Sensor / Meter Kit V2, SKU:SEN0161-V2.
* @n In order to guarantee precision, a temperature sensor such as DS18B20 is needed, to execute automatic temperature compensation.
* @n You can send commands in the serial monitor to execute the calibration.
* @n Serial Commands:
* @n enterph -> enter the calibration mode
* @n calph -> calibrate with the standard buffer solution, two buffer solutions(4.0 and 7.0) will be automaticlly recognized
* @n exitph -> save the calibrated parameters and exit from calibration mode
*
* @copyright Copyright (c) 2010 DFRobot Co.Ltd (http://www.dfrobot.com)
* @license The MIT License (MIT)
* @author [Jiawei Zhang](jiawei.zhang@dfrobot.com)
* @version V1.0
* @date 2018-11-06
* @url https://github.com/DFRobot/DFRobot_PH
*/
#include "DFRobot_PH.h"
#include <EEPROM.h>
#define PH_PIN 39
float voltage;
float phValue,temperature = 25;
DFRobot_PH ph;
void setup()
{
Serial.begin(115200);
ph.begin();
}
void loop()
{
static unsigned long timepoint = millis();
if(millis()-timepoint>1000U){ //time interval: 1s
timepoint = millis();
//temperature = readTemperature(); // read your temperature sensor to execute temperature compensation
voltage = analogRead(PH_PIN)/4096.0*3300; // read the voltage
phValue = ph.readPH(voltage,temperature); // convert voltage to pH with temperature compensation
Serial.print("Voltage: ");
Serial.print(voltage);
Serial.print(" 39: ");
Serial.print(analogRead(39));
Serial.print(" temperature:");
Serial.print(temperature,1);
Serial.print("^C pH:");
Serial.println(phValue,2);
}
ph.calibration(voltage,temperature); // calibration process by Serail CMD
}
float readTemperature()
{
//add your code here to get the temperature from your temperature sensor
}
Without probe:
Ammeter reading 1.89V without probe.
Ammeter reading 1.45V with probe.