esp32-motorized-roller-blinds icon indicating copy to clipboard operation
esp32-motorized-roller-blinds copied to clipboard

question about more than 4 stepper

Open eduesp32 opened this issue 2 years ago • 2 comments

Hi Egor. Thank you for the work done. If it doesn't bother you, help me with advice on how to expand this firmware to work with a little more motors. everything works great with 4 stepper motors. I haven't figured out the home assistant yet, but I hope I'll set it up somehow. Is it possible to make a connection via a pcf8574 type expander over the i2c bus, I just need a slightly larger number of steppers. How can I increase the number of motors in the interface? To be honest, I want to connect 16 steppers, and I don't want to occupy 4 esp 32 with them. But there is a necessary number of expanders. There are examples of connecting stepper motors via i2c on the network, but only for arduino, and unfortunately I didn't find anything with the esp. Thank you in advance for the answer.

eduesp32 avatar Nov 08 '22 02:11 eduesp32

Hi! Glad to see it's useful for you. Feel free to give a star to this repo ;)

I've not tried 16 steppers, but it looks possible with some changes.

  1. From interface side you should change that line at main.cpp: https://github.com/eg321/esp32-motorized-roller-blinds/blob/c73b0099cf9474bf3646499c489f52eed5b7ea85/src/main.cpp#L2

It will be enough to update web interface with needed bars and configurations for each stepper. MQTT part also will be updated automatically.

  1. Main issue will be adapting CheapStepper library to work with i2c expander. It doesn't know about expanders and does not know how to work with them. As quick dirty hack, you can replace pinMode with pcf8574.pinMode (or what library you'll use) and digitalWrite with PCF8574.digitalWrite and so on.

  2. Also do not forget to update this function: https://github.com/eg321/esp32-motorized-roller-blinds/blob/c73b0099cf9474bf3646499c489f52eed5b7ea85/src/Helpers/StepperHelper.cpp#L26

And that's it.

If you'll find better way, please tell me. I'll try to support that. This definitely can be useful.

Please keep us updated about results. It's quite interesting experiment.

eg321 avatar Nov 08 '22 17:11 eg321

Hi. Thank you for your prompt reply. I will try your advice. I'm just starting to learn esp 32. I have never done coding at all, I will study it slowly. Most of the connected sensors and modules are made in node-red by copying and pasting. Here come out tasks that no one has done before. If it fails, will have to temporarily donate 4 esp. I will try to rework your project as soon as I understand at least a little what to do)

eduesp32 avatar Nov 09 '22 09:11 eduesp32