Driving stepper motor with Arduino and L293D

Hello to all the Arduino community!

I am totally new to the Arduino world, and I find it absolutely amazing! (I am a total newbie in electronics for now but would like to learn more about it!)

I just recently started a small Arduino project whose goal is to simply drive a stepper motor : Stepper Motor: Bipolar, 200 Steps/Rev, 35×36mm, 2.7V, 1 A/Phase (Pololu - Stepper Motor: Bipolar, 200 Steps/Rev, 35×36mm, 2.7V, 1 A/Phase) using a L293D motor controller, and a remote power supply source (http://fr.rs-online.com/web/p/alimentations-enfichables/7066524/) for the motor.

Here is a small scheme of the setup :

The code that I am using to drive the motor was borrowed from a tutorial that I found on the net :

#include <Stepper.h>

const int stepsPerRevolution = 512; // change this to fit the number of steps per revolution
// for your motor

// initialize the stepper library on pins 8 through 11:
Stepper myStepper(stepsPerRevolution, 8,9,10,11);

void setup() {
// set the speed at 60 rpm:
myStepper.setSpeed(10);
// initialize the serial port:
Serial.begin(9600);
}

void loop() {
// step one revolution in one direction:
Serial.println(“clockwise”);
myStepper.step(stepsPerRevolution);
delay(500);

// step one revolution in the other direction:
Serial.println(“counterclockwise”);
myStepper.step(-stepsPerRevolution);
delay(500);
}

The issue I have is that when I load the code to the Arduino, plug the power supply, I can only see a slight movement of the rotor back and forth, but no complete rotation movement… I guess that it’s a power issue? I am using a 24V, 1A power supply.

But since I’m only a beginner in the field I can’t really figure out the problem… Would you mind helping me out?

Your power supply is not strong enough for that motor. If each phase draws 1A, that’s 2A for both phases.

Even if stepper motors should be supplied more than the nominal voltage, 24V looks too high to me. How do you control the motor current? How hot becomes the L293D?

I strongly suspect that the L293 is inadequate - it is not intended for stepper motors.. You should be using a specialized stepper motor driver such as a Pololu A4988, a Sparkfun BigEasydriver or a Pololu DRV8825.

...R Stepper Motor Basics Simple Stepper Code

Thanks for the fast replies!

If I get it correctly, in terms of power supply I need something with a lower voltage but higher current? Something like this? (http://fr.rs-online.com/web/p/alimentations-enfichables/9032905/)

I didn't notice any warming of the L293D while the whole system is plugged, but since the motor was not running properly I turned the system down very quickly before doing some other tests.

I thought the L293D was usable for this application since in the data sheet they mention it as a Stepper motor driver... I also noticed that it provides "Output Current 1 A Per Channel (600 mA for L293D)" which is fine in my case? Isn't it?

I saw that the Poll 4988 seems to be the most adequate driver for this application, I will definitely try it out! (Have to buy one by the way haha...)

Thanks again!

Tomtop: If I get it correctly, in terms of power supply I need something with a lower voltage but higher current?

If you are using a specialized stepper driver which can limit the current to protect the motor then the higher the voltage the better - subject to not exceeding the motor driver's limit. I think the A4988 can operate up to 30v or so.

...R

Robin2:
I strongly suspect that the L293 is inadequate - it is not intended for stepper motors..

It might not be suitable for OP's stepper motor, but to say an L293 is not intended for stepper motors is refuted by the data sheet.

293 stepper driver.GIF

293 stepper driver.GIF

kenwood120s: is refuted by the data sheet.

My mother was fond of saying "paper never refused ink"

...R

You should understand that stepper motors sink most current when not moving. The coil resistance of your motor is 2.7 Ohm (V/A), so that the current will reach 9A at 24V if not limited. The L293D is rated only 0.6A, it may have been killed already - depending on the maximum effective current supplied by your power source. You really should use a driver with current limiting capability. Stepper motor drivers also allow to reduce the current when the motor does not move, to prevent the motor from overheating.

Thanks for all of your answers!

So, in practical words,

If I use the same power supply : 24V, 1A DC with a A4988 from Pololu for instance controlling the motor, and if I adjust the current limit delivered by the A4988 to 1A using the embedded potentiometer of the chip, the motor will NOT work because each coil of the motor requires 1A current to work efficiently? Is this correct?

Maybe I miss-understood something?

Tomtop: If I use the same power supply : 24V, 1A DC with a A4988 from Pololu for instance controlling the motor, and if I adjust the current limit delivered by the A4988 to 1A using the embedded potentiometer of the chip, the motor will NOT work because each coil of the motor requires 1A current to work efficiently? Is this correct?

It's a bit more complicated.

The motor is rated at 2.7v 1amp or 2.7 watts (per coil). Your power supply can provide 24v at 1 amp pr 24 watts. So it should be perfectly adequate. It would be a good idea to have a large capacitor across power input to the motor driver to smooth out short term demands from the motor,

...R

first off the LM293D is about as obsolete as a 1957 Chevy because it does not have a catalytic converter, nor power windows. or an UNO because if does not have built in WiFi....

the newer drivers has multiple micro step options, of which, you can only use one at a time....

the LM293D offers set resistors to limit current, so if you are doing single step, they are all on the same playing field, with the LM293D offering more power.

That said, the LN293 is more of a general driver whereas the A4988 is only a stepper driver. the A4988 only needs two pins for step and direction, it offer a simpler program to run a motor...... many things going for it.

===================

your motor needs "X" watts. at 2.4 volts it takes 1Y speed to delvier "X" watts. at 24 volts, it takes "0.1Y" speed to deliver the same power. so, the higher the voltage RATIO over motor namlete, the higher the performance you can get out of the motor. this is real power. ( this is VERY crude description as the coil charging and discharging is not exactly linear to voltage)

the proper way to complete a project is to reduce the voltage to something lower than max, and above the required amount of delivered power.

also, steppers drop spikes back on the power line, expect 30-50% voltage spikes. so, if your driver is rated for 24 volts and you feed it 24 volts, it would be expected that 36v spikes are present. many a driver stops working when the highly engineered smoke is released from the IC due to the improper application.

lastly, steppers REQUIRE, nay, REQUIRE, emphasize REQUIRE... that steps are delivered as a VERY smooth pulse train. imagine slamming on the brakes on your motorcycle, turning the corner, then trying to dump the clutch back into 6th gear...... the motor is a physical thing, spinning aloing, with one pulse dropping off as the next 'grabs' the rotor and pulls it. if you are cogging,or missing steps, re-visit the timing of the pulse train.

Thank you so much to all of you guys!!

I learned tons of informations out of your replies! I just bought yesterday a A4988 on the web and will try a new setup soon, will update on the ongoing work,

Thank you again,

The issue is with the code. As you mentioned your stepper has 1.8˚ step (200 steps) so you need to change the line "const int stepsPerRevolution = 512;" to 200 as the library used is calculating wrong steps.

Hope I helped.

Cheers.