pH Calibration issue

Related to the development libraries, released by Curt Binder
Post Reply
dedvalson
Posts: 140
Joined: Tue Oct 04, 2011 5:49 am

pH Calibration issue

Post by dedvalson »

Hi,

I was looking at the code for pH calibration and it seems to me like we are going about this wrong. The calibration code stores the lowest value ever seen as 7.0 and the highest value ever seen as 10.0. The problem is that there is always noise on the pH input that will cause artifically low and high readings to take place during calibration. When I have calibrated my probe, I have often found that immediately afterwards the 7.0 pH calibration solution will read as high as 7.3 and the 10.0 calibration solution has read as low as 9.6. This is due to noise that was not factored out during calibration.

I generally wind up watching the display during calibration and manually setting the low and high values to what appears to be the "average" reading while immersed in each solution.

I think we need to consider a different calibration algorithim. What if the code asked the user to put the probe in the 7.0 solution. We could then wait a while, perhaps 2-3 minutes, then grab an average of 100 or even 1000 samples and save that as 7.0. Then tell the user to move to 10.0. The idea would be to grab the average reading for each solution, not the worst case excursion of the noise.

Any thoughts?

Don
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: pH Calibration issue

Post by rimai »

Makes sense.
Can you code a single function to do that? :)
Roberto.
rossbryant1956
Posts: 471
Joined: Sat Jan 14, 2012 2:08 pm
Location: Montgomery Village, MD

Re: pH Calibration issue

Post by rossbryant1956 »

I have been very unhappy with my pH probe since I messed it up playing with the high\lows one day learning to code. Out of the box, when first calibrated, it worked beautifully, reading in the 8.4's, which this tank has been since day one. After I messed it all up. roberto told me where it went wrong, I re-calibrated, captured the right values and now it ranges between 7.8 and 7.9. Nothing has changed in the tank.

I wonder about the noise idea, tho. I recently calibrated again, close to my tank where there is quite a lot of flow going thru. Could vibration be effecting it?
Roscoe's Reefs - Starting Over Again:

Building new 29g Nano after landlord went berserk over my 4 75 gallon tanks, Multiple RA's, Water mixing stations, etc. Your help welcomed in remembering all I've forgotten.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: pH Calibration issue

Post by rimai »

Do you have the Client software?
When you read the memory values, does the pH numbers match to those you wrote down?
Roberto.
rossbryant1956
Posts: 471
Joined: Sat Jan 14, 2012 2:08 pm
Location: Montgomery Village, MD

Re: pH Calibration issue

Post by rossbryant1956 »

rimai wrote:Do you have the Client software?
When you read the memory values, does the pH numbers match to those you wrote down?
Yep, I looked again and there is quite a range in my 7.0 numbers 510, 539, and 592; currently using 539

my 10.0 numbers are 500, 827, 828, using 827
Roscoe's Reefs - Starting Over Again:

Building new 29g Nano after landlord went berserk over my 4 75 gallon tanks, Multiple RA's, Water mixing stations, etc. Your help welcomed in remembering all I've forgotten.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: pH Calibration issue

Post by rimai »

That's what Don was saying.
Maybe your number was closer to the 500 or 510. They are the two bottom numbers.
Roberto.
dedvalson
Posts: 140
Joined: Tue Oct 04, 2011 5:49 am

Re: pH Calibration issue

Post by dedvalson »

rimai wrote:Makes sense.
Can you code a single function to do that? :)
I think I can do that. The only thing I am not totally sure how to do is to present messages to the user.

I figure it will go like this.

User press "pH Calibration"
Screen says "Put probe in 7.0 calibration solution and then press OK"

The software would then wait till the reading stopped moving and was just showing noise.

Screen says "Put probe in 10.0 calibration solution and then press OK"

The software again waits till the reading stops moving and is just showing noise.

The screen then says "pH calibrated. Press OK to accept, Cancel to return to old values.

What functions would I use to display these prompts?

Don
dedvalson
Posts: 140
Joined: Tue Oct 04, 2011 5:49 am

Re: pH Calibration issue

Post by dedvalson »

rossbryant1956 wrote:I have been very unhappy with my pH probe since I messed it up playing with the high\lows one day learning to code. Out of the box, when first calibrated, it worked beautifully, reading in the 8.4's, which this tank has been since day one. After I messed it all up. roberto told me where it went wrong, I re-calibrated, captured the right values and now it ranges between 7.8 and 7.9. Nothing has changed in the tank.

I wonder about the noise idea, tho. I recently calibrated again, close to my tank where there is quite a lot of flow going thru. Could vibration be effecting it?
I don't think vibration can bother the pH probe any (other than maybe to break it). But electrical noise can. Being near a pump or heater can greatly change the reading. I also find that the depth of immersion has a big effect on the reading. To see if you are having electrical interference methods, take a cup of water out of your aquarium and put the pH probe in the cup with the cup as far as possible away from the aquarium and setting on an insulator (such as a book). If you get a much different number that way, you are fighting an electrical interference issue.

I have started using a different (ad hoc) calibration method. I put the proble firmly where it is going to be located permanently. I wait till the middle of the night when my pH is at it's lowest, and I manually change the 7.0 calibration number till the reading from the unit Hannah pH meter says. Then I wait till the brightest part of the day when my pH is highest and manually change the 10.0 number till I get a match. Then I usually have to go back and forth a few times, making smaller and smaller changes over several days till I get an accurate match with my meter. Note that whenever you change the calibration numbers you must reset the controller before they take effect.

Don
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: pH Calibration issue

Post by rimai »

Look at the SetupCalibratePH() function in the ReefAngel.cpp file.
It's got the basis for you to start with something :)
Roberto.
sebimme
Posts: 26
Joined: Sat Jan 07, 2012 12:56 am

Re: pH Calibration issue

Post by sebimme »

I totally rushed dedvalson, we need a more accurate way to calibrate the pH. the frequent fluctuations during the calibration phase, especially (in my case) in step PH 10 mean that while the value read is 805 the controller writes in memory 830.
Roberto can do something to that effect?
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: pH Calibration issue

Post by rimai »

v0.9.7 will have that.
I already created it and it is on my dev branch of the libraries if you want to take a look.
Roberto.
sebimme
Posts: 26
Joined: Sat Jan 07, 2012 12:56 am

pH Calibration issue

Post by sebimme »

Ok, i can take a look!!
Thank you!
sebimme
Posts: 26
Joined: Sat Jan 07, 2012 12:56 am

pH Calibration issue

Post by sebimme »

Perfect Roberto!!!! Excellent algoritm for calibration!!!
Definitely you are the man!!!!
Thank you!
Post Reply