Go Down

Topic: ULN2003 all LED's light up when a stepper motor is in (Read 276 times) previous topic - next topic

NM456

Hey guys!

So I'll try to keep this short. Basically, I'm trying to control a 28BYJ-48 stepper motor (the 12v variant with a half-step of 8.) with a ULN2003 motor driver. I believe I've connected it all correctly for two reasons:

1. This site: (https://arduino-info.wikispaces.com/SmallSteppers) says that when run in a 4 step sequence, the on board LED's should flash in the sequence AB-BC-CD-DA, which they do (only when a motor is not plugged in)

2. I've measured the output of the ULN2003 with a multimeter, and it seems to be a reasonable voltage (6v on 4 pins and about 11v on the remaining pin).



I'll attach a picture of my wiring. Note that while the ULN's In1, In2, In3, and In4 go to the arduino pins 2,3,4,5 respectively, in the software I've changed the order of the pins to 5,3,2,4. I'm powering the driver at 12v through the arduino mega's vin pin. Grounds are also connected.

The problem arises when I plug in a motor (of course I shut down the driver first). The sequence goes from AB-BC-CD-DA to all of the LED's on, regardless of the stepping speed.


Here's the code I'm using:

Code: [Select]

/*
 Stepper Motor Control - one revolution

 This program drives a unipolar or bipolar stepper motor.
 The motor is attached to digital pins 8 - 11 of the Arduino.

 The motor should revolve one revolution in one direction, then
 one revolution in the other direction.


 Created 11 Mar. 2007
 Modified 30 Nov. 2009
 by Tom Igoe

 */

#include <Stepper.h>

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

// initialize the stepper library pins:
Stepper myStepper(stepsPerRevolution, 5, 3, 2, 4);

void setup() {
  // set the speed at 1 rpm so I can see the LED's flashing individually:
  myStepper.setSpeed(1);
  // 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);
}




Thanks in advance for any help!  :)

edit: I forgot to mention, I've tried 4 different motors, 3 different drivers, and 3 arduinos. Overkill, but wanted to be sure

larryd

Are you using the Arduino Vin pin to power the motor?


.
No technical PMs.
The last thing you did is where you should start looking.


edgemoron

#3
Jul 17, 2017, 10:53 am Last Edit: Jul 17, 2017, 11:16 am by edgemoron
The VIN pin is for power INPUT, you can't pull much power FROM it because its routed through a reverse polarity diode that may overheat and drop voltage with too much current. You need separate wires from 12V supply to motor board.

NM456

I tried separating the power supplies, the same thing still happens /:

Thanks for the suggestion though!

edgemoron

#5
Jul 19, 2017, 05:43 am Last Edit: Jul 19, 2017, 05:44 am by edgemoron
Make sure there is a wire from the ULN2003's E pin (8) to Arduino GND.

Go Up