L293D Motor Driver Controlling a Stepper Motor

Hello all,

I have been trying to use the following tutorial: https://www.instructables.com/id/Arduino-How-to-Control-a-Stepper-Motor-With-L293D-/ to control a stepper motor with an L293D motor driver. Pictures of my breadboard are attached. Unfortunately, my stepper is not working. It was working, but when I tried to change the number of steps, it stopped working. Even when I changed the number of steps back, the motor will not run. If you look in my picture of my breadboard, there are two loose red and black wires connecting into the breadboard. I think I may have accidentally crossed them, causing a short. Would this break my motor driver? Or is something else causing my motor not to function? (My code is below)

/*
Stepper Motor Control
6/4/20
*/

//include the stepper library
#include <Stepper.h>

//denote which pins attach to the breadboard
int in1Pin = 12;
int in2Pin = 11;
int in3Pin = 10;
int in4Pin = 9;

// the first term in parenthesis denotes the number of steps the motor will move.
//The next four terms denote which pins are accessed in the probram
Stepper motor(512, in1Pin, in2Pin, in3Pin, in4Pin);

void setup()
{
pinMode(in1Pin, OUTPUT);
pinMode(in2Pin, OUTPUT);
pinMode(in3Pin, OUTPUT);
pinMode(in4Pin, OUTPUT);

// line delays the serial interface until the terminal window is opened
//(I had it commented out, but can change that if necessary)
//while (!Serial);

Serial.begin(9600);
//the motor speed is set
motor.setSpeed(20);
}

void loop()
{
if (Serial.available())
{
int steps = Serial.parseInt();
motor.step(steps);
}
}

Stepper Motor Breadboard and code.pdf (983 KB)

Please post a link to the datasheet for your stepper motor and tell us what stepper motor power supply you are using (volts and amps).

Please also don’t attach PDFs because we can’t view them without downloading them. Just include your program code in your next Reply using the code button </> and attach images as JPG or PNG files. Then make the images visible in your Reply - See this Simple Image Posting Guide

…R

Breadboards are not intended for large currents, and the track will burn when used with motors and motor drivers. Loose connections on breadboards can also instantly destroy a motor driver, if wiggled.

You need to either solder the motor wires to the driver module, or use screw connectors if provided on the module.

Finally, never change connections when the power is applied.

Hello,

Here is a link to the data sheet for a 12VDC 32-Step Stepper Motor: Small Reduction Stepper Motor - 5VDC 32-Step 1/16 Gearing : ID 858 : $4.95 : Adafruit Industries, Unique & fun DIY electronics and kits. I am using a 5V and 20 mA supplied from the board.

ecox23:
Here is a link to the data sheet for a 12VDC 32-Step Stepper Motor: Small Reduction Stepper Motor - 5VDC 32-Step 1/64 Gearing : ID 858 : $4.95 : Adafruit Industries, Unique & fun DIY electronics and kits.

Your link is for a 5v motor.

Those small motors usually use a ULN2003 as the driver and in many case they can bought in a package with the ULN2003

I am using a 5V and 20 mA supplied from the board.

Supplied from what board?

...R

It is supplied from the Arduino board.

ecox23:
It is supplied from the Arduino board.

In that case I don't understand what you mean by 20mA - what pin of the Arduino board (is it an Uno?) are you drawing the power from?

Please make a simple pencil drawing showing how you have everything connected and post a photo of the drawing. It will make things much easier to understand, See this Simple Image Posting Guide

...R

Here are the images of my breadboard both conceptually and physically. I believe it is connected to the 5V pin on the bottom of the board.

Here is another one. It won’t let me post the pictures all together for some reason.

Its a 5-wire motor, normally the red lead goes to +5V and its driven unipolar. If you drive it bipolar you'll
need about 7V of drive ideally.

Your wiring diagrams show that pins 8 to 11 are used, with 8,11 being winding A, 9,10 being winding B

Your sketch uses pins 9 to 12, and assumes that 9,11 is one winding, 10,12 is the other.

If the code matched the circuit it might work.

ecox23:
Here is another one. It won't let me post the pictures all together for some reason.

I don't know what you mean by it not letting you ... you should be able to add a few attachments at the same time.

Please make your images visible in your Post. I gave you a link to the instructions.

...R