Banner image

cypho's 36" DIY reef (1 Viewer)

As cypho alluded ( edit- not eluded) to, it's all about the fluctuations. Depending on when the lights turn of and on compared to KHG sampling, I can get a fluctuation of up to about .2 dkH. Technically that is acceptable in the KHG literature as they claim a +- .1 on accuracy.The KHG wants to then dump a bunch of bicarb in and I get some system perturbation.
I ended up using it as mostly a monitor and limited it to being able to add equivalent to a .03 dKH amount per test result (every 4 hours.)
 
Last edited:
I took advantage of the warm weather and had some new chemicals shipped (liquids shipped via ups or usps tend to arrive as solids this time of year). With any luck it will be everything I need for the Ca and Mg titrations. I'm still a long way off from my first Ca test. But today I had a bunch of fun with the first ingredient: NaOH.

The purpose of the NaOH is to raise the pH of the sample high enough to cause the magnesium to precipitate. You have to remove the Mg to test the Ca because the titrant binds to both. ( a fact that makes adding in the Mg test a super easy extra ). I was originally going to buy NaOH solution but I recently realized that the exact strength of the solution does not matter since I was going to use the pH probe to tell me when to stop anyway. If I mix my own NaOH solution it is way cheaper. Enough pellets to make 200 liters, costs about the same as 500ml of solution.

So I mixed 59.99gm of NaOH with 1500 ml of RO water and poured it in a nice jar I labeled 0.1M* NaOH. (* yes I know - keep reading)

I was about to call it a day when a lightbulb went off. I don't just have to trust that I made the solution properly. I have already built the perfect tool to test it. The only difference between an Alkalinity test and a test of the strength of NaOH solution is the pH of the inflection point. Instead of an inflection point near 4.5 the inflection point will be at 7. So I tweaked a few lines of code and sent my solution though my titrator. As the titration was running I noticed something very odd. More and more and more HCl was going in and the pH was not changing at all. And then all of a sudden it hit me. I forgot to divide by 10. I did not make 0.1M NaOH, I made a 1M solution. Whoops. I canceled that test not to waste any more reagent and I diluted the solution 10x and tried again. It worked, the solution was 0.089 M. I added a few more granules and ran the test again, this time 0.104. Back to back tests resulted in: 0.103, 0.105, 0.104 So 3 significant figures, just like the alk test.

Now that the test is working, I started looking more closely at the data, and then things got really interesting. The inflection point should be exactly 7. But it was not. The inflection point was at was at 6.86. That would seem to indicate the pH probe's calibration is a bit off. Not enough to matter for this project, but still, enough I should fix that if I can.

So I asked the titrator to use that same titration data to calculate a suggested pH 7.0 calibration value. It suggested that I change the calibration from 2039 to 2055.

I updated the pH 7 calibration value as suggested and then opened a Milwaukee calibration packet. The packet label said the result should be 7.03 +/- 0.01.

And I got pH 7.04 I accidentally taught the titrator to automatically calibrate its pH probe!
 
Last edited:
very very cool stuff well done.
 
Getting close to declaring success. I just need to define the endpoint.

Is it when the color begins to change, when the color finishes changing, or when the color is changing the most rapidly?



Screenshot 2018-03-03 at 7.04.12 PM.png



I am leaning toward the point where the color is changing the most rapidly based on this:
https://chem.libretexts.org/Textbook_Maps/Analytical_Chemistry_Textbook_Maps/Map:_Analytical_Chemistry_2.0_(Harvey)/09_Titrimetric_Methods/9.3:_Complexation_Titrations#Finding_the_End_point_by_Monitoring_Absorbance


So here is the data looks like using the inflection point (when the color is changing most rapidly)
ca.png
 
Last edited:
So I ended up not following my original plan .

1 - it turns out after all that effort making and testing the 0.1M NaOH solution that 0.1M is not strong enough.

As the magnesium begins to precipitate as Mg(OH)2 it absorbs a ton of OH and the pH stops rising. I don't know why this was a surprise as now it seems obvious. For a 10ml sample, it took about 15 ml of 0.1M NaOH to raise the pH to 12. Not the end of the world, but the cup was starting to get pretty full. So I added more NaOH pellets and increased the strength back up to around 1M.

The way the pH sticks around so long in the 10's has me wondering if I measure the amount of NaOH required to push past the hump if I can calculate the Mg concentration as a byproduct of the calcium test and I won't even need to do the real Mg titration.

2 - I had not tested the color sensor since I had the problem with the loose 12v wire frying everything. I should have tested it because when I plugged the color sensor back in it immediately crashed the pi. Turns out that part was also toast. Instead of replacing the part I decided to try using a camera instead since I already had a camera in the spare parts bin.

The camera seems to be working.

I am using the raw pixel values from before demosaicing and white balancing to avoid errors caused by picture-to-picture color shifts when the camera inevitably tries to correct to color. I have not looked into manually setting the exposure to prevent the camera from introducing errors by using different exposures from one picture to the next. But I am using the ratio of Red to Blue pixels as my datapoint which it should at least somewhat cancel out the effect of changes in the shutter-speed or gain.

And as a bonus can takes cool pictures and videos of the testing process. All of the pixels in the square area are averaged together for the color value.

out.jpg
 
I decided to give the glass refillable pH probe another chance. The specs call for refilling with 4M KCl. But I could not find reasonably priced 4M KCl so I decided to give saturated KCl a shot since that is inexpensive (and easy to mix myself if I end up using a lot).

The saturated KCl seems to be working OK. But it needs to be refilled daily. By 48 hours the readings are beginning to become erratic and by 36 hours it is totally dead.

The refillable probe is significantly faster. The readings seem to stabilize about twice as fast as with the gel probe. I am tempted to add another pump so I can automatically top off the probe each day. Perhaps one of these really cheap pumps since precise dosing is not needed.

Here are two photos 24 hours apart.
1.jpg
 
Crazy to see it drop like that, is it primarily because it's not meant to be uncapped continuously?
 
I'd drill the refill hole bigger and fix a much larger container to the side of it, but not increase the overall height so pressure isn't more. How long would a gallon last? (o:
 
I am still slightly perplexed that you are going through that much filling solution. I have gone months without refilling. I suppose that you are constantly in a low(er) ionic strength solution rather than making a measurement and then keeping it in the storage solution.


Sent from my Pixel using Tapatalk
 
I am still slightly perplexed that you are going through that much filling solution. I have gone months without refilling. I suppose that you are constantly in a low(er) ionic strength solution rather than making a measurement and then keeping it in the storage solution.

Crazy to see it drop like that, is it primarily because it's not meant to be uncapped continuously?

I think that is a lot of it. The probe was not intended for 24/7 use. It does not really use that much solution, it just does hold very much, and the probe stops working long before it is bone dry.

http://www.ph-meter.info/pH-electrode-testing-parameters
I have had no luck finding any specs on this particular probe. But according to this site typical leak rates are 0.2 to 1.5 mL/24 hours.

I would guess I am losing around 1 ml of KCl / 24 hours. So it seems to be within the normal range.

And even I found a different probe that was closer to the 0.2 side of normal, the probe would still need to be topped off often enough that automated refilling would be required for 24/7 useage.
 
Last edited:
so what about gluing an airline nipple to the filling hole and running that to a basin of solution? I'd assume the height could not be much more then the top of the typical probe or else it will leak at a higher rate.
 
so what about gluing an airline nipple to the filling hole and running that to a basin of solution? I'd assume the height could not be much more then the top of the typical probe or else it will leak at a higher rate.
I'm sure a gravity feed system could work. But a pump seems a lot easier.
 
I'm sure a gravity feed system could work. But a pump seems a lot easier.
I guess where I get hung up on the pump is trying to figure out how you'll have the pump know when to fill. If you do it at a determined rate I'd think it would be at risk of eventually over/under filling... maybe not a problem.
 
I have stayed up all night every day this week trying to figure out how to model the data so I can determine the inflection point and calculate the Ca & Mg.

The alk test was so easy, the curve looked just like a 3rd order polynomial. So that was the first thing I tried that and it fit the data beautifully.

But the Ca and Mg tests each have their unique own shapes, and neither shape was nearly as easy to model.

It was not too difficult to approximate the Ca curve with a higher order polynomial 5 or 7 seemed to work pretty well. The problem with higher order polynomials that they often have multiple inflection points. Which obviously defeats the whole purpose of modeling the data. I need just one inflection point. I spent most of my effort trying to figure out how to force the pi to only consider polynomials with one inflection point. But I was never able to crack that nut. But eventually I found that by putting a little extra weight (but not too much) on the data near the inflection point, I could pretty reliably get the pi to find a single inflection point polynomial that fit the data.

The preliminary results look very promising. It is looking like at least 1 ppm resolution.

ca.png
 
Last edited:
I guess where I get hung up on the pump is trying to figure out how you'll have the pump know when to fill. If you do it at a determined rate I'd think it would be at risk of eventually over/under filling... maybe not a problem.

No problem to over fill. I would have it add a bit of KCl before each test and any extra would just spill over into the reaction chamber and be flushed away in the pretest rinse cycle. But a little bit of KCl should not have any impact on any of the tests so even if it happened mid-test it would not be a problem.

That said, it should be possible to use the camera to monitor the fill level and only add solution when it is needed. Actually that sounds like a fun project.
 
Makes sense, that would be a more elegant solution I would think then a hokie bucket and tube or something.
 
The Mg test still needs a bit of fine tuning but it is coming along nicely as well.

The Mg test surprised me in a couple ways. The first thing was that it uses a ton of EDTA reagent. So much that I had to cancel the first test and start over with a smaller sample because I started to worry the cup was going to overflow.

If I had taken the time to do the math ahead of time this should not have come as a surprise. But I just fed the titrator the equations and said go. The EDTA titration is actually counting the number of Mg/Ca atoms in the sample. Because each Mg atom weighs about half as much as a Ca atom, the 3x difference in ppm translates into 6x the number of atoms. So titrating the Mg takes 6x as much EDTA as titrating the Ca. And then on top of that the Mg test is actually titrating Mg + Ca, so that pushes it up to 7x

So I reduced the sample size down to 3 ml. Compared to 17ml for alk and 9 ml for calcium.

The next surprize was just how sharp and drastic the color change is. I suspect this is also related to the small size/lightness of the Mg atom. But it also could be that the Calmagite indicator is just that much better than the Hydroxynaphthol Blue indicator.

The sharpness is a good thing in theory, but it ended up making the task of picking an inflection point much harder. No matter what I tried I could not get a polynomial to come close to fitting the data. For a while I thought I might have to just average the two points with the biggest jump. But that is very error prone because if either of those two points are off it can have a big impact on the result. Eventually I landed on modeling the data with a logistic function. The fit is not perfect, but it is the best I have found so far.

It is certainly good enough. It is not like there is any need for extreme precision on the Mg test. But the goal of this project has never been "good enough", the goal is as good as possible, so I will probably continue to look for a better fitting curve.

This is the best test so far. But it still needs work. I want more data points on the transition, and fewer points on either end. I am hoping that will result it a better fitting curve and a faster test.

mg.png
 
My first Ca and Mg tests were way too high. I re-calibrated all of the pumps and all but 1 checked out. The sample dosing pump was way off. Stability is far more important than any particular value, so miscalibrated pumps are not a danger to the reef as long as the change is not sudden. But this has reinforced the importance of pump calibration. I don't like doing maintenance so next on the to-do list is going to be automatic pump calibration.

There only 3 pumps that need to be precisely calibrated. EDTA, HCl and sample. All of the other pumps can be way off and have no impact on the results.

For HCl and EDTA, I can titrate them each with NaOH and use the results to calibrate the HCl, EDTA, and NaOH pumps.
  • If the HCl titration shifts but the EDTA titration does not, then the HCl pump's calibration needs to be adjusted by the amount of the shift.
  • If the EDTA titration shifts but the HCl titration does not, then the EDTA pump's calibration needs to be adjusted by the amount of the shift.
  • If both the HCl and EDTA titrations shift by the same amount, then the NaOH pump's calibration needs to be adjusted by the amount of the shift.
  • If the HCl and EDTA titrations shift by different amounts, then multiple pumps are off and all will need manual re-calibration.
So all that is left if is the sample pump.

I think my fist choice will be to see if I can figure out how to use the camera to detect when the water level in the cup reaches a line painted on the side of the cup. Alternatively I could use a float switch optical water sensor. I doubt any of these would be nearly as accurate as the manual calibration, but they should be plenty accurate to catch a mis-calibration before it becomes bad enough to push the tank parameters out of a safe range.
 
Slight regression back to the mechanical side of life. I may have missed how you auto rinse and remove liquids from the cups.
 

Users who are viewing this thread

Back
Top