Hello,
@ediedi, I have suggested to the Moderator to move your Post to its own Thread.
You should not even consider powering a stepper motor from the Arduino's 5v pin. The Arduino cannot provide enough current even if the voltage was correct.
A stepper motor needs a stepper driver between it and the Arduino and the motor power supply is connected to the stepper driver. That way the motor voltage is entirely independent of the Arduino.
You can use a transistor switch being power by >5 volts.
.
You need to post links to the datasheet for your stepper motor and to the datasheet for your stepper driver.
Also make a simple drawing showing how everything is connected and post a photo of the drawing.
Without these we are just making wild guesses.
...R
Hi,
Welcome to the forum.
Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html
Please attach any files rather than lin to offsite drive/cloud or dropbox, please
If you look at the driver sheet you will find it will accept 5V to 24V control signals.
Use REPLY rather than QUICK REPLY and it has an attachment facility.
Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?
Thanks.. Tom..
@ediedi I am not going to download unknown .rar files to my PC. Post links to the manufacturer's website.
It looks like @TomGeorge did look in the .rar so I assume you now have the answer you need.
...R
Your photography is excellent but your pictures are no help for showing what wire connects to what. Just make a simple pencil drawing of the connections and post a photo of the drawing.
...R
Hi,
Have you tried any code?
If so can you post it so we can check it?
Thanks.. Tom..
I'm pretty sure that the code is not a problem. Because even with the simplest code( just to rotate the motor) the motor doesn't work.
Do you have the Surestep software installed?
If so have are you able to use the CLI (SCL) to make the motor move?
Most likely your driver comes with optocouplers for all inputs, and you need to activate the ENABLE OC (by either software as in my proposal or hardwired by connecting ENA- to GND and ENA+ to +5V).
Reading the datasheet of your driver, imho the easiest way to connect your driver with an Arduino is the option "Connecting STP-DRV-6575 Drive to Indexer with Sourcing Outputs".
If you agree to that connection scheme, pls check and in case, modify your wiring to the following connections (valid for Y-Axis control of your sketch)
Arduino -> STP-DRV-6575
Pin 11 -> STEP+
Pin 12 -> DIR +
Pin ?? -> ENA+ (enables Driver with a HIGH, so add this in your code, whenever Y-Axis should move, replace ?? with any available I/O declared as OUTPUT)
GND -> STEP-, DIR-, ENA-
I think the FAULT connections can be neglected if you don't want to do some error handling.
The stepper driver has an option called "self test". Basically, you connect the stepper motor and the power supply to the stepper driver and you push a button and the motor starts to rotate. This assures that the wiring and the motor are ok. I want to know the logic behind using EN +. What extra benefit do I get by enabling this channel? Because I spent a great chunk of time on the coding and wiring.
Thanks
I want to know the logic behind using EN +. What extra benefit do I get by enabling this channel?
I suspect you are native English speaker? (I am not ..) So what do you think ENABLE means?
Most stepper drivers incorporate a pin called "Enable" (sometimes just "ENA"). Activating ENA just means: switch your driver ON; de-activating: driver OFF. As long as your driver is OFF you can send as many DIR signals or STEP pulses as you want - nothing will happen as deactivated drivers don't send any current to the stepper motor.
Some drivers have ENABLE automatically switched ON by default if you don't connect anything to the ENA pins. But imho your driver requires an active wiring.
I do have some similar driver devices at home; depending on the internal circuit design some require ENA to be pulled HIGH, some LOW to activate the driver.
In your case ENA will be switched on by connecting ENA- to GND and ENA+ to a logic HIGH from the Arduino.
If your driver shall be activated all the time and you have no need to disable the driver, then you don't need to control any ENA pin of the driver(s) with your Arduino. Just powering ENA will do it.
To test if my suspicion is right, just do the following:
- Use your existing code
- in addition of your existing wiring just connect ENA- to GND and ENA+ to +5V.
Then start your test sketch.
If that works, decide if you need to use ENA in your code to activate/deactivate your driver or if it is ok that your driver stays always activated. Activated means that even in stall situation FULL current is flowing through your stepper(s).
Using your steppers in a CNC machine at least the z-Axis needs continuous power not to drop the router.
But you could also activate the automatic power reduction mode on your driver so that it still has torque, while REDUCING the current (=SAVING ENERGY) - though that's another story. First get your driver move the stepper, then we can continue with fine tuning.
Just had a look at your code:
Where did you get that or did you write it on your own?
Did the motor give at least some kind of rumble/shaking?
With that code a stepper can't run as you are using serial.print statements.
Have a look at Robin2's "Simple Stepper Code" -> link in his reply #1.
I modified the code so it should be adjusted to your current wiring:
// testing a stepper motor with a Pololu A4988 driver board or equivalent
// on an Uno the onboard led will flash with each step
// this version uses delay() to manage timing
byte stepPin = 11;
byte directionPin = 12;
int numberOfSteps = 100;
byte ledPin = 13;
int pulseWidthMicros = 20; // microseconds
int millisbetweenSteps = 250; // milliseconds - or try 1000 for slower steps
void setup() {
Serial.begin(9600);
Serial.println("Starting StepperTest");
digitalWrite(ledPin, LOW);
delay(2000);
pinMode(directionPin, OUTPUT);
pinMode(stepPin, OUTPUT);
pinMode(ledPin, OUTPUT);
digitalWrite(directionPin, HIGH);
for(int n = 0; n < numberOfSteps; n++) {
digitalWrite(stepPin, HIGH);
delayMicroseconds(pulseWidthMicros); // this line is probably unnecessary
digitalWrite(stepPin, LOW);
delay(millisbetweenSteps);
digitalWrite(ledPin, !digitalRead(ledPin));
}
delay(3000);
digitalWrite(directionPin, LOW);
for(int n = 0; n < numberOfSteps; n++) {
digitalWrite(stepPin, HIGH);
// delayMicroseconds(pulseWidthMicros); // probably not needed
digitalWrite(stepPin, LOW);
delay(millisbetweenSteps);
digitalWrite(ledPin, !digitalRead(ledPin));
}
}
void loop() {
}
Did you run the example sketch which was in my last post?
4.77V is seen as logical HIGH by any other devices which deal with digital I/O (TTL like). In fact logic HIGH is detected by TTL devices even when the level is down to 2.0 V!
This is not the reason why your driver doesn't work.
Either there is still a bug in the wiring, or you might have fried the driver (this happens when the driver has no protection against back EMF - this will be produced when you have the driver powered and you either connect or disconnect a motor).
My last idea to see if ENA really enables your driver (if so, then it might be a problem in the code): 1. disconnect the +5V wire end from ENA+
2. disconnect one of the motor wires
3. place your multimeter in series with the motor wire you just disconnected, switch to amps measurement ( range should be high enough so the current doesn't kill your MM's fuse),
4. power the driver
5. manually connect the +5V wire end to ENA+ and watch your MM
Whenever you connect the +5V wire to ENA+, you should see current flowing, when no +5V are connected, the current should drop to zero.
If that works, you see the effect of enabling/disabling of your driver and thre is with your sketch or something happened with the driver's STP, DIR inputs.
Hi,
I think you need to have the Enable disconnected, as the description in the data sheet says;
So leave the EN terminals open.
Can you check your DIP switches and Rotary switch positions please;
SW 1 and 2, OFF
SW 3 OFF
SW 4 ON
SW 5, 6 ,7 ON
SW 8 OFF
Rotary Switch position 3.
Thanks.. Tom..
Change millisBetweenSteps to 10 and try again.
I heard some knocks from the motor but it barely moved. I mean it didn't moved it was just some noise.
The motor gets too few steps per turn.
What's the next step?
- Follow MarkT's advice
- Look at the setting for microsteps; if microstepping is set 1/8, 1/16 or even higher, then set the DIP switches to 1/4 or 1/2 to get higher speed
When this works we can find a setting which will meet your needs.
If the stepper still just makes noise, but doesn't move there is something wrong with the wiring of the stepper, or the setting is not (yet) ok; your driver has so many settings and they all must fit to get reliable motor action.