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
Go to Developer Tools > Services, find: ESPHome: xxx_enter_ph and call service to start calibration
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
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
Hello there. Leaving a note if somone is using this for ph mesurment.
YOU CANT use linear calibration because the voltage output from this thing is not linear. It is polynomial! i lost SO much time trying to calibrate it, it will always be ofcenter. You have to do it like this:
type or paste code here
# https://esphome.io/components/sensor/index.html#sensor-filters
filters:
- median:
window_size: 15
send_every: 8
# Measured voltage -> Actual pH (buffer solution)
- calibrate_polynomial:
degree: 2
datapoints:
#- 3.435 -> 7.4
- 3.91 -> 4.0
- 3.59 -> 6.86
- 0 -> 14
- 5 -> 0
Are you keeping the sensor submerged continuously and are you finding it to still work well? I’ve considered getting one for my aquarium, but not sure how useful and reliable it will actually be, as I don’t have any interest in replacing the sensor frequently.
This is not a lab-standard sensor for sure. But fairly reliable. I am injecting CO2 into the tank and constantly measuring the PH is a very good way to see how the injection works. When you inject CO2 you’d expect the PH to drop. I am happy with the way that the sensor reports the PH level. Look at the result below
A couple of points to consider :
A) I am monitoring the water temp using the very same Esp board and Dallas sensors and as a result, I got so much noise on the readout that I needed to use a decoupler to eliminate interferences. I used one of these boards to achieve that
B) Tens, if not hundreds, of AliExpress sellers, sell the very same board. I have changed the board three times so far. However, I’ve found this specific brand (DIY-MORE) is more reliable than others.
Any idea how long you’ve been able to use the sensor each time before replacing? And how exactly does it fail? Does it just stop working at all or do the readings start to drift?
Thanks for the info and responding, it’s super-helpful!
The actual probe did not fail the module (board) failed.
The first one I could not get it calibrated in any way or shape. It only worked for 10 mins and then out of calibration so sent it back for a refund.
The second one was more stable and largely worked but I could never see the PH drop. Well, I could, but it was a very mild drop. So I started to question the board after a few months of usage. Ironically when I became suspicious, it then started to drift very noticeably day in and day out and I concluded that the board is now faulty. It worked for about 10 months before starting to drift.
The third one is the one that worked nicely from day1 and is solid. it worked for the last 6 weeks with no issues to report. Super-happy with it. That is the DIY-More module. I bought a reserved board just in case.
with the PH meter, you can go crazy but I put a requirement that I do not spend more than $30 (£20) on it. so far could fulfil that requirement However one could argue buy cheap, buy twice !!
Hello @aryankids , I have read the full chain of messages and finally end up in your comment, saying that you are happy, that works and what is more…my board is the one you mention, the DIY. Are you so kind as to summarize (just copy paste) your hardware schema for a wemos D1 and the final software installation manual? Thanks in advance
if someone wants to try this out it working for me well, i’m not a coder or developer but i got this going.
it supports both adc and non-adc setups, has temperature sensor compensation for nernst calculation, supports 2 or 3 points mode logic, can be calibrated easily from the esphome webui or from ha actions.
it’s a fairly simple component that is good enough for hobbiest, it’s based on infotronic218 and GreenPonik work, does not require any other particular configuration.
I tried to set up the sensor using an ESP32 and the native ADC (Option 2 on your Git readme). However, the setup seems to require the ADS1115 to be installed even if you set this to false (use_ads1115: false). Is this supposed to be the case?
oh sorry for that, i must have left the requirement of the dependency in the code when i merged both ads an non-ads setups… try to recompile should work as expected now.
i need to updated the readme also to maybe include 2 examples for both setup separately thanks for debugging
@alex1510 I am so sorry, for some reason, I did not get any notification regarding your comments. If this is too late for you, perhaps someone else can benefit from it !
esphome:
name: aqua-mon
friendly_name: Aqua_Mon
esp8266:
board: esp01_1m
# Enable logging
logger:
# Example configuration entry
# web_server:
# port: 80
# Enable Home Assistant API
api:
encryption:
key: "YOUR KEY HERE"
ota:
platform: "esphome"
password: "YOUR OTA PASSWORD HERE"
wifi:
WIFI INFO GOES HERE
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Aqua-Mon Fallback Hotspot"
password: "FALLS BACK PASSWORD GOES HERE "
captive_portal:
one_wire:
- platform: gpio
pin:
number : GPIO4
mode: INPUT_PULLUP
sensor:
- platform: dallas_temp
address: YOUR UNIT ADDRESS GOES HERE
name: "Aqua_Temp"
- platform: adc
pin: A0
id: ph
name: "Tank-Ph"
accuracy_decimals: 2
#update_interval: 1s
unit_of_measurement: ph
update_interval: 10s # you don't need faster than this.
#attenuation: 11db
internal: false
filters:
# - multiply: 6.62
- sliding_window_moving_average:
send_every: 10
window_size: 10
send_first_at: 1
#- median:
# window_size: 7
## send_every: 4
# send_first_at: 3
# Measured voltage -> Actual pH (buffer solution)
- calibrate_linear:
- 0.545 -> 7.00
- 0.620 -> 4.00
# - 0.54 -> 7.5 (Tap water)
# - 0.50 -> 7.8. # Tap water
# - 0.58 -> 7.0. # Pure Water
# - 0.54 -> 6.9. # water with few drops of juice
# - 0.52 -> 6.5 # Milk
# - 0.62 -> 3.5. # Lemon Juice
#- delta: 0.1
# Measured voltage -> Actual pH (buffer solution)
#- calibrate_linear:
#- 3.164 -> .08
#- 2.856 -> 4.01 #voltage value when entering the sensor in a pH of 7 solution
#- 2.415 -> 6.86
#- 2.042 -> 9.01
As you can see, I have LOTS of commented numbers. The secret sauce here is the recalibration again and again.
Also, as it is obvious from the sketch, I am using the same ESPHome board to check the water temperature (Aqua_temp).
Given how similar these two probes are, can anyone share the correct conversion factor for the temperature probe? I don’t think I’ve got it quite right, though it is close.
Realtime salinity monitoring was the final controller I needed to build for my tank
Managed to get the temp probe working - after two days of banging my head against a wall, I realised I had the wrong source code.
I’ve relied on templated lambda sensors rather than referencing any external library but it seems to work. The same approach could be used for this pH probe.
OK, seems I was a tad too optimistic, but definitely seem to have a stable config now which also includes a reference sensor for both sanity checking and calibration.
Again, apologies for hijacking this thread, but I understand that both the DFRobot pH and EC probes use the same integrated PT1000 sensor.
Anyway, I think my code now provides more accurate readings than can be obtained from simply using the DFRobot library. I really recommend this product. I would very much not recommend this one! The latter is similar to AliExpress and indeed the one one supplied with Neptune Apex.
I’m surprised how difficult it was to get a stable reading from the temp side. I do think DFRobot are aware of this by the approximation they use in their conversion from voltage to 'C.
I couldn’t understand why nobody here has commented on similar issues with fluctuating readings from the pH side… I suspect you are having them, but the logarithmic nature of pH means that small fluctuations in temperature voltage are less likely to be noticeable or indeed meaningful. Frustratingly, 0.01’C really does significantly affect the calculation to convert to salinity - I think this is why there are no good real-time salinity probes on the market.
If I were to do it again, I’d have a dedicated 5V supply for both the ESP32S3 and ADS1115 with a proper reference voltage source. That would potentially remove the need for the voltage smoothing and allow for more responsive readings, though this is more than good enough for me.
Anyway, came here for advice, but figured it out in the end!