Hello all. Been out of circulation for a bit. Still hanging in there though. Gots a question about using ESPEasy to control a few stepper motors. I am looking at making a magnetic uncoupler device for model railroad train couplers. Actually a copy of an existing one: https://rapidotrains.com/railcrew-on-of ... -pack.html. Its basically a rotating disk with 2 magnets under the track that rotates 90 degrees to turn "on or off" The magnets then cause the couplers to swing away from each other to uncouple.
The stepper motors I have in mind are something along these lines.
https://www.ebay.com/itm/262741846716
I'm pretty sure they cannot be directly controlled without some kind of driver chip but I am not at all sure what is needed to make these work. I would also like to be able to control as many as possible with one ESP. (can use as many as necessary though). Will be designing something in FreeCAD to put these things together. Can anybody give me some direction on how to accomplish this?
Stepper motor control question
Moderators: grovkillen, Stuntteam, TD-er
- budman1758
- Normal user
- Posts: 303
- Joined: 15 Apr 2017, 05:13
- Location: Riverside CA USA
Stepper motor control question
"The glass is twice as big as it needs to be".
Re: Stepper motor control question
A quite common stepper motor driver which is used in many 3D printers is A4988
It typically needs a pin to state the direction (and EN to activate current through the coils) and a pulse to make a step.
You could make a very basic implementation for this using rules.
See for example the "longpulse_ms" command: https://espeasy.readthedocs.io/en/lates ... ernal-gpio
This command does have an argument for the number of repeats, which can be used to make N steps.
It typically needs a pin to state the direction (and EN to activate current through the coils) and a pulse to make a step.
You could make a very basic implementation for this using rules.
See for example the "longpulse_ms" command: https://espeasy.readthedocs.io/en/lates ... ernal-gpio
This command does have an argument for the number of repeats, which can be used to make N steps.
- budman1758
- Normal user
- Posts: 303
- Joined: 15 Apr 2017, 05:13
- Location: Riverside CA USA
Re: Stepper motor control question
So is it safe to say that I need 3 pins per stepper to control it for both directions?
"The glass is twice as big as it needs to be".
Re: Stepper motor control question
Yep, you probably need to toggle the EN pin as those coils otherwise might heat up while not stepping.
You could limit the current through the coils, but that does have side effects.
When limiting the current, you might not have enough torque anymore when stepping at higher step rate.
Drawback of cutting off the current through the coils is that you also loose any force keeping the stepper motor in the same position.
If you only need to step between 2 steps, you can also use a H-bridge like those used to controll DC-motors.
For example L298N.
There are quite a lot of tutorials online to wire these.
If you only need to switch between 2 states (e.g. controlling train switchrails) those L298N are easier to control.
Then you only need 2 GPIOs as you simply address either one or the other coil.
You could limit the current through the coils, but that does have side effects.
When limiting the current, you might not have enough torque anymore when stepping at higher step rate.
Drawback of cutting off the current through the coils is that you also loose any force keeping the stepper motor in the same position.
If you only need to step between 2 steps, you can also use a H-bridge like those used to controll DC-motors.
For example L298N.
There are quite a lot of tutorials online to wire these.
If you only need to switch between 2 states (e.g. controlling train switchrails) those L298N are easier to control.
Then you only need 2 GPIOs as you simply address either one or the other coil.
Who is online
Users browsing this forum: Bing [Bot] and 16 guests