Page 1 of 1
Stepper Control
Posted: 17 Sep 2023, 21:04
by romicon
Hello,
i have a Stepper driver 4Ampere with puls and dir pin.
How can I control this amplifier with esp easy.
Best regards
Oliver
Re: Stepper Control
Posted: 17 Sep 2023, 22:38
by TD-er
Depends on what you want to do.
Using longpulse_ms, you could already do really basic operations on the
stepper motor.
See:
https://espeasy.readthedocs.io/en/lates ... ernal-gpio
For example use this in the rules: (replace 'X' with the GPIO you need for the direction, replace 'Y' with the GPIO for the pulses)
Code: Select all
on stepup do
gpio,X,1
longpulse_ms,Y,1,10,10,%eventvalue1%
endon
on stepdown do
gpio,X,0
longpulse_ms,Y,1,10,10,%eventvalue1%
endon
Then you can trigger an event like this, to make 1000 steps in the "up" direction:
event,stepup=1000
100 steps down:
event,stepdown=100
Re: Stepper Control
Posted: 18 Sep 2023, 19:22
by romicon
Hello,
thank you for your Answer.
I would like to control a stepper motor as a suntracker.
In the morning, approach limit switch 1 east. At midday, approach limit switch 2, south. In the evening, approach limit switch 3 west. Sunset back to the east.
Thank you
Oliver
Re: Stepper Control
Posted: 18 Sep 2023, 21:11
by TD-er
How many steps does it roughly take between each limit switch?
Also what would be the best approach for your setup?
Divide the time between sunrise and noon in N pulses, or let it run a few pulses every minute (or 5 minutes), so it can overcome some friction to start moving.
Re: Stepper Control
Posted: 19 Sep 2023, 19:44
by romicon
Hello,
I'll try that out. I want to control via http request
In node red you have all expansion options.
With this command in the Browser or Node red, rotate the
stepper left or right .
http://192.168.178.121/control?cmd=event,stepup.
http://192.168.178.121/control?cmd=event,stepdown
rule1
on stepup do
gpio,26,1
longpulse_ms,25,1,10,10,500
endon
rule2
on stepdown do
gpio,26,0
longpulse_ms,25,1,10,10,500
endon
Best regards
Oliver
Re: Stepper Control
Posted: 19 Sep 2023, 19:52
by Ath
For maintenance it is much easier to have those rules in a single rules file, no need to store them in separate files, as they are handled sequentially. The split was once, a long time ago, needed because of the way the rules files were then uploaded, but that has been resolved years ago.