Pi-casso : an automatic alkalinity tester

SDchris

Member
View Badges
Joined
Mar 3, 2015
Messages
81
Reaction score
113
Location
Sydney
This is early development stage of an open source automatic alkalinity tester.
System:
- Raspberry pi. Development in Python. Utilizing influxdb and grafana for visual dev.
- Stepper motor for sample fill and reagent dosing
- Dc motor for sample drain
- pH probe and altas pH sensor. Future: reef-pi pH sensor board.
- HCL titrant.
Photo's of the test set up:

The steppers and dosing pumps are Kamoer. Still deciding if I like these steppers.

alk_tester.jpg


pH sensor top-right. Raspberry pi 3 shown. Currently using pi-zero w

rear_view.jpg


Stepper motor drivers and ULN2003 for dc motors
Stepper drivers are TMC2100. Started with DRV8255 drivers but way to noisy.

driver.jpg


Bluelab double junction pH probe in the picture. Has since changed to atlas's pH probe. The Bluelab was ridiculously slow in between readings
beaker.jpg


Magnetic stirrer. PC fan with blades removed and a couple small magnets glued on.

mag_stirrer.jpg


Running on the test bench.

test_setup.jpg


Some of the current measurements for testing purposes.
Currently calculating alkalinity by:
- End-point
- inflection point
- modified gran plot method. Via open-source program named Calkulate

Long term precision is probably around 0.25 - .35 dkH alkalinity. Still a bit of work to do

metrics.jpg


Chris
 
Top Shelf Aquatics

Dr. Dendrostein

Marine fish monthly
View Badges
Joined
Nov 8, 2017
Messages
8,083
Reaction score
16,666
Location
Fullerton, California
This is early development stage of an open source automatic alkalinity tester.
System:
- Raspberry pi. Development in Python. Utilizing influxdb and grafana for visual dev.
- Stepper motor for sample fill and reagent dosing
- Dc motor for sample drain
- pH probe and altas pH sensor. Future: reef-pi pH sensor board.
- HCL titrant.
Photo's of the test set up:

The steppers and dosing pumps are Kamoer. Still deciding if I like these steppers.

alk_tester.jpg


pH sensor top-right. Raspberry pi 3 shown. Currently using pi-zero w

rear_view.jpg


Stepper motor drivers and ULN2003 for dc motors
Stepper drivers are TMC2100. Started with DRV8255 drivers but way to noisy.

driver.jpg


Bluelab double junction pH probe in the picture. Has since changed to atlas's pH probe. The Bluelab was ridiculously slow in between readings
beaker.jpg


Magnetic stirrer. PC fan with blades removed and a couple small magnets glued on.

mag_stirrer.jpg


Running on the test bench.

test_setup.jpg


Some of the current measurements for testing purposes.
Currently calculating alkalinity by:
- End-point
- inflection point
- modified gran plot method. Via open-source program named Calkulate

Long term precision is probably around 0.25 - .35 dkH alkalinity. Still a bit of work to do

metrics.jpg


Chris
Very cool, keep us posted, comrade
 

Ranjib

Valuable Member
View Badges
Joined
Apr 16, 2016
Messages
7,615
Reaction score
13,605
Location
Palo Alto, Bay Area
This is early development stage of an open source automatic alkalinity tester.
System:
- Raspberry pi. Development in Python. Utilizing influxdb and grafana for visual dev.
- Stepper motor for sample fill and reagent dosing
- Dc motor for sample drain
- pH probe and altas pH sensor. Future: reef-pi pH sensor board.
- HCL titrant.
Photo's of the test set up:

The steppers and dosing pumps are Kamoer. Still deciding if I like these steppers.

alk_tester.jpg


pH sensor top-right. Raspberry pi 3 shown. Currently using pi-zero w

rear_view.jpg


Stepper motor drivers and ULN2003 for dc motors
Stepper drivers are TMC2100. Started with DRV8255 drivers but way to noisy.

driver.jpg


Bluelab double junction pH probe in the picture. Has since changed to atlas's pH probe. The Bluelab was ridiculously slow in between readings
beaker.jpg


Magnetic stirrer. PC fan with blades removed and a couple small magnets glued on.

mag_stirrer.jpg


Running on the test bench.

test_setup.jpg


Some of the current measurements for testing purposes.
Currently calculating alkalinity by:
- End-point
- inflection point
- modified gran plot method. Via open-source program named Calkulate

Long term precision is probably around 0.25 - .35 dkH alkalinity. Still a bit of work to do

metrics.jpg


Chris
Are those fixtures 3d printed ?
 
OP
S

SDchris

Member
View Badges
Joined
Mar 3, 2015
Messages
81
Reaction score
113
Location
Sydney
Sweet :) . Let us know anyway we can help . This is going to be epic :)
Thanks for the offer. I'm sure I'll take you up on that at some time. I don't have a science or programing background, so it's a learning experience for me. But I'm sure we can work our through this one to get something working.

Are those fixtures 3d printed ?
Yep. Done on a Lulzbot mini. 5 min design job in tinkercad. Will re-design the test unit after the code is sorted. Don't like the current form.

@Ranjib to get this into Reef-Pi and make this something the community really needs!
That would be nice:D
Was the earlier model called a Pi-dent?
No earlier models:)
 

KrisReef

Valuable Member
View Badges
Joined
May 15, 2018
Messages
2,877
Reaction score
10,174
Location
ADX Florence
OP
S

SDchris

Member
View Badges
Joined
Mar 3, 2015
Messages
81
Reaction score
113
Location
Sydney
BACTERIAL / ALGAL ISSUE
Haven't done much code related. Mostly been trying to tidy up some hardware related issues.
Notice this one day. See video.
Some sort of bacterial/algae film. Not sure if light is driving it or not. Might need to make a cover for the test cup.
























During cleaning noticed the pH probe bulb was also quite dirty.
After cleaning the probe in a 0.5M HCL solution the response time of the probe increased dramatically, which in turn effected the alk measurement. Will need to keep an eye on that for future reference. Maybe tracking pH at say 5 minutes post test over time to alert when the probe needs cleaning or to create some sort of off-set maybe?
 
Last edited:

ZaneTer

Well-Known Member
View Badges
Joined
Jan 14, 2018
Messages
875
Reaction score
803
Drop based measurement will be more accurate in your case. I have played and built one of these using a PLC. My major issue was that as a stepper motor rotates the volume dispensed per second is not consistent. This can be entirely bypassed by using a drop counter. To get small drops I used a medical IV needle. The sharp tapered end encourages small drops but they are still consistent.
 
OP
S

SDchris

Member
View Badges
Joined
Mar 3, 2015
Messages
81
Reaction score
113
Location
Sydney
Drop based measurement will be more accurate in your case. I have played and built one of these using a PLC. My major issue was that as a stepper motor rotates the volume dispensed per second is not consistent. This can be entirely bypassed by using a drop counter. To get small drops I used a medical IV needle. The sharp tapered end encourages small drops but they are still consistent.
I may end up going drop counter. Just want to see how accurate I can get the current setup, to have a good comparison for later. Using the needle is a great idea.:)
 
OP
S

SDchris

Member
View Badges
Joined
Mar 3, 2015
Messages
81
Reaction score
113
Location
Sydney
STEPPER DRAMAS
The dosing stepper rotates a quarter turn (4 rollers) to get an even dose amount, approx 0.08 ml. Originally I had the motor switch of between each dose. Turns out the motor would move a little after turning off. Now the motor is turned on throughout the entire test.
Also the motor driver reference voltage regulator was set a little low (0.75v). The thought behind the lower vref. was to keep the driver a little cooler. 0.75v was a little to low and the stepper was inconsistently losing steps. Have now increased it to 0.92v and reduced the motor speed to gain a little more torque, which has fixed the problem.

Have changed the filling stepper motor so that the dosing head roller ends up at the same start / finish position. Instead of having an accurate 50ml.

Those three changes have improved the accuracy between tests greatly.
For a long time I kept thinking it was some software algorithm that the biggest hurdle and was over looking the obvious.

Chris
 
OP
S

SDchris

Member
View Badges
Joined
Mar 3, 2015
Messages
81
Reaction score
113
Location
Sydney
After fixing the stepper motors, this was the result of testing every 40min.
The Y axis horizontal lines = 0.05 dKH
graph1.png


The unit draws water from a 4ltr jug. The room temperature is quite variable and likely having some effect, will come back to that issue later. I think the bulk of that slow drift upwards is caused from evaporation.

After placing some plastic on top of the water to slow evaporation, this was the result.
alk result top, air temp bottom
graph2.png


When temp is stable Alk range < 0.10

Chris
 

ZaneTer

Well-Known Member
View Badges
Joined
Jan 14, 2018
Messages
875
Reaction score
803
That’s not a bad result.

You will still have to compensate for starting pH otherwise you could easily find yourself with an additional swing of 0.3dkh depending on time of day your sample is taken.
 

ZaneTer

Well-Known Member
View Badges
Joined
Jan 14, 2018
Messages
875
Reaction score
803
Try measuring the volume required to shift the sample from 7.8pH to 4.4pH

You need to ignore the first acid input until the sample is below 7.8pH
 

Ranjib

Valuable Member
View Badges
Joined
Apr 16, 2016
Messages
7,615
Reaction score
13,605
Location
Palo Alto, Bay Area
After fixing the stepper motors, this was the result of testing every 40min.
The Y axis horizontal lines = 0.05 dKH
graph1.png


The unit draws water from a 4ltr jug. The room temperature is quite variable and likely having some effect, will come back to that issue later. I think the bulk of that slow drift upwards is caused from evaporation.

After placing some plastic on top of the water to slow evaporation, this was the result.
alk result top, air temp bottom
graph2.png


When temp is stable Alk range < 0.10

Chris
Super duper exciting!
 
OP
S

SDchris

Member
View Badges
Joined
Mar 3, 2015
Messages
81
Reaction score
113
Location
Sydney
I'm not finding that much variation between the test algorithms for calculating alkalinity, which is a little surprising. That could also be a result of titration method ??? ATM the titration method is to add 0.08ml every 5 seconds, down to a pH of 3.6.

The end point method is straight forward:
Python:
endpoint_counter = 0

if pH > 4.5:
    high_acid_amount = acid_dosed
    high_pH = pH
if pH <= 4.5 and endpoint_counter < 1:
    low_acid_amount = acid_dosed
    low_pH = pH
    endpoint_counter = 1
 
x = [low_acid_amount, high_acid_amount]
y = [low_pH, high_pH]
end_point = numpy.interp(4.5, y, x)
The inflection point method generally works but is prone to wild readings every 10 or 20 tests. Will need to look into this.
Y is a list of pH values between 5.2 and 4.0.

Python:
def inflection_point():
    z = numpy.polyfit(x, y, 3)
    d = numpy.poly1d(z)
    dd = d.deriv(2)
    dr = numpy.roots(dd)
    dkH = (((dr * 0.0235) * 50000) / 50) * 0.056
    return dkH
 
Last edited:

Are you a Builder, Maintainer or Both?

  • I woud rather build out a new system

    Votes: 127 24.6%
  • I would rather maintain a system than build it out

    Votes: 57 11.0%
  • I's passionate about both

    Votes: 333 64.4%

Online statistics

Members online
2,090
Guests online
9,814
Total visitors
11,904
The Random Flow Generator™ Nozzle by VCA
Top