model
New Member
Posts: 11
|
Post by model on Jan 29, 2023 4:01:13 GMT -8
I am reading PH14.45 with my ph sensor in water and obviously should be around 7, so have been digging around the calculation after showing my sensor as being read correctly by another ESP32. is there a blog post on PH offset as I could only find the test page with all the useful python test routines?
The calculation in pclogging.py is phValue = (rawPh/2048)*3.3*3.5+config.pHOffset
If (major assumption on my part as I can't find any gain change statement) the ADS1015 is in default gain 2 then it can only read up to 2.048 volts, so using the 11bit read (2048) divided into 3.3v looks like it is an error and should be (rawPh/2048) *2.048*3.5
config.py has pHOffset = 3.7, (initial and manually set), sensor accuracy should be better the 1pH.
SGS testHydroponicsLevel.py failed for me with a traceback statement around the location of config.pHoffset even though there is an import config statement. However I commented out pHOffset to move on and help diagnosis.
Doing the math on using 2.048v and no offset gave me the same voltage down to the millivolt as a separate ESP32 reading the PH meter directly through an A to D pin on 12 bit read.
Will make the changes to my code and see if it works, however I am also not convinced that these elements are entirely responsible for reading 14.45 in the first place.
|
|
|
Post by SDL on Jan 29, 2023 13:44:53 GMT -8
Looking forward to the report. Then I can dig in an maybe help!
BP
|
|
model
New Member
Posts: 11
|
Post by model on Jan 30, 2023 4:27:33 GMT -8
I started updating the pclogging .py and realised my purchased SD card was not running the latest code compared to GIT as the PH4 and PH7 voltage values, slope , intercept were not being used to find the PH as they were on the card.
Archived my original copy, and Git cloned SG3 and deleted/implemented new SG3 sql.
Reinstated fix to voltage in pclogging.py but changed 2.048v to 2048 so answer becomes millivolts needed for later calculations. Added the slope, intercept, and PH calculation that uses them from previous version
Set ph_offset in config.py to zero. Ran SG3.py and obtained the new calculated voltages whilst using the PH4 and PH7 buffer solution. Added these to _acidVoltage and _neutralVoltage definitions in pclogging.py Re ran SG3.py and now detects 7 and 4 ph solidly within 2 decimal places.
Dave
|
|
|
Post by SDL on Jan 31, 2023 18:09:25 GMT -8
OUTSTANDING!
BP
|
|