
fredebec
Hi,
I am trying to use a NEMA17 stepper motor (from an old 3D printer) with the EZB v4, through the EasyDriver - Stepper Motor Driver from Sparkfun.
I have connected everything this way:
and use the following code (from this thread: Link):
But the motor barely moves and I cannot change the speed by playing with Sleep().Code:
$x = 0
:loop
$x = $x + 1
SET(D1,ON) # dir pin (maintain current direction)
SET(D0,ON) # step pin
Sleep(1)
SET(D0,OFF) # step pin
Sleep(1)
print($x) # let me know the loop progress
if($x = 6400)
$x = 0 # don't go crazy
endif
goto (loop)
I use a 24v 15A alim (the same I used before with this stepper motor in my 3D printer) so I should have enough power
Any idea what I do wrong ?
Looking at this thread : Easydriver-Code-Nema-17-Motor-Driver-With-Io-tiny-4177, it seems that the stepper is indeed controlled by ARC, through the EasyDriver
Soon or later you will find out that is not efficient to run the stepper through the PC (ARC) versus running on the micro-controller.
If you look to your code you are sending ON,OFFs to the controller in a short period, when you do that you are "flooding" the controller.
The timing is another issue sleep(1) is not 1 ms, sleep(5) is not 5 ms and so on, sleep only works when you are in the context of Javascript, Python, when you get out that context e.g. sending a command through network, and then to EZB queue there is no guarantee of speed.
nevertheless that does not mean you can't run a slow stepper using all the Elephant power (ARC).
Looking to the documentation:
https://learn.sparkfun.com/tutorials/easy-driver-hook-up-guide
Did you match the motor coils wiring, and the motor amps (Potentiometer) ?
Please post a PIC of your setup and motor specs.
Enable (Low = Activates) / (High= Deactivates). Don't forget to switch off otherwise the coils are active. Don't change the wiring while the coils are active.
Resolution:
I would start with both Low, Low, to see some results (movement)
Sparkfun's documentation is pretty good, did you missed that ?
ARC simplifies a lot of things, but wiring less signals (2 of 5) is not an ARC's feature
Thanks for the help.
I used this (arduino) link : Easy Driver Example
that showed the simple setup i used. It seems that I have been misled...:D
I am going to make the complete circuit and see how it goes. But first, I have some soldering ahead...
Javascript code:
Let me know if it works for you.Code:
First, I don't use the EasyDriver module anymore, because it stopped working at some stage, without any obvious reason. So, I changed for a DRV8825 (I have a lot of them).
I use this kind of setup:
+ the "Enable" pinout connected.
With @ptp's script (and my EZ-script) I am able to rotate the motor, with two main limitations:
- I am unable to obtain a continuous rotation. It rotates, but randomly...
- I am unable to change the direction. Putting DIR on or off don't change anything, it always moves in the same direction
Operating systems for PCs, such as windows and Linux and macOS are not real-time. They don’t have precision such as the stepper would need. Additionally there’s overhead of the entire network and WiFi stack.
What do you mean by that?
I already have an "EZBfied" Arduino Mega, so I am interested