Code for PH Sensor DFRobot

Could you kindly explain how to calibrate readings using services? I don’t know how to pass buffers pH values…

EDIT:
Nevermind, found in read_ph.ino file instruction:

  • 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

So for anybody asking, just

  1. Go to Developer Tools > Services, find:
    ESPHome: xxx_enter_ph and call service to start calibration
  2. Find ESPHome: xxx_calibrate_ph, put probe to buffer 4.00 and call service to calibrate measured value. Make the same for buffer 7.00
  3. Find ESPHome: xxx_exit_ph to save results and leave calibration.

In case of problem during calibration (matching buffer 7.00 to 4.00) in may be worth to compare received voltage values from logs to ranges defined in DFRobot_ESP_PH.h (or with ADC) file:

#define PH_VOLTAGE_ACID_OFFSET 200
#define PH_VOLTAGE_NEUTRAL_OFFSET 200
#define PH_8_VOLTAGE 995  //linear culculation
#define PH_7_AT_25 1134   //laboratory measurement with isolation circuit, PH meter V2.0 and PH probe from DFRobot kit
#define PH_6_VOLTAGE 1250 //linear culculation
#define PH_5_VOLTAGE 1380 //linear culculation
#define PH_4_AT_25 1521   //laboratory measurement with isolation circuit, PH meter V2.0 and PH probe from DFRobot kit
#define PH_3_VOLTAGE 1700 //linear culculation

#define PH_VOLTAGE_NEUTRAL_LOW_LIMIT PH_8_VOLTAGE - PH_VOLTAGE_NEUTRAL_OFFSET
#define PH_VOLTAGE_NEUTRAL_HIGH_LIMIT PH_6_VOLTAGE
#define PH_VOLTAGE_ACID_LOW_LIMIT PH_5_VOLTAGE - PH_VOLTAGE_ACID_OFFSET
#define PH_VOLTAGE_ACID_HIGH_LIMIT PH_3_VOLTAGE

In my case buffer 7.00 has 1266V and was treated as ACID VOLTAGE (between PH_VOLTAGE_ACID_HIGH_LIMIT and PH_VOLTAGE_ACID_LOW_LIMIT).
I had to remove all linear calculated values (pH 8, 6, 5 and 3) and redefine
PH_7_AT_25
PH_4_AT_25
according to my readings (1266V and 1666V from logs).

Then redefine:
PH_VOLTAGE_NEUTRAL_LOW_LIMIT
PH_VOLTAGE_NEUTRAL_HIGH_LIMIT
PH_VOLTAGE_ACID_LOW_LIMIT
PH_VOLTAGE_ACID_HIGH_LIMIT
which defines a ranges used for automatic recognition to match buffer 4.00 or 7.00

For that simply PH_7_AT_25 and PH_4_AT_25 may be used with +/- NEUTRAL and ACID OFFSETS
:slight_smile: