DIY Alkalinity Monitor

OP
OP
Borat

Borat

Valuable Member
View Badges
Joined
Apr 4, 2021
Messages
1,512
Reaction score
1,754
Location
United Kingdom
Rating - 0%
0   0   0
This is a well-tested technology for me now..

Reaction chamber will be 150mm high - this is sufficient to hold 130ml of sample water. The monitor will generally use 100ml sample water. For 100ml sample and alkalinity of 8 DKH the approximate volume of 0.1N hydrochloric acid is 2.9ml. Pumps are able to dose acid with high precision: pumps imperfection will be less than 0.1DKH accuracy.

Main inaccuracy in titration is actually coming from your PH probe precision, not the pumps.

20220909_162531.jpg

Let me elaborate on the post I replied a few days earlier so as to make it a bit more mathematical for the wider audience:

- the dosing heads I am using utilise 2mm ID / 4mm OD tubing
- such dosing head needs to rotate roughly 5.25 turns to dose 1ml of liquid (how do I know? I ran pump calibration a few days earlier)
- 3ml of 0.1N hydrochloric acid is roughly equivalent to 8 DKH, therefore 0.1DKH is equivalent to 0.0375ml of acid dosed (3.0/[8.0*10]=0.0375)
- Nema 17 motor minimum turn angle (micro-step) is 1.8 degrees (full circle = 360 degrees), therefore it does 360/1.8=200 micro-steps (exactly that number) in a single rotation
- in order to dose the amount of acid equivalent of 0.1 DKH precision, the pump needs to do 0.2 turns (0.0375*5.25 = 0.2) or 40 micro-steps (200*0.2 = 40)
- I can turn the stepper motor by just a single micro-step: this way I would add the amount of hydrochloric acid to achieve 0.003 DKH precision (0.1 DKH / 40)
- in reality you cannot dose liquid below certain amount/precision irrespective of your available technology/equipment (such minimum amount being the volume of a single droplet)
- as an example consider Hanna Alkalinity tester (if you ever used it): you add acid to you 4ml sample volume by adding acid droplet-wise (until the sample changes colour from pink to lavender), a single droplet is probably roughly equivalent to 0.1 DKH and you simply cannot achieve better precision than that however hard you try (unless you manage to use a syringe with thinner needle)

As a summary: the pump dosing precision is 40 times more precise (!!!) than is required to achieve 0.1 DKH precision, but because of "quantization" of dosing restricted by droplet size the real precision is probably around 0.02 DKH accuracy (by my estimates).
 
Last edited:
OP
OP
Borat

Borat

Valuable Member
View Badges
Joined
Apr 4, 2021
Messages
1,512
Reaction score
1,754
Location
United Kingdom
Rating - 0%
0   0   0
Connected 3 motors, LCD screen, rotary encoder and RTC clock - so far everything works as designed.. Tomorrow I can test PH probe - this should be no problem and very straightforward.

I need to wire both fans - one of the fans will be always on and another (stirrer) will be connected via relay...

20220912_190912.jpg

Regarding the need to have a ventilation fan, do not overlook the importance of active ventilation:
- stepper motors are enclosed, so the temperature inside the enclosure is higher than in an open setup (e.g. 3d printing)
- a typical test would take about 15 min to complete and that includes certain sequence of stepper motors being turned on/off
- each stepper motor has a pin called EN (which stands for ENABLE). When you send the LOW signal to this pin, the motor effectively turns off and loses holding torque and when you want to stepper motor to do its job, you would first need to send the signal to HIGH
- generally for lower precision tasks such as peristaltic pump you can turn the motor off after each operation (e.g. you dose for 10 seconds each minute - you keep the pump in off position for 50 seconds each minute) - allowing for time to cool the motor down
- for Alkalinity monitor the one pump you would need to always keep "on" during the entire 15min of operation is acid dosing pump:
(i) the whole process starts by priming the inlet tubing and that includes aquarium water intake and acid intake
(ii) you need to prime acid line because you may get a few small air bubbles at the end of the acid dosing line (that will form due to evaporation or simply acid running off by gravity) and this may affect the test accuracy
(iii) priming of both lines is done at the very beginning, and once you primed your acid line, you need to apply holding torque to the acid stepper motor (i.e. to never switch it off): otherwise it may spin a bit back or forth to find a slightly more convenient location as the roller squeeze the tubing
(iv) this means the acid pump is effectively "continuously on" for the entire duration of the test waiting to be turned
(v) this also means that when planning for appropriately sized PSU you have to keep in mind this feature and size PSU to be able to provide current for 2 motors simultaneously, if a single stepper uses 1.5A, you need at least 12v 3A to power this device (plus you will need small extra 0.5A current to convert 12v into 5A and run peripherals and Arduino/EPS32)
 

Gogo007

Active Member
View Badges
Joined
Dec 18, 2020
Messages
150
Reaction score
67
Location
Egypt
Rating - 0%
0   0   0
There are 2 reasons for that:
- TMC 2209 drivers do not support 3.3v logic. I like those drivers because they are so silent - and also because I know how they work through previous projects.
- I don't think my PH board supports 3.3v logic either, DF Robot v2.0 does support lower voltage but not the board that I am using which is v1.2
- finally in my other Boratronic project (work in progress) I had to use Mega 2560 because I need lots of pins in use: there are 8 stepper motors on a board which is already 24pins to use, so since developing that PCB I got used to a setup of 2 controller boards working together..
Yeah you are right about the ph meter i already had the v2.0 version and its working great .. regarding tmc2209 its working for me in the esp32 i used expansion board and it was working perfect
Regarding this project i really like the code you wrote for running the stepper and i am still waiting your kh to see how you wrote the code so by calculating the number of steps the reagent pump made to get the ph down to 4.5

I am already working in same project and i am using only esp32 for sure after i finish my code i will share it with because i am doing the kh by only one stepper dosing pump and i used solenoids and 4 way line connector to only use one pump and esp32 so it will be small footprint

A4988 / Drv8825 – Stepper Motor Driver Expansion Board


a4988_expantion.jpg
 

Gogo007

Active Member
View Badges
Joined
Dec 18, 2020
Messages
150
Reaction score
67
Location
Egypt
Rating - 0%
0   0   0
Let me elaborate on the post I replied a few days earlier so as to make it a bit more mathematical for the wider audience:

- the dosing heads I am using utilise 2mm ID / 4mm OD tubing
- such dosing head needs to rotate roughly 5.25 turns to dose 1ml of liquid (how do I know? I ran pump calibration a few days earlier)
- 3ml of 0.1N hydrochloric acid is roughly equivalent to 8 DKH, therefore 0.1DKH is equivalent to 0.0375ml of acid dosed (3.0/[8.0*10]=0.0375)
- Nema 17 motor minimum turn angle (micro-step) is 1.8 degrees (full circle = 360 degrees), therefore it does 360/1.8=200 micro-steps (exactly that number) in a single rotation
- in order to dose the amount of acid equivalent of 0.1 DKH precision, the pump needs to do 0.2 turns (0.0375*5.25 = 0.2) or 40 micro-steps (200*0.2 = 40)
- I can turn the stepper motor by just a single micro-step: this way I would add the amount of hydrochloric acid to achieve 0.003 DKH precision (0.1 DKH / 40)
- in reality you cannot dose liquid below certain amount/precision irrespective of your available technology/equipment (such minimum amount being the volume of a single droplet)
- as an example consider Hanna Alkalinity tester (if you ever used it): you add acid to you 4ml sample volume by adding acid droplet-wise (until the sample changes colour from pink to lavender), a single droplet is probably roughly equivalent to 0.1 DKH and you simply cannot achieve better precision than that however hard you try (unless you manage to use a syringe with thinner needle)

As a summary: the pump dosing precision is 40 times more precise (!!!) than is required to achieve 0.1 DKH precision, but because of "quantization" of dosing restricted by droplet size the real precision is probably around 0.02 DKH accuracy (by my estimates).
You can increase the precision by decreasing the acid concentration if you make it 0.05 and one drop make 0.1dkh in 0.1m acid the one drop will be 0.05 dkh in 0.05m acid
 
OP
OP
Borat

Borat

Valuable Member
View Badges
Joined
Apr 4, 2021
Messages
1,512
Reaction score
1,754
Location
United Kingdom
Rating - 0%
0   0   0
You can increase the precision by decreasing the acid concentration if you make it 0.05 and one drop make 0.1dkh in 0.1m acid the one drop will be 0.05 dkh in 0.05m acid
That is correct.. There is some trade-off between volume of reaction chamber, strength of acid and accuracy.

I go through a litre of reagent in less than 3 months - with more diluted acid i would need a reagent storate that is larger..

For all purposes the accuracy i achieve with my monitor is more than enough.. So the points i am trying to raise are educational rather than practical..
 
OP
OP
Borat

Borat

Valuable Member
View Badges
Joined
Apr 4, 2021
Messages
1,512
Reaction score
1,754
Location
United Kingdom
Rating - 0%
0   0   0
I
Yeah you are right about the ph meter i already had the v2.0 version and its working great .. regarding tmc2209 its working for me in the esp32 i used expansion board and it was working perfect
Regarding this project i really like the code you wrote for running the stepper and i am still waiting your kh to see how you wrote the code so by calculating the number of steps the reagent pump made to get the ph down to 4.5

I am already working in same project and i am using only esp32 for sure after i finish my code i will share it with because i am doing the kh by only one stepper dosing pump and i used solenoids and 4 way line connector to only use one pump and esp32 so it will be small footprint

A4988 / Drv8825 – Stepper Motor Driver Expansion Board


a4988_expantion.jpg
TMC 2209 library would simply not compile in ESP32 - did you delete/adjust some bits of library code (such as UART support) to make it work?
 

Gogo007

Active Member
View Badges
Joined
Dec 18, 2020
Messages
150
Reaction score
67
Location
Egypt
Rating - 0%
0   0   0
I

TMC 2209 library would simply not compile in ESP32 - did you delete/adjust some bits of library code (such as UART support) to make it work?
No i used accelstepper library its very easy and it could get you back number of steps the stepper made just with one line of code when i back home i will post you part of the code i made
 

Gogo007

Active Member
View Badges
Joined
Dec 18, 2020
Messages
150
Reaction score
67
Location
Egypt
Rating - 0%
0   0   0
I

TMC 2209 library would simply not compile in ESP32 - did you delete/adjust some bits of library code (such as UART support) to make it work?
You do not need to do nothing with accelstepper lib its just two pin configuration dir and step ... You can change the step resolution from the small board driver i shown you before if you wanna 200 step per rev or more it work perfect ..
 
OP
OP
Borat

Borat

Valuable Member
View Badges
Joined
Apr 4, 2021
Messages
1,512
Reaction score
1,754
Location
United Kingdom
Rating - 0%
0   0   0
No i used accelstepper library its very easy and it could get you back number of steps the stepper made just with one line of code when i back home i will post you part of the code i made
Ahh no need - now I understand. The expansion board in your case does not do anything - it's just a pre-soldered mini-PCB.

You are basically using TMC 2209 driver as if it's generic driver. Nothing wrong with it - it's just probably not using the more advanced features of TMC 2209... I am also not sure if you are getting the benefit of TMC 2209 silent step stick - maybe you do..

Not that I am very familiar with the library nor that I am an expert in stepper motor software, but for example with TMC 2209 driver and its library you can specify RMS current for your steppers to be used by the driver..
 

BZOFIQ

2500 Club Member
View Badges
Joined
Jul 31, 2014
Messages
4,699
Reaction score
3,995
Location
NYC
Rating - 100%
9   0   0
Great going Vlad - Jak sie masz?!?

Your skillset is really impressive - it's all pleasure following your work.

Great job in showing that one does not need 2 million dollar R&D budget to come up with stuff.

Keep building!
 
Last edited:
OP
OP
Borat

Borat

Valuable Member
View Badges
Joined
Apr 4, 2021
Messages
1,512
Reaction score
1,754
Location
United Kingdom
Rating - 0%
0   0   0
The stirrer is connected (I tested it - it works fine without any PWM/voltage adjustments, spinning the stirrer bit nicely) and the wire for the top ventilation fan is in place already. Now I just need to twick the doser software a bit to make it into alk monitor.. The software part will be very straightforward, probably a couple of hours of work maximum.

Also In terms of small mechanical things that I still need to decide/do:
- top, bottom and rear cover screws
- top cover fan to be mounted and ventilation holes drilled
- bottom cover ventilation holes to be drilled
- tank water intake, purge and acid intake connectors need to be glued to the enclosure somewhere so that tubing can run from the dosing heads into the reaction chamber inside the enclosure


20220913_175529.jpg
 

Gogo007

Active Member
View Badges
Joined
Dec 18, 2020
Messages
150
Reaction score
67
Location
Egypt
Rating - 0%
0   0   0
Its so quit yes i replace it with another driver to check it was so quit than others i also not familiar with steppers and this was my first time to use them
Ahh no need - now I understand. The expansion board in your case does not do anything - it's just a pre-soldered mini-PCB.

You are basically using TMC 2209 driver as if it's generic driver. Nothing wrong with it - it's just probably not using the more advanced features of TMC 2209... I am also not sure if you are getting the benefit of TMC 2209 silent step stick - maybe you do..

Not that I am very familiar with the library nor that I am an expert in stepper motor software, but for example with TMC 2209 driver and its library you can specify RMS current for your steppers to be used by the driver..
 

Gogo007

Active Member
View Badges
Joined
Dec 18, 2020
Messages
150
Reaction score
67
Location
Egypt
Rating - 0%
0   0   0
The stirrer is connected (I tested it - it works fine without any PWM/voltage adjustments, spinning the stirrer bit nicely) and the wire for the top ventilation fan is in place already. Now I just need to twick the doser software a bit to make it into alk monitor.. The software part will be very straightforward, probably a couple of hours of work maximum.

Also In terms of small mechanical things that I still need to decide/do:
- top, bottom and rear cover screws
- top cover fan to be mounted and ventilation holes drilled
- bottom cover ventilation holes to be drilled
- tank water intake, purge and acid intake connectors need to be glued to the enclosure somewhere so that tubing can run from the dosing heads into the reaction chamber inside the enclosure


20220913_175529.jpg
IMG_20220913_203638.jpg
IMG_20220913_203748.jpg

Take a look at this i ordered for my build from aliexpress i used black tubes to avoid algae build inside the tubes those are 2*4 mm
 
OP
OP
Borat

Borat

Valuable Member
View Badges
Joined
Apr 4, 2021
Messages
1,512
Reaction score
1,754
Location
United Kingdom
Rating - 0%
0   0   0
IMG_20220913_203638.jpg
IMG_20220913_203748.jpg

Take a look at this i ordered for my build from aliexpress i used black tubes to avoid algae build inside the tubes those are 2*4 mm
This is really good - I ordered some similar connectors about 2 weeks ago (whole selection of them) from AliExpress, but I think I will only receive them in about 10 days or so..

I found these on Amazon and received them today- it was very unusual as they are not commonly sold in the UK, these connectors are 2mm ID 4mm OD :
20220914_152056.jpg
 
OP
OP
Borat

Borat

Valuable Member
View Badges
Joined
Apr 4, 2021
Messages
1,512
Reaction score
1,754
Location
United Kingdom
Rating - 0%
0   0   0
I mounted the ventilation fan in the top cover, drilled holes for air intake and also drilled holes in the bottom cover for air outflow..

Covers received their screws - the nut is held by a piece of acrylic that allows me to screw the cover/unscrew the cover easily..

20220914_143557.jpg

20220914_143606.jpg

20220914_143636.jpg

20220914_143641.jpg

20220914_151748.jpg
 

Tavero

Well-Known Member
View Badges
Joined
Aug 5, 2022
Messages
587
Reaction score
569
Location
Somewhere
Rating - 0%
0   0   0
(such minimum amount being the volume of a single droplet)
If you put a tip with a tiny hole on your dosing line you can put the tip under the water surface. That way any hcl leaving the line will react instantly with the sample but not able to react while still inside the dosing line.

Thats the same mehod industrial titration tools are doing it (they use a tiny glass membrane with micro holes inside the tip of the dosing line)

How are you going to deal with air bubbles inside the dosing line. Are you going to prime the line before each titration?
 
OP
OP
Borat

Borat

Valuable Member
View Badges
Joined
Apr 4, 2021
Messages
1,512
Reaction score
1,754
Location
United Kingdom
Rating - 0%
0   0   0
If you put a tip with a tiny hole on your dosing line you can put the tip under the water surface. That way any hcl leaving the line will react instantly with the sample but not able to react while still inside the dosing line.

Thats the same mehod industrial titration tools are doing it (they use a tiny glass membrane with micro holes inside the tip of the dosing line)

How are you going to deal with air bubbles inside the dosing line. Are you going to prime the line before each titration?
Good advice!

There should not be air bubbles (technically speaking) in the intake lines, for air bubbles to form, air needs to come from somewhere... However I can only say this with 100% certainty after I have tested this alk monitor. My previous alk monitor would never have had any air bubles - but then the dosing heads we larger and were more of peristaltic pump head type (than that of a doser)..
 

Form or function: Do you consider your rock work to be art or the platform for your coral?

  • Primarily art focused.

    Votes: 18 7.8%
  • Primarily a platform for coral.

    Votes: 40 17.4%
  • A bit of each - both art and a platform.

    Votes: 155 67.4%
  • Neither.

    Votes: 11 4.8%
  • Other.

    Votes: 6 2.6%
Back
Top