I am new to Arduino. I am using the Tb6600 Driver for 17HS4401 Stepper Motor (they were sold together).
However when I set the number of steps for a full revolution, the motor only moves 1/4 of a rotation. I can adjust the code to move 4 times the number of steps, which works but I'd like to understand what is going on in order to avoid further issues further down the line.
From what I understand 17HS4401 has a step of 1.8°. So 200 steps are needed to have a full revolution. If I set the microstep to 4, 800 pulses per revolution are needed. So I set switch 1 on, 2 & 3 are off.
For the current, switches 4 & 5 are switched on and switch 6 off.
Is that correct?
I can post the code too, just want to make sure connections are right.
if you configure for x1 (no micro steps) ON/ON/OFF ➜ do you get a full turn with 200 steps ?
can you Check the wiring of your TB6600 driver to ensure that you have connected everything correctly. Verify the connections for each coil of the stepper motor. Incorrect wiring can result in the motor not moving as expected
The wires are coming directly out of the motor, so I can not change anything there. The wire colors from the motor correspond to the colors in the image, so I connected them to the driver as in the image.
I have an Arduino Mega. I used the same wire colors as in the image:
The yellow wire is going to pin 46. It is not used in the code, but I still connected it. Is that ok?
The blue wire is going to pin 44
The green wire is going to 45
All the red wires are connected with a breadboard and going to the 5V
Yes, that's right. If you hold the stepper in your hand, is it still loud? Noise is not normal. I'd usually say that you were hitting a resonance point, or had a connection missing if it's noisy, but the motion wouldn't be so precise.
Try a slower speed and make sure you have a direct connection between controller power pins and your power supply. I'd also set the switches for 400 pulses/revolution while debugging this since that's the most common motor mode.
The 400 pulses/revolution completely blocked the motor, it did not move and made a nasty sound.
I then tried putting all switches off (6400), which ran very smooth with a little sound but still needed to multiply by 4 to get a full rotation.
Changing speed doesn't seem to make a difference (besides changing the speed as expected). The max is about 1200 at 800 pulses/revolution. Higher speeds seem to give some step skipping though. If I increase the pulses/revolution I can also increase the RPM.
I used a battery in the beginning and now a SHNITPWR AC DC Adapter: SNT-0324-48, but the factor 4 issue happened with both power sources
That sounds like you are trying to step too fast at 400ppr. Very common for steppers to respond like this, they will work fine as you increase the microstep factor (though of course move slower). Do you have any acceleration set up, so the stepper doesn't have to start at max speed instantaneously?
I was thinking about how the accelaration would work when looking some info on stepper motors. So far it seems to work without adjustments (except for the potential issues mentioned above). But I would still be interested in accelation. Can it be done fully by code or do you need some additional hardware?
Your picture appears to be of an Uno, but you're using a Mega. So it's an image perhaps of what the wiring should be, not what it is. Hard to debug from that.
I'd try something simpler - forget the library and try stepping the motor (slowly) in your code 'by hand'.
Fix the enable wire too. Tie it to 5V or ground or make sure that pin 46 is set in code to the one you need.
Hi, the drawing came with the motor. I use an arduino mega, in post five you can find my setup.
I don't have another motor, this is my first arduino build. From what I've read so far, the motor and or driver might be broken. I can get another one but I'd like to be check I'm not doing something dumb with the current setup first.
Nice that they have a library for the acceleration, but indeed I'll try to fix the current issue first.
Thanks for the enable wire tip, that has been bugging me
The <stepper.h> library isn't suitable for a step/dir driver. It is designed to drive the stepper by means of a H-bridge. This could result in the problems you encounter.
Use a suitable library like Accelstepper or my MobaTools library. This example is the bare minimum to see if your stepper works.
Thanks all, that gives me a couple of thing to try out!
A general question regarding libraries: Is there a way to see the contents of a library in the Arduino IDE? or in notepad or something like that? It is sometimes hard to find this info.
Libraries you install via the library manager are stored in the 'library' folder of your sketchbook directory. Where your sketchbook directory is located, can be seen under Files->Preferences.
Hi all,
Short update: While I've not been able to figure out why the motor only moves 1/4 of what it is supposed to, it is accurate and consistent. I think it would be best for me to have another motor to see if it is a hardware issue.
However, it seems having the en- & + connected was causing the erratic behaviour in my final code. I completely removed these and now it works perfectly. Still with the 1/4 admittedly, but that is an easy fix in the code.
There will be other projects in the future. Once I have another stepper, I'll try to figure out where the 1/4 is coming from. In the mean time, thanks for all the help!
I told you already what the reason is: the Stepper.h library is not suitable for a step dir driver. Its designed to use a simple H-Bridge. That's why it only turns 1/4 of the expected steps if connected to a step/dir driver.
With a H-Bridge the motor moves one step at every edge of the red and yellow signals. With your stepdir driver it steps only at the positive edge of the yellow signal, which is 1/4 of all edges.
These are the signals created by e.g. my MobaTools library ( again; red is dir, yellow is step ):