ULN2003 Stepper driver pin outs

Hello,

I have a ULN2003 stepper driver module that I received in a starter kit with a unipolar stepper. I am having some issues getting it running (it seems to vibrate as if its trying to move but not actually move).

Anyway, after going over the wiring a few times to make sure I'd not made any silly mistakes I've noticed that in the documentation there are conflicting drawings showing how it's wired to the Arduino UNO board.

One image shows Pin IN1 on the driver to Pin 8 on the Uno..... then 2-9, 3-10, 4-11. Like this

Whilst another shows the opposite; Pin IN1 on the driver to Pin 11 on the Uno.... then 2-10, 3-9, 4-8. I don't have a link to this as it's on the Elegoo instruction DVD that I got with the kit.

Has anybody used this driver and can you confirm the correct order? I understand to some extent that as long as you write the code accordingly then it doesn't matter but as I'm de-bugging I want to be 100% sure it's wired correctly. The library code states stepper is on pins 8,9,10,11 (in that order).

Thank you in advance, Paul

Mine is connected like this:

Arduino pin ULN 2003 IN pin ULN2003 out pin motor wire 8 1 1 (16) pink 9 2 2 (15) yellow 10 3 3 (14) orange 11 4 4 (13) blue GND 8

Thank you for the reply. That matches the link above so it must be the elegoo documentation that is incorrect/different.

I plan to strip everything down tonight and rewire a simple circuit to get the stepper working and take it from there.

Pretty sure I've cooked the driver. Hardware and code is good but I'm just getting a vibrate and no motor rotation! :-(

You may need a different wiring sequence, post the program you are using, also, how are you powering the motor? Can you post your wiring digram? HowToPostCode

Hi,

I have tried the motor powered in 2 different ways. At first I was using a separate supply for the motor. I dont have an image for this, but it was this unit.

To simplify things whilst debugging I connected it like this

Both had the same result. I even stripped my code right back to this;

/*
 The motor is attached to digital pins 8 - 11 of the Arduino.

 */

#include <Stepper.h>                  // call stepper control

const int stepsPerRevolution = 2048;  // number of steps per revolution

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

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

void loop() {
 

Serial.println("clockwise");
  myStepper.step(2048);
  delay (1000);

Serial.println("anticlockwise");
  myStepper.step(2048);
  delay (1000);

}

The pauses and the vibration appear to suggest that the code is ok, it’s just not actually moving.

Any thoughts?

Thanks
Paul

I believe the step pattern in the stepper library is for bipolar motors and doesn’t work well with unipolar motors, try this test sketch just to see if your motor moves, works well here.

const byte coilA = 8,  // pink
           coilB = 9,  // yellow
           coilC = 10, // orange
           coilD = 11; // blue
byte stepNr [8] = {0x01, 0x03, 0x02, 0x06, 0x04, 0x0C, 0x08, 0x09};
byte cntr = 0;
int stepsPerRev = 1024, dlay = 10;
unsigned long cntr2 = 0, totalSteps = 1024;
bool dir = true;

void setup()
{
  Serial.begin(9600);
  DDRB = 0x0F;
  
}

void loop()
{
  PORTB = stepNr[cntr & 0x7] & 0xFF;
  cntr2 ++;
  dir ? cntr++ : cntr--;
  delay(dlay);
  if(cntr2 >= totalSteps)
  {
    dir = ! dir;
    cntr2 = 0;
    delay(100);
  }  
}

FBD8BUKHMWVZNZQ.MEDIUM.jpg

Hi, I have had the same situation, you have to try different combinations of connections to IN1, IN2, IN3 and IN4. One will work, the rest will just jitter.

Your driver board has LEDs on each output, so you can test if it is still working properly by applying 5V to each IN1, IN2, IN3 and IN4 in turn and check that the LEDs light up, with the stepper unplugged.

Please remember, [u]DO NOT change any wiring until you have removed power[/u].

Tom.... :)

Thank you for the replies. I will try them out tonight and see how I get on! :slight_smile:

So i tried the code above and still no movement - just vibrating when it should be moving.

I also tried applying 5v to each pin and each LED powered on as expected per pin.

I have tried 2 seperate motors now and both were the same. I have ordered some new driver boards, so fingers crossed they will work fine with a new one. I'll be more careful in future disconnecting whilst powered!

Hi,
Some known-working code here:
http://arduino-info.wikispaces.com/SmallSteppers

Note the sequence is NOT just a direct sequence of pins…

Vibrating steppers almost always means the connections are wrong…

Hi you have;

8 IN1 9 IN2 10 IN3 11 IN4

Have you tried

8 IN1 10 IN2 9 IN3 11 IN4

And the many other combinations of connecting the Arduino to the driver?

Tom.. :)

Great news,

After lots of playing and no success I order new driver boarda and now I have the motor turning.

Now I just have to learn the control and I can continue with my project. Thanks for all the replies!

Pjl83: Anyway, after going over the wiring a few times to make sure I'd not made any silly mistakes I've noticed that in the documentation there are conflicting drawings showing how it's wired to the Arduino UNO board.

Yes, there's conflicting versions of the hardware probably. You need to experiment to determine the sequence. Power down, swap two wires, power up and try, repeat till it works. Of the 24 possible orders only 8 will be valid.