Macro complexity / custom programming within reef-pi?

Alfhari

New Member
View Badges
Joined
Apr 12, 2021
Messages
2
Reaction score
1
Location
Braunschweig, Germany
Hi,

I just recently came across reef-pi and I am thinking about building an all-in-one controller for my tank with it.
One part of that project would be an alkalinity monitor/controller that requires a slightly more advanced macro/programming.
The basic workflow would look like this:

Doser empties, flushes, and fills test vessel with tank water.
Magnetic stirrer starts.
pH probe records pH.
Doser adds acid in small quantities, with breaks for stirring in between, until target pH is reached, dosing slower / taking longer stirring breaks the closer the pH gets to the target value.
The total volume of acid dosed is saved as a variable.
Doser empties, flushes, and fills test vessel with tank water.
Magnetic stirrer stops.
KH is calculated with the obtained values and displayed in a graph.
Doser adds KH reagent to the tank according to the previous measurement.
Dosed volume is displayed as second data point within the KH graph.
Rinse and repeat at a certain interval.

The hardware part is fairly trivial and obviously not a problem for reef-pi.
From what I have seen of the UI thus far, I am unsure about the calculations and such required for this project.
Is impossible to have such complex macros within reef-pi?
If not, is there a simple way to add custom code to the overall program that follows the workflow above?


Best,
Janis
 
Fritz

attiland

Well-Known Member
View Badges
Joined
Jul 22, 2020
Messages
608
Reaction score
414
Location
United Kingdom
Hi,

I just recently came across reef-pi and I am thinking about building an all-in-one controller for my tank with it.
One part of that project would be an alkalinity monitor/controller that requires a slightly more advanced macro/programming.
The basic workflow would look like this:

Doser empties, flushes, and fills test vessel with tank water.
Magnetic stirrer starts.
pH probe records pH.
Doser adds acid in small quantities, with breaks for stirring in between, until target pH is reached, dosing slower / taking longer stirring breaks the closer the pH gets to the target value.
The total volume of acid dosed is saved as a variable.
Doser empties, flushes, and fills test vessel with tank water.
Magnetic stirrer stops.
KH is calculated with the obtained values and displayed in a graph.
Doser adds KH reagent to the tank according to the previous measurement.
Dosed volume is displayed as second data point within the KH graph.
Rinse and repeat at a certain interval.

The hardware part is fairly trivial and obviously not a problem for reef-pi.
From what I have seen of the UI thus far, I am unsure about the calculations and such required for this project.
Is impossible to have such complex macros within reef-pi?
If not, is there a simple way to add custom code to the overall program that follows the workflow above?


Best,
Janis
I think you need to start a python script for this but not sure how can be done. I would be interested in this myself
 

Ranjib

7500 Club Member
View Badges
Joined
Apr 16, 2016
Messages
8,689
Reaction score
15,236
Location
Palo Alto, Bay Area
Alk monitoring is not built in reef-pi. we are still working on the stepper driver, which i think is a hard requirement for the alk monitoring.
 
OP
A

Alfhari

New Member
View Badges
Joined
Apr 12, 2021
Messages
2
Reaction score
1
Location
Braunschweig, Germany
Hi Ranjib,

thank you for stepping in!

Having thought about my initial concept a bit more, I do not think a stepper driver is required here. Actually, one should probably not use timed breaks for stirring at all. That would add more margin for error to the process from the starting and stopping of the doser, different size of droplets, and so on. It might be a very small error, but still.
Instead, imho the best solution might be to use a 0.03 - 1.0 ml/min doser and have that running continuously over the entire duration of the test. Acid would be dripped in via a capillary and the amount dosed per unit of time would be regulated by the difference to target pH. The actual concentration of the acid standard should allow for all the tweaking one would ever need.

Which then brings me back to the initial question of programmability.

Best,
Janis
 
Last edited:

Ranjib

7500 Club Member
View Badges
Joined
Apr 16, 2016
Messages
8,689
Reaction score
15,236
Location
Palo Alto, Bay Area
Make sense. I like this idea, though i dont know practically how feasible this is without testing. Let us know what you learned.

Regarding the programmability. Theoretically this should be possible with the existing bits and API. Everything you do via UI can be done by API. macros can do the individual steps (i.e run doser to fill water using an ato ). Calculations in between the steps has to be done by the script that you are using to perform the end to end logic. The required metrics (number of seconds doser run) can be obtained through the usage api (e.g./api /atos/1/usage). You can emit the computed kh value via mqtt, prometheus or any other means.

The macro will likely be pretty involved. If this is a common usage, we can consider writing this as first class module within reef-pi. I also wonder if a dedicated, purpose built, micro-controller based (e.g. esp32 ) is better for this type of workload.

None the less, very exciting to hear you are experimenting with this.
 
Zoanthids

attiland

Well-Known Member
View Badges
Joined
Jul 22, 2020
Messages
608
Reaction score
414
Location
United Kingdom
Make sense. I like this idea, though i dont know practically how feasible this is without testing. Let us know what you learned.

Regarding the programmability. Theoretically this should be possible with the existing bits and API. Everything you do via UI can be done by API. macros can do the individual steps (i.e run doser to fill water using an ato ). Calculations in between the steps has to be done by the script that you are using to perform the end to end logic. The required metrics (number of seconds doser run) can be obtained through the usage api (e.g./api /atos/1/usage). You can emit the computed kh value via mqtt, prometheus or any other means.

The macro will likely be pretty involved. If this is a common usage, we can consider writing this as first class module within reef-pi. I also wonder if a dedicated, purpose built, micro-controller based (e.g. esp32 ) is better for this type of workload.

None the less, very exciting to hear you are experimenting with this.
Is there a chance to have the ability to fire up a script straight from Reef-pi scheduler? That would open a whole new word of possibilities and compatibility to other bespoke or currently unsupported hardware and software.
 

Ranjib

7500 Club Member
View Badges
Joined
Apr 16, 2016
Messages
8,689
Reaction score
15,236
Location
Palo Alto, Bay Area
Is there a chance to have the ability to fire up a script straight from Reef-pi scheduler? That would open a whole new word of possibilities and compatibility to other bespoke or currently unsupported hardware and software.
Not right now.. but i dont see why we cant have something like this. it will be risky (as in users can hamper the performance), but i think its ok.. its just a side effect of the power that it brings with
 

attiland

Well-Known Member
View Badges
Joined
Jul 22, 2020
Messages
608
Reaction score
414
Location
United Kingdom
Not right now.. but i dont see why we cant have something like this. it will be risky (as in users can hamper the performance), but i think its ok.. its just a side effect of the power that it brings with
I think those who really would use it know the risk. It assumes a certain level of knowledge. Currently I have turn on virtual hardware and monitor it from outside of UI if I want to do something like this than I have the problem to feed the result back. I probably use 3 times more resources than would be required if the feature would exists.
 

Ranjib

7500 Club Member
View Badges
Joined
Apr 16, 2016
Messages
8,689
Reaction score
15,236
Location
Palo Alto, Bay Area
I think those who really would use it know the risk. It assumes a certain level of knowledge. Currently I have turn on virtual hardware and monitor it from outside of UI if I want to do something like this than I have the problem to feed the result back. I probably use 3 times more resources than would be required if the feature would exists.
True, which is why im considering adding something like this.
 
Orphek OR3 reef aquarium LED lighting

HOW MUCH DO YOU LIKE ZOANTHIDS?

  • LOVE them

    Votes: 258 42.9%
  • Like them

    Votes: 162 26.9%
  • They're "ok"

    Votes: 121 20.1%
  • Don't like them

    Votes: 31 5.1%
  • Hate them

    Votes: 22 3.7%
  • Other (please explain)

    Votes: 8 1.3%
Battlecorals
Top