ReefRhythm - Advance Stepper Motor Controller with OpenSource

yury88

Community Member
View Badges
Joined
Oct 21, 2023
Messages
93
Reaction score
69
Location
indo-pacific
Rating - 0%
0   0   0

Source Code and regular build

Overview​

This project aims to provide a highly precise and stable DIY solution for dosing pumps with a user-friendly interface and extensive IoT integration capabilities.


It's designed to automate and simplify the dosing process, ensuring accurate and consistent dosing without manual calculations. Leveraging advanced stepper motor drivers with G-code control and the Ulab library for high-performance calculations, this project offers a cutting-edge solution for aquarists and hobbyists. Additionally, it features built-in OTA functionality for seamless firmware upgrades, ensuring the system remains up-to-date with the latest improvements and features.


front_view.jpg
inside.jpg




Features​

  • High Precision Dosing: Utilizes advanced stepper motor drivers to ensure accurate dosing volumes.
  • User-Friendly Interface: Designed with ease of use in mind, allowing users to manage dosing schedules and volumes effortlessly.
  • REST API: Easy integration with Reef Pi or scripts
  • IoT Integration: Offers extensive IoT capabilities for integration with various smart home systems and devices.
  • Automated Calculations: All dosing calculations are performed by the system, eliminating the need for manual input and reducing the risk of errors.
  • OTA Updates: Supports Over-The-Air (OTA) firmware updates, making it easy to upgrade to the latest version without physical access to the device.
  • Multiple pump: Support up to 9 pumps on 1 controller
  • Customizable: Flexible design accommodates different setups and requirements, making it suitable for a wide range of applications.

Hardware Requirements​

  • Controller: ESP32-S3 N16R8 with 16 MB Flash and 8 MB PSRAM, unless otherwise specified.
  • Stepper Motor Driver: BIGTREETECH MKS-Servo42C with UART control for precise motor management.
  • Power Supply: Suitable power source for the ESP-S3 controller and stepper motor driver.
  • Peristaltic Pump: DIY or commercially available peristaltic pump compatible with the stepper motor.
  • Miscellaneous: Cables, connectors, and mounting hardware as needed for your specific setup.
 
OP
OP
yury88

yury88

Community Member
View Badges
Joined
Oct 21, 2023
Messages
93
Reaction score
69
Location
indo-pacific
Rating - 0%
0   0   0
Current quick start:
1)Download all *bin files from release page:
2)Install esptool
3)Switch controller to Boot Mode and flash firmware:
python -m esptool -b 460800 --before default_reset --after no_reset --chip esp32s3 write_flash --flash_mode dio --flash_size 16MB --flash_freq 80m 0x0 bootloader.bin 0x8000 partition-table.bin 0x10000 micropython.bin
4)Restart controller
5)After fist start controller will start Wifi-Access point with name ReefRhyrhm_<random number>
Connect to this AP and open 192.168.4.1 in your browser


wifi_ap.jpg

6)Controller will restart and automatically connect to your Wifi network
You can find controller IP in Web UI of your wifi Router


7)On a first start controller will make some massive calculation and first initialization will take 3-4 min
8)Open IP of controller in your browser
 
OP
OP
yury88

yury88

Community Member
View Badges
Joined
Oct 21, 2023
Messages
93
Reaction score
69
Location
indo-pacific
Rating - 0%
0   0   0
API:
1)Dose Amount Ml in Desired time:
curl "http://<IP of controller>/dose?id=1&direction=1&volume=50&time=3600"
Where:
  • id: pump id 1 to 9, optional(default =1)
  • Direction: 0 counterclockwise or 1 for Clockwise, default 1
  • volume: amount in ml to dose
  • time - Time for which water will be dosed in seconds
For example:
curl "http://<IP of controller>/dose?volume=100&time=1800"
Will dose 100ml in 0.5h

2)Run motor with RPM:
curl "http://<IP of controller>/run_with_rpm?id=1&direction=1&rpm=100&time=10"
Where:
  • id: pump id 1 to 9, optional(default =1)
  • Direction: 0 counterclockwise or 1 for Clockwise, default 1
  • rpm: Motor RPM with 1000RPM max
  • time - Time that the motor will work
For example
curl "http://<IP of controller>/run_with_rpm?id=1&direction=1&rpm=0.5&time=60"
Motor will run with 0.5 revolution per minute(RPM) for 60 seconds

3)Check free memory on controller:
curl "http://<IP of controller>/mem_free"

return free memory in KB
 
OP
OP
yury88

yury88

Community Member
View Badges
Joined
Oct 21, 2023
Messages
93
Reaction score
69
Location
indo-pacific
Rating - 0%
0   0   0
Big update for project:
1)I added assembly instruction for single pump on the github wiki:


fully_accembled_1.jpg wiring.jpg





2)I finished code upgrade for Reef-Pi integration over universal REST API interface.
Its under code review now.

But you can already try it with my reef-pi 6.0 fork:
https://github.com/telenkov88/reef-pi/releases

After installing you need to restart reef-pi and, if you will not see new type of doser, clean the Cookie of browser.

Settings:
1)URL: http://<IP of your ReefRhytm doser>/dose?volume={{.Volume}}&time={{.Duration}}
2)Calibrate URL: http://<IP of your ReefRhytm doser>/run_with_rpm?direction=1&rpm={{.Speed}}&time={{.Duration}}

Fully functional dosing over schedule and calibration button.
Note- speed in equal to RPM, not %. So you can run pump in calibration with Speed 1000 = 1000RPM

rest_api_doser.png
 
OP
OP
yury88

yury88

Community Member
View Badges
Joined
Oct 21, 2023
Messages
93
Reaction score
69
Location
indo-pacific
Rating - 0%
0   0   0
Announce for next v0.6 version:
I will add external control over analog signal 0-10V or PWM for integration with any existing controllers.

Because ESP32 working with 0-3.3V to connect 0-10V(or PWM 0-5V) signal need to use simple resistor divider with small capacitor for signal stabilization.

In UI I'll add very simple interface for settings- will need to fill what amount of ml/min should be equal to 100% signal and activate this mode.

For example you chose 10ml/min. So with 40% signal(4V of 10V) pump will dose 4ml/min.
Controller will check signal every 10-30sec, I will chose reasonable value after testing.
So with these you can control pump using GHL, Apex, Arduino or PH controller directly etc without any tricks

If you have any requests or questions, feel free to ask.
 
OP
OP
yury88

yury88

Community Member
View Badges
Joined
Oct 21, 2023
Messages
93
Reaction score
69
Location
indo-pacific
Rating - 0%
0   0   0
I'm finished with UI for Analog Control Interface.
Soon to be new release:
 

Attachments

  • Screenshot 2024-04-08 133959.png
    Screenshot 2024-04-08 133959.png
    73.2 KB · Views: 23
  • Screenshot 2024-04-08 134013.png
    Screenshot 2024-04-08 134013.png
    62.9 KB · Views: 21
  • Screenshot 2024-04-08 134027.png
    Screenshot 2024-04-08 134027.png
    67.6 KB · Views: 24
  • Screenshot 2024-04-08 134042.png
    Screenshot 2024-04-08 134042.png
    63.2 KB · Views: 24
  • Screenshot 2024-04-08 134058.png
    Screenshot 2024-04-08 134058.png
    43 KB · Views: 23

fendanto

Community Member
View Badges
Joined
May 6, 2023
Messages
56
Reaction score
48
Location
Boston
Rating - 0%
0   0   0
This looks great! I’m building up a new system and want to give this a try soon. Happy to contribute to the controller software if needed when I’m able to get some units running.
 
OP
OP
yury88

yury88

Community Member
View Badges
Joined
Oct 21, 2023
Messages
93
Reaction score
69
Location
indo-pacific
Rating - 0%
0   0   0
This looks great! I’m building up a new system and want to give this a try soon. Happy to contribute to the controller software if needed when I’m able to get some units running.
Hi, project is already good enough for careful using. I'm currently using it for hydroxide dosing and able to stabilize my PH with 0.01 resolution.

So if your want you can already made one for yourself.
Not a lot of work a head before I will add Schedule, so project will become Standalone solution soon.
And it's easy to integrade with other projects. And of course contribution is welcome.
 

reef_hacker

New Member
View Badges
Joined
Mar 5, 2024
Messages
3
Reaction score
0
Location
Eastern PA
Rating - 0%
0   0   0
I've been thinking of doing something similar to this for a while. I'm definitely gonna build one of these instead starting from the ground up. Thanks for putting in the work!
 
OP
OP
yury88

yury88

Community Member
View Badges
Joined
Oct 21, 2023
Messages
93
Reaction score
69
Location
indo-pacific
Rating - 0%
0   0   0
I'm appreciate for interest in project.
I actually got a lot of fun doing this firmware.
I've never done Web (full-stack in this case) before, it turns out there are so many features)!

And I'm open to any functionality request, I think its time to make some cheap DIY solution that will be better that all these fancy Versa and GHL pumps with plastic gearbox)

Actually it's so cool to use "ready to go" solution for motor control. Some 3D printer motherboards also looks promising and can be controlled over UART by G-Code.

Currently I'm finishing with ADC pump control, so if someone want to use this just as adjustable pump for Calcium reactor- you just need to add some Variable resistor and you can even control pump by turn on/off from PH contoller. Or use signal 0-10V from APEX etc.

Currently only a problem that ADC has some level of noise. And for this firmware 4.9ml/min and 5ml/min are different speed and and in some case different microstep mode. And when microstep mode changing -pump(driver) should be stopped to apply new settings.

So it will not response immediately to signal changing. I will adjust cycle of ADC checking to some reasonable value like 30sec.
Later these will be less actual coz I'm planing to optimize matrix of driver settings utilizing less number of microstep mods.

Some demo of Beta
 

Attachments

  • IMG20240411125543.jpg
    IMG20240411125543.jpg
    232.9 KB · Views: 21
OP
OP
yury88

yury88

Community Member
View Badges
Joined
Oct 21, 2023
Messages
93
Reaction score
69
Location
indo-pacific
Rating - 0%
0   0   0
I'm going to start dosing some trace elements in my tank.
Made a 3-head 3D printed model for doser case with bottle stand. Based on 30mm(optimal size for this peristaltic heads) Nema17 motors
Already ordered printing:
 

Attachments

  • Screenshot 2024-04-12 150621.png
    Screenshot 2024-04-12 150621.png
    684.4 KB · Views: 14
  • Screenshot 2024-04-12 150449.png
    Screenshot 2024-04-12 150449.png
    700.2 KB · Views: 21
OP
OP
yury88

yury88

Community Member
View Badges
Joined
Oct 21, 2023
Messages
93
Reaction score
69
Location
indo-pacific
Rating - 0%
0   0   0
OP
OP
yury88

yury88

Community Member
View Badges
Joined
Oct 21, 2023
Messages
93
Reaction score
69
Location
indo-pacific
Rating - 0%
0   0   0
If somebody want's to check UI without hardware - you can just install Python on PC
Than in "command line" navigate to <source code directory>/src
And run "python web.py"

In Windows:
1)Download and unpack source code

2)Open "Command line"
3)Type "cd" and drag and drop "<source code directory>/src" into command line windows
It will be something like:
cd C:\Users\Iurii\Downloads\reefrhythm-smartdoser-master\src

4)Run command:
python web.py

5)Open browser http://127.0.0.1


And yes, software can be developed and tested on PC without ESP32 controller:)
 
OP
OP
yury88

yury88

Community Member
View Badges
Joined
Oct 21, 2023
Messages
93
Reaction score
69
Location
indo-pacific
Rating - 0%
0   0   0
Release v0.6.1 - Hostname settings feature
hostname may be changed any time, but network get updated after some delay*


And video about firmware installation:
 
OP
OP
yury88

yury88

Community Member
View Badges
Joined
Oct 21, 2023
Messages
93
Reaction score
69
Location
indo-pacific
Rating - 0%
0   0   0
And my 3D printed case for 3-heads pump arrived.
I have everything for assembly, after checking I will add .STL and Autodesk project to source code.
 

Attachments

  • IMG_20240416_182601.jpg
    IMG_20240416_182601.jpg
    137.3 KB · Views: 14

Paulo Hanashiro

Community Member
View Badges
Joined
Jun 4, 2013
Messages
37
Reaction score
20
Location
Sydney/Australia
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.
 

theatrus

Valuable Member
View Badges
Joined
Mar 26, 2016
Messages
1,959
Reaction score
3,356
Location
Sacramento, CA area
Rating - 0%
0   0   0
This looks great, thanks for sharing it! I have a few of these stepper pumps running, but never shared a total design like this so thanks for doing something others can build!
 
OP
OP
yury88

yury88

Community Member
View Badges
Joined
Oct 21, 2023
Messages
93
Reaction score
69
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.
Yep, I'm opened to request and actually I was planning to add MQTT any way, I think it will be the next feature after Schedule in v0.7
Mostly I just need to setup HA firts for myself, currently using reef-pi, but would like to try something new
 

Paulo Hanashiro

Community Member
View Badges
Joined
Jun 4, 2013
Messages
37
Reaction score
20
Location
Sydney/Australia
Rating - 0%
0   0   0
Yep, I'm opened to request and actually I was planning to add MQTT any way, I think it will be the next feature after Schedule in v0.7
Mostly I just need to setup HA firts for myself, currently using reef-pi, but would like to try something new
Nice. I started with HA not to long ago, and already converted my inkbird ITC-306A to ESPHome so I can have it integrated with HA, also working on a Mobius interface to HA (Feed mode is already functional). It would be nice to also have the doser integrated and have a single UI for my smart home and the reef monitoring.

Keep us posted.
 

Reefing threads: Do you wear gear from reef brands?

  • I wear reef gear everywhere.

    Votes: 20 14.0%
  • I wear reef gear primarily at fish events and my LFS.

    Votes: 10 7.0%
  • I wear reef gear primarily for water changes and tank maintenance.

    Votes: 1 0.7%
  • I wear reef gear primarily to relax where I live.

    Votes: 22 15.4%
  • I don’t wear gear from reef brands.

    Votes: 80 55.9%
  • Other.

    Votes: 10 7.0%

New Posts

Back
Top