eg321 / esp32-motorized-roller-blinds

Control your motorized blinds with Web interface/ MQTT. Easy integration with automation systems like Home Assistant and OpenHab. 3d printing model for Leroy Merlin blinds.
https://www.thingiverse.com/thing:4093205
MIT License
87 stars 20 forks source link

Slow RPM when using 3 Motors #11

Open Caliban2017 opened 2 years ago

Caliban2017 commented 2 years ago

Hello,

first of all respect for this nice Code. I use it on 7 of my Windows now and it works very well so far, with one exception.

I have two double Windows, where i can use a Wemos D1 Mini to run two 28RYJ Motors. It work very well so far on the Wemos, i only use the 5V Version but when i set the RPM to max 20, it can lower and raise the blinds without Problems. The Speed is acceptable. But i have a bigger Window mit 3 Blinds on it, so i needed to use a ESP32Dev1 to use more than two Motors. When i control one Motor, it lower and raises a little bit slower then the Wemos D1. But the main Problem is, when i use all three Motors at the same time, the RPM is reduced to maybe 8-10-ish?! It goes very slow up and down. I tried to change the RPM and wiped the Settings and raised it to 40 RPM, but it does not help. The Motors always driving at the same Speed. Maybe the RPM is ignored in the Config?! But i think it has something to do with driving all three Motors at the same time. Maybe the ESP32 is to slow for that? Do you know any Solution for it or what i can try to fix it? I can accept the slow speed for the Moment, but when there is a fix to open and close them a little bit faster, i would very appreciate it.

And i have a suggestion for upcoming Version - maybe it is possible to use different RPM Speeds for Up and Down Movements? Because i recognized, the Down RPM can be much higher than the Up-Movement of the 28RYJ, especially on the 5V Version of the Motor. Because there is Tourqe on the Motor, when the blinds are lowering.

Would really love to see new Versions here, because its a nice Program, it works very nice but the configuration is a problen to wipe the complete Settings all the time.

Thank you very much and greetings from Germany, Caliban

eg321 commented 2 years ago

Hello, Caliban. Thank you for your feedback! Glad to know that it's useful for someone else.

Regarding speed: ULN2003 is actually an array of gates. It's not a real driver to work with steppers where we can define direction and command "do a step". This means that ESP should process by self each microstep for each motor. It's a problem when we want to handle several steppers in parallel. I've switched to the new async handling of steppers at v1.4.0 to minimize this issue. By now second, third stepper affects performance, but not in 2x or 3x slower as it was before (moreover not in 8-10x slower). Maybe there some space for optimization, but I don't think that it will work much better at that hardware.

I think there is one option to move forward: use real drivers like a4988 and maybe another steppers, but it will not so cheap as ULN2003 + 28byj-48. I don't have a time to implement support of such drivers now, but can assist you, if you have skills.

I'm using 12v version of 28byj-48, and it works quite good (3 steppers per single esp32 board). I really recommend to switch to 12v stepper. Maybe it's most simple and cheap solution to improve situation with speed now.

Regarding reconfiguration issue: Yes, it's on my TODO list. Unfortunately library that I use for settings does not allow to reconfigure settings without wipe. And it looks as not maintained anymore. Most probably I'll switch soon to another library without such issues. During this switch I'm going to add more settings (including separate up/down speeds).

What version do you use? I hope it's a v2.0.

Once again, I don't have much time for this project now, but I can apply proposed changes as "Pull requests". Feel free to contribute.

Thanks for feedback!

Caliban2017 commented 2 years ago

Hi eg321,

thank you for your Anwser and your Explanation how the ULN2003 Driver works. I already throught that, the ESP seems to be to slow to drive all three Motors at the same time. Of course there would be the possibility to use two Wemos D1 instead of one ESP32. But i wanted to keep the Energy Consumption of that project as low as possible. I can accept that speed, of course it would be nice to get them faster but i don't want to spend more Money into that Project. It was more a Just-For-Fun Thing to try that and it works very well in combination with Home Assistant.

i already saw that alternative way to modify the Steppermotor from Unipolar to Bipolar and use a H-Bridge Driver. But yes, it would be not as cheap as the ULN2003 + 28BYJ.

I tried to avoid the 12V version too, because i wanted to power the ESP and the Steppers from the same Power Source (keep the Energy Consumption low). So 5v was the better Solution for me, because i can simply use a USB Power-Plug (5V, 2A) to power both the Wemos/ESP32 and the Motors at the same time. For a 12V Source i would need to step down the 12V to 5V for the Wemos/ESP32.

But maybe i will try to switch to two Wemos instead of one ESP32, because i want try to connect a fourth Motor for my Blinds they are in front of my Window. I don't know the right Translation for it, Google says "Lamellar curtain" or "vertical Blinds". You can open them by a Ball-Chain and my Idea was to use your Script and the fourth Motor to drive that Chain to open and close that Blind too. But i think when 3 Motors are already to much, i should switch to the two Wemos D1.

I hope still to see some more work from you, that script is really nice and meets all my needs to integrate them perfectly in Home Assistant and Google Assistant.

Oh and one more Tip for the integration in Home Assistant: you should change optimistic: false to true, because with False Google Assistant always gives an Error Message opening and closing the Blind. After my research for that Problem, it has to do with a stateless Blind and how Google handle them. The command will work, it will raise and lower the Blind but it will give a Error Respond. But with changing that to true, all works without Errors.

Greetings