ReefRhythm - Advance Stepper Motor Controller with OpenSource

zerokewl

Community Member
View Badges
Joined
Feb 21, 2023
Messages
29
Reaction score
3
Location
Mississippi
Rating - 0%
0   0   0
Would it be possible to use something like a btt octopus controller board instead of the mks 42c boards
 
OP
OP
yury88

yury88

Active Member
View Badges
Joined
Oct 21, 2023
Messages
209
Reaction score
160
Location
indo-pacific
Rating - 0%
0   0   0
Would it be possible to use something like a btt octopus controller board instead of the mks 42c boards
With this project no, G-code is different.

But similar project/extension its possible. Firmware like Marlin has standardized and well-documented G-code. So no matter what motherboard you choice- it all will work.
This way already better tham make your own board from scratch.

But things that should be considered:
1)all motors are controlled by one command, its only one brain on board and it's cant handle commands in parallel.
2)Gcode works with coordinates, so need to make some abstraction to confert ml/min to units/speed.

When I was checking these I decided that Servo 42C less complicated with price just little more expensive, and more important its close-looped system and I can run autotests on real hardware to check doser logic.
 
OP
OP
yury88

yury88

Active Member
View Badges
Joined
Oct 21, 2023
Messages
209
Reaction score
160
Location
indo-pacific
Rating - 0%
0   0   0
Hi everyone, let's I answer about common question about using Third-Party controllers to control these pumps.

So usually all aquarium controllers has locket system without any API and the only way to use "Analog control":
1)0-10V port
2)PWM port
3)Just turn on/off by power

So in version v0.6 I added feature for Analog control.
Its mean that controller now can read ADC value from one of the pin and run pump accordingly the setting.
Settings now can be adjusted in WEB UI, and it's not just linear, its super flexible.

You can set any not linear logic. Its was added because one of my friends told me that GHL can transmit PH signal over 0-10V port.

----------------------------------------
Pump for Hydroxides:
I'm not sure how exactly GHL works, by in my imagination it will set 8.3V for 8.3PH, so you can adjust pump to start dosing hydroxides(limewater etc) if PH less that 8.29, for example, and faster if PH goes down.

It these case pump will dose 10ml/min if PH 7.7 and 1ml if PH 8.3
and will turn off if PH less than 7.7 and bigger than 8.3
Screenshot 2024-04-19 at 12-04-22 Dosing Control.png

------------------------------------------------------------
Pump for Calcium reactor:
lets just imagine that Calcium reactor is working in pair with hydroxide dosing, so it will turn of at night when PH goes too low to use hydroxide.

In these example pump will dose 33ml/min(2l/hour) if PH 8-10 and turn off if below:
Screenshot 2024-04-19 at 12-20-08 Dosing Control.png

But of course for Calcium reactor pump you need some bigger, large flow pump head like these and bigger case:

Screenshot 2024-04-19 at 12.37.52.png
 
Last edited:
OP
OP
yury88

yury88

Active Member
View Badges
Joined
Oct 21, 2023
Messages
209
Reaction score
160
Location
indo-pacific
Rating - 0%
0   0   0
About current limitations:
Analog control is not real-time now. Its working in cycle of 1minute.
So I do not recommend to use it for any precise dosing. But it can be used to dose diluted solutions such as Balling
My pump heads can dose 0.1ml/min, so for values like 1ml in 10min duration its ok.

Its because controller have to deal with some challenge:
1)For each "dosing" controller makes some massive calculations to convert ml/min to steps/min + motor settings. That's impossible to make every second.
2)Each "speed"(its around thousand) has unique microstep mode. So when ml/min changes its also changing stepper driver settings. Make it every second impossible.

Latter on, after careful testing in code optimization, cycle can become smaller like 10sec, buts for now its how its works.


Wiring:
1)So controller works with 3.3V signal, 10V it too much for it and will cause damage.

To connect 0-10V signal to GPIO voltage divider should be used.
Its just a 6.8K + 3.3K resistors:
Screenshot 2024-04-19 130044.png

For PWM signal scheme will be same + RC filter.

2)Its also possible to add Variable resistor(Potentiometer etc) and just connect it to internal 3.3V source, so It's will be some optional control handle for manual control.
 
Last edited:
OP
OP
yury88

yury88

Active Member
View Badges
Joined
Oct 21, 2023
Messages
209
Reaction score
160
Location
indo-pacific
Rating - 0%
0   0   0
And actually if "handle" installed you can just turn on/off pump from power to run the pump.
And it can be the way how to control pump real-time using any controller/smart plug.

Actually now its will start working after 1min, but I will fix this "bug" in next update, I think pump initialization on cold start takes ~3sec.
And I think I will just add extra option for signal source with virtual 100% signal, so its will be the way to run the pump:
1)Just turn on/off for constant speed
2)Turn on/off + 0-10V for real-time control of speed.
 
OP
OP
yury88

yury88

Active Member
View Badges
Joined
Oct 21, 2023
Messages
209
Reaction score
160
Location
indo-pacific
Rating - 0%
0   0   0
For version 2.0 I have plans to add "traditional" mode to control any stepper driver via En,Dir,Step pin.
ESP32 has dedicated ULP core that can handle some real-time operations in parallel, and as I understand its finally working over Micropython, so its can be achieved that UI and real-time stepper driver controller will run on same board.

I just need to understand how to run fancy C code on ULP core:)
But bad thing that Its actually a lot of complicated wiring for hobbits, connecting just Rx,Tx much easier...
 

zerokewl

Community Member
View Badges
Joined
Feb 21, 2023
Messages
29
Reaction score
3
Location
Mississippi
Rating - 0%
0   0   0
I was just looking for alternatives to the mks 42c I hate ordering on aliexpress and on amazon they are 25$ each which makes each doser around 60-70$ to build off amazon + time to assemble and print housings etc

I was interested in the diy method to save $$ as I need about 10 dosers to automate my entire setup but its not much cost savings vs a retail unit
 
OP
OP
yury88

yury88

Active Member
View Badges
Joined
Oct 21, 2023
Messages
209
Reaction score
160
Location
indo-pacific
Rating - 0%
0   0   0
I was just looking for alternatives to the mks 42c I hate ordering on aliexpress and on amazon they are 25$ each which makes each doser around 60-70$ to build off amazon + time to assemble and print housings etc

I was interested in the diy method to save $$ as I need about 10 dosers to automate my entire setup but its not much cost savings vs a retail unit
High quality stuff cost money, this project not about cheapest solution.
Its about Versa analog, but more durable(without plastic gearbox). And if Aliexpress available- no reason to pay more on Amazon.

If somebody will make asynchronous doser library for Marlin firmware it can be connected easily to project. Maybe I'll try someday, but for now I'm focused more on UI.
 
OP
OP
yury88

yury88

Active Member
View Badges
Joined
Oct 21, 2023
Messages
209
Reaction score
160
Location
indo-pacific
Rating - 0%
0   0   0
So far everything works well without issues with 3-head doser
I'm already running it on my tank for trace element dosing, 0.05ml dosing is piece of pie for it:)

IMG20240420004642.jpg

So these if full instruction to assemble 3-Head Doser with stand(optional)

You can find all STL to print case and Fusion 360 project here:

Or Thingiverse:

Case can be printed on any hobby-grade 3D printer, just disable raft if your printer limited to 220x220mm print size
 
Last edited:
OP
OP
yury88

yury88

Active Member
View Badges
Joined
Oct 21, 2023
Messages
209
Reaction score
160
Location
indo-pacific
Rating - 0%
0   0   0
Develop build preview- Standalone mode(schedule), fully functional.
* Working with Military time 24H format
* Dose can be added as One-time or Multi-time:
for example you want to run doser 10 times 10:00-20:00, so doser will dose 10:00, 11:00: 12:00 etc. No need to feel repetitive jobs manually.

Will appreciate for feedback. What do you thinking?
To finish I need to add Timezone and Time synchronization settings in UI
+ some usual fixes for UI
 

Attachments

  • Screenshot 2024-04-21 204135.png
    Screenshot 2024-04-21 204135.png
    33.5 KB · Views: 46
  • Screenshot 2024-04-21 210306.png
    Screenshot 2024-04-21 210306.png
    29.3 KB · Views: 41
OP
OP
yury88

yury88

Active Member
View Badges
Joined
Oct 21, 2023
Messages
209
Reaction score
160
Location
indo-pacific
Rating - 0%
0   0   0
hi @yury88, first of all, awesome work.
Just ordered the parts and will build one for my pico-reef.

Any chance we can request features? I would be great to have mqtt built-in to easy integrate with Home Assistant.

regards.
Hi, do you have an idea of what the data MQTT format should be for the dosing pump?

For understanding- this project interact with user through number:
1)Id of pump 1-9
2)Amount ml to dose
3)Dosing duration sec
4)Dosing direction(1 -clockwise, 0-counterclockwise)

5)RPM- only to run pump for calibration

-----------------------------------------------------
More advance feature for integration:
1)Calibration points table - just a list of points [(Flow ml/min, rpm)] for each pump
2)Schedule -list of [(id, amount, duration, direction, start_time, end_time, frequency)]
3)Limits for pump(its just idea) -any python code to run on controller before dosing. For example fetch some data from network sensor, or opposite- publish data/notification before dosing.
Actually I'm kinda using feature 3 with PH sensor with REST API to make PH stable with limewater, like it a lot.
 

Paulo Hanashiro

Community Member
View Badges
Joined
Jun 4, 2013
Messages
56
Reaction score
29
Location
Sydney/Australia
Rating - 0%
0   0   0
Not a specialist, but you can use different MQTT topics for each parameter, or a single topic with a json payload with everything you need.

Topic: reef/dosers/doser1/config

JSON:
{  "Parameter 1":"AA", 
   "Parameter 2": 1.0001,
   "Param3":"a long text here", 
   "range_of_params":{   
                        "Test 1": "Value",   
                        "Test 2": 1001.256,
                        "Test 3": "something" 
                     }   
}

On integrating it with Home Assistant, here you can find more details and examples.

I hope this helps.

Cheers.
 
OP
OP
yury88

yury88

Active Member
View Badges
Joined
Oct 21, 2023
Messages
209
Reaction score
160
Location
indo-pacific
Rating - 0%
0   0   0
Not a specialist, but you can use different MQTT topics for each parameter, or a single topic with a json payload with everything you need.

Topic: reef/dosers/doser1/config

JSON:
{  "Parameter 1":"AA",
   "Parameter 2": 1.0001,
   "Param3":"a long text here",
   "range_of_params":{  
                        "Test 1": "Value",  
                        "Test 2": 1001.256,
                        "Test 3": "something"
                     }  
}

On integrating it with Home Assistant, here you can find more details and examples.

I hope this helps.

Cheers.
Thank you for sharing! I'm digging in, and so far, it looks very flexible.

But flexible means that there can be hundreds of protocol realizations on how to pack data, and that can be a huge disadvantage...
I want to make it friendly for integration realization, so the "standard for community" structure of data is mandatory. I will try to find some recommended patterns for these, but if someone can help me find the right way, I'll appreciate that:)
 

robinm

Active Member
View Badges
Joined
Feb 21, 2021
Messages
101
Reaction score
69
Location
Louth
Rating - 0%
0   0   0
I've built a dosing pump controlled via MQTT. No standards I'm afraid but it accepts 4 basic commands which are Dose which has an amount and speed parameter (ml/min) + direction. Pump which has a speed parameter (ml/min) & direction. Calibrate, and Status which just returns the current status of the pump and if dosing or pumping the amount it has currently delivered. I will probably implement scheduling into it at some point but at the moment that sits at a higher level in Node Red.
 
OP
OP
yury88

yury88

Active Member
View Badges
Joined
Oct 21, 2023
Messages
209
Reaction score
160
Location
indo-pacific
Rating - 0%
0   0   0
Release v0.7 - Standalone Mode:
1)Automation dosing schedule
2)Automatic time synchronization
3)12H/24H format settings

Special feature- frequency of dosing:
1)Choose period of dosing, for example 1:00PM to 3:00PM
2)Set frequency of dosing, for example 120

Doser will automatically repeat dosing every 1minute((3-1)*60/120 =1min)
Minimal interval for one job is 15sec. So for 1PM->3PM its 2*60*4= 480

Screenshot 2024-04-22 214012.png Screenshot 2024-04-22 215620.png
 
Last edited:
OP
OP
yury88

yury88

Active Member
View Badges
Joined
Oct 21, 2023
Messages
209
Reaction score
160
Location
indo-pacific
Rating - 0%
0   0   0
hi @yury88, sorry if I missed, but did you implement continuous dosing?
This is really useful, specially for calcium reactor?

cheers.
Hi. I totally forgot about this. Let's fix it! :)
Only one thought: for a calcium reactor, you need a bigger peristaltic head and tinker with the case. Heads in the project are high-precise and not good for continuous mode for 3-5 l/h.
Let me know if your want to buy particular model- we can check part list



Release v0.7.1 - Continuous mode for pumps


1) Always on pump feature:
In Dosing->Analog Control, set the desired flow rate ml/min for signal level 100%
Choose the source of signal for the pump as 100%.
Enable analog control for pump

always_on.png

Now the pump will spin with the desired flow rate ml/min nonstop. You even can control pump by turn On/Off the power. Cold start of pump on power on takes ~ 6 sec.



2) Same as the first mode, but you can choose Pin as the source of signal. Now you can control the pump with your fancy 3-part controller with a 0–10V signal.

gpio_control.png

Use voltage divider to lover signal from 10V to 3.3V to match signal level of ESP32 controller*



3) Same as second mode, but you can also just add a variable resistor and connect it to the Pin to have an optional manual control handle to adjust flow.


4) You can actually just use the schedule feature with the same result:
Just add job in schedule 12:00AM -> 11:59PM with Duration 60sec and desired amount to dose ml. And choose frequency 1440(24h*60min)

Now your pump will continuously dose the desired flow ml/min:

schedule.png
 
Last edited:

Paulo Hanashiro

Community Member
View Badges
Joined
Jun 4, 2013
Messages
56
Reaction score
29
Location
Sydney/Australia
Rating - 0%
0   0   0
Hi. I totally forgot about this. Let's fix it! :)
Only one thought: for a calcium reactor, you need a bigger peristaltic head and tinker with the case. Heads in the project are high-precise and not good for continuous mode for 3-5 l/h.
Let me know if your want to buy particular model- we can check part list



Release v0.7.1 - Continuous mode for pumps


1) Always on pump feature:
In Dosing->Analog Control, set the desired flow rate ml/min for signal level 100%
Choose the source of signal for the pump as 100%.
Enable analog control for pump

always_on.png

Now the pump will spin with the desired flow rate ml/min nonstop. You even can control pump by turn On/Off the power. Cold start of pump on power on takes ~ 6 sec.



2) Same as the first mode, but you can choose Pin as the source of signal. Now you can control the pump with your fancy 3-part controller with a 0–10V signal.

gpio_control.png

Use voltage divider to lover signal from 10V to 3.3V to match signal level of ESP32 controller*



3) Same as second mode, but you can also just add a variable resistor and connect it to the Pin to have an optional manual control handle to adjust flow.


4) You can actually just use the schedule feature with the same result:
Just add job in schedule 12:00AM -> 11:59PM with Duration 60sec and desired amount to dose ml. And choose frequency 1440(24h*60min)

Now your pump will continuously dose the desired flow ml/min:

schedule.png
Kalk solution also benefits from a continuous dosing strategy.
Would it be feasible to dose 10ml/hour or even lower volumes? I believe this would be enough to dose kalk even in small pico-reefs.
 

HAVE YOU EVER KEPT A RARE/UNCOMMON FISH, CORAL, OR INVERT? SHOW IT OFF IN THE THREAD!

  • Yes!

    Votes: 32 45.7%
  • Not yet, but I have one that I want to buy in mind!

    Votes: 9 12.9%
  • No.

    Votes: 26 37.1%
  • Other (please explain).

    Votes: 3 4.3%
Back
Top