pH sensor stopped recording (robo-tank)

the register

Community Member
View Badges
Joined
Apr 16, 2009
Messages
49
Reaction score
45
Rating - 0%
0   0   0
Rather than keep bugging @robsworld78 over email, I'll start doing in this forum for others to find. I recently have started having an issue where my reef-pi/robo-tank stopped recording pH. It was working fine, but then as of yesterday I'm getting no data points recorded. I've been on reef-pi 5.2, though as of a couple hours ago I'm on the latest built off main to get my other bugfixes in (it happened on 5.2 and continues now).

I'm wondering if this is a symptom of the probe dying, though the errors aren't very clear.

i2cdetect output
pi@fragtankpi:~ $ i2cdetect -y 1 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: 40 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- 63 -- -- -- -- 68 -- -- -- -- -- -- -- 70: 70 -- -- -- -- -- -- --

Error I see in the journalctl log
Note it ends with no text after Error, that's not a copy-paste issue
Jul 03 20:09:25 fragtankpi reef-pi[329]: 2022/07/03 20:09:25 ph sub-system: ERROR: Failed to read probe: PH Bluelab . Error: Failed to execute. Error:

Config
None of this has changed recently, AFAIK.

Driver: Name=PH, type=ph-ezo, Address=99
Analog Input: Name=PH, Pin=0, Driver=PH

Sensor is a Bluelab pH probe off Amazon. Has been calibrated and was working well, as far as I know. Went from a smooth curve of 8.4-8.2 to suddenly yesterday dropping to 7.45 and now stopping.
 
OP
OP
T

the register

Community Member
View Badges
Joined
Apr 16, 2009
Messages
49
Reaction score
45
Rating - 0%
0   0   0
Also based on https://www.reef2reef.com/threads/ph-sensor-not-working.816921/

pi@fragtankpi:~ $ python Robo-Tank_pH_Script.py Enter command: R Traceback (most recent call last): File "Robo-Tank_pH_Script.py", line 119, in <module> main() File "Robo-Tank_pH_Script.py", line 113, in main print(device.query(input)) File "Robo-Tank_pH_Script.py", line 64, in query return self.read() File "Robo-Tank_pH_Script.py", line 44, in read if(ord(response[0]) == 1): # if the response isnt an error IndexError: string index out of range [ICODE]
 
OP
OP
T

the register

Community Member
View Badges
Joined
Apr 16, 2009
Messages
49
Reaction score
45
Rating - 0%
0   0   0
I added some debugging to the script, outputting response and res:

pi@fragtankpi:~ $ python Robo-Tank_pH_Script.py Enter command: R ('response', '') ('res', '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') Traceback (most recent call last): File "Robo-Tank_pH_Script.py", line 121, in <module> main() File "Robo-Tank_pH_Script.py", line 115, in main print(device.query(input)) File "Robo-Tank_pH_Script.py", line 66, in query return self.read() File "Robo-Tank_pH_Script.py", line 46, in read if(ord(response[0]) == 1): # if the response isnt an error IndexError: string index out of range
 

Sral

Valuable Member
View Badges
Joined
May 2, 2022
Messages
1,005
Reaction score
971
Location
Germany
Rating - 0%
0   0   0
The error looks similar to what other's had with the RoboTank pH-probe:
- like Wolfw28 here
- and kdx7214 here

That's typically an I2C error, because the probe uses clock stretching, but the Pi doesn't. To try and solve that, check your config.txt as explained in Robsworld78's post in the second link. It makes sure that I2C is enabled and that the baud rate is slow enough that the Pi doesn't hiccup from the clock stretching.
 
OP
OP
T

the register

Community Member
View Badges
Joined
Apr 16, 2009
Messages
49
Reaction score
45
Rating - 0%
0   0   0
The error looks similar to what other's had with the RoboTank pH-probe:
- like Wolfw28 here
- and kdx7214 here

That's typically an I2C error, because the probe uses clock stretching, but the Pi doesn't. To try and solve that, check your config.txt as explained in Robsworld78's post in the second link. It makes sure that I2C is enabled and that the baud rate is slow enough that the Pi doesn't hiccup from the clock stretching.
Thanks. The wolf2 link isn't working, but I will update the setting ala the kdx one and give that a go. Thanks for the quick find.
 
OP
OP
T

the register

Community Member
View Badges
Joined
Apr 16, 2009
Messages
49
Reaction score
45
Rating - 0%
0   0   0
Thanks. The wolf2 link isn't working, but I will update the setting ala the kdx one and give that a go. Thanks for the quick find.
That did not fix my issue.

journalctl:

Code:
Jul 04 10:13:35 fragtankpi reef-pi[346]: 2022/07/04 10:13:35 ph sub-system: ERROR: Failed to read probe: PH Bluelab . Error: Failed to execute. Error:
Jul 04 10:13:35 fragtankpi reef-pi[346]: [2B blob data]
Jul 04 10:13:35 fragtankpi reef-pi[346]: [1B blob data]

I for the time being am disconnecting my pH sensor because my pi has started becoming unreliable. I'll retry again later.
 

Sral

Valuable Member
View Badges
Joined
May 2, 2022
Messages
1,005
Reaction score
971
Location
Germany
Rating - 0%
0   0   0
That did not fix my issue.

journalctl:

Code:
Jul 04 10:13:35 fragtankpi reef-pi[346]: 2022/07/04 10:13:35 ph sub-system: ERROR: Failed to read probe: PH Bluelab . Error: Failed to execute. Error:
Jul 04 10:13:35 fragtankpi reef-pi[346]: [2B blob data]
Jul 04 10:13:35 fragtankpi reef-pi[346]: [1B blob data]

I for the time being am disconnecting my pH sensor because my pi has started becoming unreliable. I'll retry again later.
That’s very unfortunate. Guess we have to wait for @robsworld78 now.
Just to be sure, you did Restart the PI or disconnect power after setting and saving the settings and the settings contain the changed values now ?
 

robsworld78

Well-Known Member
View Badges
Joined
Feb 14, 2020
Messages
952
Reaction score
1,280
Location
Edmonton, Canada
Rating - 0%
0   0   0
Sorry to hear about the issue, it seems the circuit is somewhat working as the I2C address is there but yeah that error seems to indicate reef-pi can't read it. I'm not sure why that python script isn't working, someone else had the same errors so I've changed it to a c++ program instead, lets see what happens with this. Run the following four commands to start the script. When it starts it should print out the pH every 3 seconds.

sudo wget -c https://www.robo-tank.ca/reef-pi/Robo-Tank_pH_Script.zip

sudo unzip Robo-Tank_pH_Script.zip

g++ -o Robo-Tank_pH_Script Robo-Tank_pH_Script.cpp

./Robo-Tank_pH_Script


What did you mean by the Pi is becoming unreliable?
 
OP
OP
T

the register

Community Member
View Badges
Joined
Apr 16, 2009
Messages
49
Reaction score
45
Rating - 0%
0   0   0
Sorry to hear about the issue, it seems the circuit is somewhat working as the I2C address is there but yeah that error seems to indicate reef-pi can't read it. I'm not sure why that python script isn't working, someone else had the same errors so I've changed it to a c++ program instead, lets see what happens with this. Run the following four commands to start the script. When it starts it should print out the pH every 3 seconds.

sudo wget -c https://www.robo-tank.ca/reef-pi/Robo-Tank_pH_Script.zip

sudo unzip Robo-Tank_pH_Script.zip

g++ -o Robo-Tank_pH_Script Robo-Tank_pH_Script.cpp

./Robo-Tank_pH_Script


What did you mean by the Pi is becoming unreliable?
I missed this thread update, sorry about that. I'll give that a try this weekend.

My reef pi / robo tank kept crashing. I was having errors with pH, errors with one of two temp probes (the file not available error), and then it eventually hung on me multiple times, including once overnight leading to a tank temp drop to 74°.

I detached the pH sensor and replaced the temp sensor and it hasn't hung up yet.

Yesterday I tried using a new pH sensor and it's been a bit of a battle. It was very difficult to get it to calibrate, in that I was using ph7 & ph10 to calibrate, and afterwards it'd tell me those same solutions were maybe 6.5 and 10.5. Even with a lot of stirring and making sure it stabilized. Eventually I got it to read 7/10, and left it, but since then it's giving me crazy readings.

However, that's with a cheap Amazon pH sensor this time. That brand is working fine on my other reef pi / robo tank with the same sensor type, but maybe I somehow got a bad one and my other sensor failed within 2ish months of getting it. Or maybe the other sensor is fine but I'm having a hardware issue.

As time allows I'm going to try and reopen my robo tank, make sure everything is seated properly, try both probes, and see what happens. Just takes a lot of time to do it all.
 

robsworld78

Well-Known Member
View Badges
Joined
Feb 14, 2020
Messages
952
Reaction score
1,280
Location
Edmonton, Canada
Rating - 0%
0   0   0
I missed this thread update, sorry about that. I'll give that a try this weekend.

My reef pi / robo tank kept crashing. I was having errors with pH, errors with one of two temp probes (the file not available error), and then it eventually hung on me multiple times, including once overnight leading to a tank temp drop to 74°.

I detached the pH sensor and replaced the temp sensor and it hasn't hung up yet.

Yesterday I tried using a new pH sensor and it's been a bit of a battle. It was very difficult to get it to calibrate, in that I was using ph7 & ph10 to calibrate, and afterwards it'd tell me those same solutions were maybe 6.5 and 10.5. Even with a lot of stirring and making sure it stabilized. Eventually I got it to read 7/10, and left it, but since then it's giving me crazy readings.

However, that's with a cheap Amazon pH sensor this time. That brand is working fine on my other reef pi / robo tank with the same sensor type, but maybe I somehow got a bad one and my other sensor failed within 2ish months of getting it. Or maybe the other sensor is fine but I'm having a hardware issue.

As time allows I'm going to try and reopen my robo tank, make sure everything is seated properly, try both probes, and see what happens. Just takes a lot of time to do it all.
Sounds like possibly a few things happening. For the pH it could be a hardware issue, hard to say at this point as you did eventually get 7/10. When you got the probe was the tip inside a cap of gel? Sometimes with cheap sensors the gel leaks out and the trip dries out which can damage them. What values are you seeing without the probe attached?

The temp probes is a different issue and won't be related to pH, unfortunately there's a lot of flaky sensors which are easily effected by any kind of external noise, one thing to make sure is the sensor cable isn't running along side any AC cables and ideally not cross over any. In the worst case when a sensor fails it can hang the 1wire bus used to communicate which requires a reboot to reset, it sounds like this may have happened. It's good to use the other temp sensor port as a backup, set these up 0.1 over the main sensor so it can turn off the heater as well. If one sensor port locks up it won't affect the others. If you have extra sensor ports available you can also configure them for more temp sensors if you want extra backups. Also setup the email alerts on all the sensors so you can get a notification if a temp sensor goes bad. If one continues to hang and requires a reboot throw it out, some also have an a problem with letting moisture in. Here's a link for some better sensors with shielded cables, these have solved quite a few systems that were experiencing lots of issues. I'm waiting on my first batch, I'm going to start selling these instead.


As for the system hanging that could mean two things, the Pi froze or just the 1wire bus for the DS18B20 froze, I'm thinking it's the latter. Were you still able to access reef-pi before you reboot or was that why you had to reboot? Not having the pH probe attached won't affect this in any way as the pH circuit is still running, that part is just coincidence.
 
OP
OP
T

the register

Community Member
View Badges
Joined
Apr 16, 2009
Messages
49
Reaction score
45
Rating - 0%
0   0   0
Sounds like possibly a few things happening. For the pH it could be a hardware issue, hard to say at this point as you did eventually get 7/10. When you got the probe was the tip inside a cap of gel? Sometimes with cheap sensors the gel leaks out and the trip dries out which can damage them. What values are you seeing without the probe attached?

The temp probes is a different issue and won't be related to pH, unfortunately there's a lot of flaky sensors which are easily effected by any kind of external noise, one thing to make sure is the sensor cable isn't running along side any AC cables and ideally not cross over any. In the worst case when a sensor fails it can hang the 1wire bus used to communicate which requires a reboot to reset, it sounds like this may have happened. It's good to use the other temp sensor port as a backup, set these up 0.1 over the main sensor so it can turn off the heater as well. If one sensor port locks up it won't affect the others. If you have extra sensor ports available you can also configure them for more temp sensors if you want extra backups. Also setup the email alerts on all the sensors so you can get a notification if a temp sensor goes bad. If one continues to hang and requires a reboot throw it out, some also have an a problem with letting moisture in. Here's a link for some better sensors with shielded cables, these have solved quite a few systems that were experiencing lots of issues. I'm waiting on my first batch, I'm going to start selling these instead.


As for the system hanging that could mean two things, the Pi froze or just the 1wire bus for the DS18B20 froze, I'm thinking it's the latter. Were you still able to access reef-pi before you reboot or was that why you had to reboot? Not having the pH probe attached won't affect this in any way as the pH circuit is still running, that part is just coincidence.
Thanks for the detail! Regarding the last point, it was totally hung. I couldn't ssh, and more tellingly my temperature readings weren't recording nor was it adjusting temp properly. I should clarify the second temp sensor I use to measure air temp not tank. It was the air temp sensor failing.
 

robsworld78

Well-Known Member
View Badges
Joined
Feb 14, 2020
Messages
952
Reaction score
1,280
Location
Edmonton, Canada
Rating - 0%
0   0   0
Thanks for the detail! Regarding the last point, it was totally hung. I couldn't ssh, and more tellingly my temperature readings weren't recording nor was it adjusting temp properly. I should clarify the second temp sensor I use to measure air temp not tank. It was the air temp sensor failing.
I don't know for sure but maybe the SD card has issues causing the Pi to freeze, that's typically a rare event. Can't see that being related to the temps or pH though. If it continues to lock it might be worth trying another SD card, other than that I'm not sure what to suggest but I do know others who have had SD cards go bad. When you have more info on the pH let me know and we'll get that sorted out.
 
OP
OP
T

the register

Community Member
View Badges
Joined
Apr 16, 2009
Messages
49
Reaction score
45
Rating - 0%
0   0   0
I don't know for sure but maybe the SD card has issues causing the Pi to freeze, that's typically a rare event. Can't see that being related to the temps or pH though. If it continues to lock it might be worth trying another SD card, other than that I'm not sure what to suggest but I do know others who have had SD cards go bad. When you have more info on the pH let me know and we'll get that sorted out.
Since swapping the pH and the temp sensors, it's been reliable again. Might all be coincidence, and I'd like to do some debugging by adding one then the other back to reproduce, but I realistically will probably just chalk it up to "one of those weird things that happened" and ignore it...
 

robsworld78

Well-Known Member
View Badges
Joined
Feb 14, 2020
Messages
952
Reaction score
1,280
Location
Edmonton, Canada
Rating - 0%
0   0   0
Since swapping the pH and the temp sensors, it's been reliable again. Might all be coincidence, and I'd like to do some debugging by adding one then the other back to reproduce, but I realistically will probably just chalk it up to "one of those weird things that happened" and ignore it...
Keep us posted, hopefully it was just a one off thing.
 

map2022

New Member
View Badges
Joined
Feb 15, 2022
Messages
7
Reaction score
1
Location
Central Texas
Rating - 0%
0   0   0
Rob, I wanted to let you know this script solved a problem I was having with the robo-tank pH probe after upgrading to reef-pi 5.3.

Prior to 5.3, I was getting occasional "parsing errors" with the pH probe, but it still worked. In reef-pi 5.3, the pH probe worked for a few minutes, then started giving a zero pH value and disabled itself on the reef-pi pH page. After running the script, it's been running stable for a few hours.

Here are the steps I followed:

1. Connected to Raspberry Pi over SSH and ran these 4 commands --
sudo wget -c https://www.robo-tank.ca/reef-pi/Robo-Tank_pH_Script.zip

sudo unzip Robo-Tank_pH_Script.zip

g++ -o Robo-Tank_pH_Script Robo-Tank_pH_Script.cpp

./Robo-Tank_pH_Script
Then the SSH terminal started printing the pH value every 3 seconds.

2. Deleted the probe on the reef-pi pH page and then added it back. (Reef-pi wasn't reading the probe after running the script, and this is the first and only troubleshooting step I tried.)

3. Rebooted the Raspberry Pi just to be sure.

Thanks so much for the fix!
 

robsworld78

Well-Known Member
View Badges
Joined
Feb 14, 2020
Messages
952
Reaction score
1,280
Location
Edmonton, Canada
Rating - 0%
0   0   0
Rob, I wanted to let you know this script solved a problem I was having with the robo-tank pH probe after upgrading to reef-pi 5.3.

Prior to 5.3, I was getting occasional "parsing errors" with the pH probe, but it still worked. In reef-pi 5.3, the pH probe worked for a few minutes, then started giving a zero pH value and disabled itself on the reef-pi pH page. After running the script, it's been running stable for a few hours.

Here are the steps I followed:

1. Connected to Raspberry Pi over SSH and ran these 4 commands --

Then the SSH terminal started printing the pH value every 3 seconds.

2. Deleted the probe on the reef-pi pH page and then added it back. (Reef-pi wasn't reading the probe after running the script, and this is the first and only troubleshooting step I tried.)

3. Rebooted the Raspberry Pi just to be sure.

Thanks so much for the fix!
Hi @map2022 glad to hear it's working better now. There's a setting that needs to be set otherwise there can be issues reading the pH, looks like something changed in reef-pi 5.3 and now it will report a 0 value instead of the parsing error you saw in previous versions, both are caused by the same thing though.

The script you ran doesn't actually do anything but read the circuit, it's possible you're getting lucky with good readings but it might return if the setting isn't correct. Run the following command to verify it's good.

sudo nano /boot/config.txt

This will open a file, scroll down and find the following two lines.

dtparam=i2c_arm=on
dtparam=i2c_arm_baudrate=10000


It's possible these are on the same line separated by a comma, if so delete the comma and add a new line between them like above.

Then press CTRL + S on the keyboard to save and then CTRL + X to exit. Then reboot the controller and the change will take effect.
 

A worm with high fashion and practical utility: Have you ever kept feather dusters in your reef aquarium?

  • I currently have feather dusters in my tank.

    Votes: 67 37.6%
  • Not currently, but I have had feather dusters in my tank in the past.

    Votes: 59 33.1%
  • I have not had feather dusters, but I hope to in the future.

    Votes: 25 14.0%
  • I have no plans to have feather dusters in my tank.

    Votes: 27 15.2%
  • Other.

    Votes: 0 0.0%
Back
Top