/*
- file DFRobot_ESP_PH_BY_GREENPONIK.ino
- @ GitHub - GreenPonik/DFRobot_ESP_PH_BY_GREENPONIK: Read PH on ESP32 by using Gravity: Analog pH Sensor / Meter Kit V2, SKU:SEN0161-V2
- This is the sample code for Gravity: Analog pH Sensor / Meter Kit V2, SKU:SEN0161-V2
- In order to guarantee precision, a temperature sensor such as DS18B20 is needed, to execute automatic temperature compensation.
- You can send commands in the serial monitor to execute the calibration.
- Serial Commands:
- enterph -> enter the calibration mode
- calph -> calibrate with the standard buffer solution, two buffer solutions(4.0 and 7.0) will be automaticlly recognized
- exitph -> save the calibrated parameters and exit from calibration mode
- Based on the @ GitHub - DFRobot/DFRobot_PH: Arduino library for Gravity: Analog pH Sensor / Meter Kit V2, SKU: SEN0161-V2
- Copyright DFRobot, 2018
- Copyright GNU Lesser General Public License
- ##################################################
- ##################################################
- ########## Fork on github by GreenPonik ##########
- ############# ONLY ESP COMPATIBLE ################
- ##################################################
- ##################################################
- version V1.1
- date 2019-06
*/
#include "DFRobot_ESP_PH.h"
#include "EEPROM.h"
DFRobot_ESP_PH ph;
#define ESPADC 4096.0 //the esp Analog Digital Convertion value
#define ESPVOLTAGE 3300 //the esp voltage supply value
#define PH_PIN 35 //the esp gpio data pin number
float voltage, phValue, temperature = 25;
void setup()
{
Serial.begin(115200);
EEPROM.begin(32);//needed to permit storage of calibration value in eeprom
ph.begin();
}
void loop()
{
static unsigned long timepoint = millis();
if (millis() - timepoint > 1000U) //time interval: 1s
{
timepoint = millis();
//voltage = rawPinValue / esp32ADC * esp32Vin
voltage = analogRead(PH_PIN) / ESPADC * ESPVOLTAGE; // read the voltage
Serial.print("voltage:");
Serial.println(voltage, 4);
//temperature = readTemperature(); // read your temperature sensor to execute temperature compensation
Serial.print("temperature:");
Serial.print(temperature, 1);
Serial.println("^C");
phValue = ph.readPH(voltage, temperature); // convert voltage to pH with temperature compensation
Serial.print("pH:");
Serial.println(phValue, 4);
}
ph.calibration(voltage, temperature); // calibration process by Serail CMD
}
float readTemperature()
{
//add your code here to get the temperature from your temperature sensor
}
so Guys attached is the ph sensor reading code try to help me to combine how can i use it with Nextion and teach how you did this thank you