pkerspe / ESP-StepperMotor-Server

Turn your ESP32 into a complete stepper motor control server with web UI, REST API and serial control interface
MIT License
225 stars 39 forks source link

Possibility to control enable pin on the A4988 driver module. Otherwise the motor uses power when not rotating. #33

Closed amigafan closed 1 year ago

amigafan commented 2 years ago

Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like A clear and concise description of what you want to happen.

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Additional context Add any other context or screenshots about the feature request here.

pkerspe commented 2 years ago

@amigafan can you please provide some details on your feature request?

amigafan commented 2 years ago

My idea is to use an A4988 driver module together with a DRV8825 expansion board module. This expandion module requires Step signal, Direction signal and an enabled signal. When enable signal is low the driver is enabled. If the enable signal is low all the time, the step motor uses power even when it is not rotating. I like the ability to configure stepper motor, limit switch and rotary encoder. Br. amigafan

pkerspe commented 2 years ago

Not sure why to combine those two boards but doesn't matter. So if I get you right, you do not want manual control over the IO connected to the enable pin but simply want it to get pulled low whenever a move is in progress and pulled high when the movement stopped? Correct?

amigafan commented 2 years ago

Yes, that is correctly understood. For some reason, the motor draws power as soon as the enable pin is low.

pkerspe commented 2 years ago

Probably the driver powers the coils to keep the motor from spinning freely, in order to maintain its position. If you remove power, depending on your setup and use case, you might loose absolute precision.

amigafan commented 2 years ago

That sounds like a good explanation, without power the shaft is easy to turn around with your fingers. For my use, though, it's no problem.

pkerspe commented 1 year ago

so for everyone having this issue you can now use the motor break function to control a driver enable pin. Basically instead of using it to activate a brake you use it to control the state of the enable pin when the motor is not moving: void setBrakePin(signed char brakePin, byte activeState = ESP_FlexyStepper::ACTIVE_HIGH);