PH probe issues

iamdan

Community Member
View Badges
Joined
Jul 1, 2022
Messages
62
Reaction score
61
Location
Western Australia
Rating - 0%
0   0   0
Thanks for that, have replied to GitHub comment as well I’m really over my head when it comes to programming so I’d rather leave that in your competent and capable hands
 

iamdan

Community Member
View Badges
Joined
Jul 1, 2022
Messages
62
Reaction score
61
Location
Western Australia
Rating - 0%
0   0   0
I think for the “error correction” we need to include the NaN for those that do see that error and in my case and others I’ve seen having same issue where the reading drops to like in my case -0.15 being the reading I believe of the calibration of the probe at the time so to include anything under 1 or 2 to be ignored

While I appreciate my chat gpt code changes may not be ideal I don’t understand what you have asked me to change? Is it line 11 from = 0.0 to < 1.0?
 

Sral

Valuable Member
View Badges
Joined
May 2, 2022
Messages
1,006
Reaction score
976
Location
Germany
Rating - 0%
0   0   0
Yes, pretty much.

For me line 13 in the file pH_fetch _data.cpp looks like this:
C++:
if (isnan(saveValue) || saveValue == 0.0){ return; }
And will be changed to:
C++:
if (isnan(saveValue) || saveValue <= 2.0){ return; }

Afterwards you would also have to compile the file in the command console:

Bash:
g++ pH_fetch_data.cpp -o pH_fetch_data
 

Sral

Valuable Member
View Badges
Joined
May 2, 2022
Messages
1,006
Reaction score
976
Location
Germany
Rating - 0%
0   0   0
You mean run that g++ command on my reef-pi if I edit the file directly there?
Exactly. You have to find the file under /var/lib/reefPi/pH/pH_fetch_data.cpp
and make the appropriate changes.
Afterwards you have to run the g++ command to compile the code, otherwise the service that runs in the background will still run the old executable.
 

iamdan

Community Member
View Badges
Joined
Jul 1, 2022
Messages
62
Reaction score
61
Location
Western Australia
Rating - 0%
0   0   0
ahh i get ya now

Ran it, got this - this ok?

robo-pi@robopi:/var/lib/reef-pi/pH $ g++ pH_fetch_data.cpp -o pH_fetch_data In file included from pH_fetch_data.cpp:9:
pH_sensor.cpp: In member function ‘float pHSensor::readMeasurement()’:
pH_sensor.cpp:43:38: warning: converting to non-pointer type ‘float’ from NULL [-Wconversion-null]
43 | if (openConnection() == 0) return __null;
| ^~~~~~
pH_sensor.cpp: In member function ‘float pHSensor::readFloatValue()’:
pH_sensor.cpp:101:12: warning: converting to non-pointer type ‘float’ from NULL [-Wconversion-null]
101 | return __null;
 

iamdan

Community Member
View Badges
Joined
Jul 1, 2022
Messages
62
Reaction score
61
Location
Western Australia
Rating - 0%
0   0   0
Did all that stuff you advised last night and it still does funky stuff, so think we r close but it’s not there yet
 

Sral

Valuable Member
View Badges
Joined
May 2, 2022
Messages
1,006
Reaction score
976
Location
Germany
Rating - 0%
0   0   0
Did all that stuff you advised last night and it still does funky stuff, so think we r close but it’s not there yet
Darnit, I‘ll see if I can find time today.

Another quick fix I thought of is to use the following transform formula:
v > 2 ? v : 8.2

It’s not perfect, but that would make every faulty value 8.2 instead of 0 or -0.15
 

Sral

Valuable Member
View Badges
Joined
May 2, 2022
Messages
1,006
Reaction score
976
Location
Germany
Rating - 0%
0   0   0
It now disregards all values below 2 and writes the communication buffer into a file. At least I hope it does, since I had no way to test this ^^
 

iamdan

Community Member
View Badges
Joined
Jul 1, 2022
Messages
62
Reaction score
61
Location
Western Australia
Rating - 0%
0   0   0
It now disregards all values below 2 and writes the communication buffer into a file. At least I hope it does, since I had no way to test this ^^
Sorry to be the bearer of bad news.

This is all that happens after applying your latest build - Constant reading of the below.

1696828595752.png



The only file i see being generated in the pH directory (don't see any pH.dat we are supposed to be referring to)

1696828694695.png
 

Sral

Valuable Member
View Badges
Joined
May 2, 2022
Messages
1,006
Reaction score
976
Location
Germany
Rating - 0%
0   0   0
Hm, thanks a lot. I looked back to when I made the pH circuit work with the ESP32, and I did of course get the message structure wrong ... so the program always went into error mode. Sry, my bad for not checking properly enough.

Updated to version 1.2, deployment as always
Should not fall into error mode all the time and the errorData.dat is now more readable.
 

iamdan

Community Member
View Badges
Joined
Jul 1, 2022
Messages
62
Reaction score
61
Location
Western Australia
Rating - 0%
0   0   0
Hi Sral

Been running your new build for many hours now, accuracy of ph readings is much better but still does the glitch to -0.15

1697026857990.png


Contents of errorData.dat

1697026979264.png
 

Reefing threads: Do you wear gear from reef brands?

  • I wear reef gear everywhere.

    Votes: 37 15.9%
  • I wear reef gear primarily at fish events and my LFS.

    Votes: 13 5.6%
  • I wear reef gear primarily for water changes and tank maintenance.

    Votes: 1 0.4%
  • I wear reef gear primarily to relax where I live.

    Votes: 30 12.9%
  • I don’t wear gear from reef brands.

    Votes: 135 58.2%
  • Other.

    Votes: 16 6.9%
Back
Top