Hi everyone.
I have been having some trouble getting the 28BYJ-48 stepper motor working using the ULN2003 driver with my Arduino Uno board. Using either the stepper library or setting each pin to high voltage individually both result in the motor vibrating each time the motor tries to step, but the motor never actually moves. The LEDs on the driver also light up in the correct order which can clearly be seen at very low turn speeds. After trying to switch the order of the input pins, I think that the wires on the motor itself may be incorrect, as it seems like the order on the motor side is not the same as the order on the driver side (blue and pink, for instance, are reversed).
The motor is being powered by a separate 5V source from the Arduino and both the power source and the motor are attached to the ground pin on the arduino. The 4 input pins on the motor driver are wired to digital output pins 2-5 on the uno.
Here is the code from this tutorial to manually turn on each digital output pin one at a time:
int bluePin = 2; //IN1 on the ULN2003 Board, BLUE end of the Blue/Yellow motor coil
int pinkPin = 3; //IN2 on the ULN2003 Board, PINK end of the Pink/Orange motor coil
int yellowPin = 4; //IN3 on the ULN2003 Board, YELLOW end of the Blue/Yellow motor coil
int orangePin = 5; //IN4 on the ULN2003 Board, ORANGE end of the Pink/Orange motor coil
int currentStep = 0;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(bluePin, OUTPUT);
pinMode(pinkPin, OUTPUT);
pinMode(yellowPin, OUTPUT);
pinMode(orangePin,OUTPUT);
digitalWrite(bluePin, LOW);
digitalWrite(pinkPin, LOW);
digitalWrite(yellowPin, LOW);
digitalWrite(orangePin, LOW);
}
void loop() {
Serial.print("Step: ");
Serial.println(currentStep);
switch(currentStep){
case 0:
digitalWrite(bluePin, HIGH);
digitalWrite(pinkPin, LOW);
digitalWrite(yellowPin, LOW);
digitalWrite(orangePin, LOW);
break;
case 1:
digitalWrite(bluePin, LOW);
digitalWrite(pinkPin, HIGH);
digitalWrite(yellowPin, LOW);
digitalWrite(orangePin, LOW);
break;
case 2:
digitalWrite(bluePin, LOW);
digitalWrite(pinkPin, LOW);
digitalWrite(yellowPin, HIGH);
digitalWrite(orangePin, LOW);
break;
case 3:
digitalWrite(bluePin, LOW);
digitalWrite(pinkPin, LOW);
digitalWrite(yellowPin, LOW);
digitalWrite(orangePin, HIGH);
break;
}
currentStep = (++currentStep < 4) ? currentStep : 0;
//2000 microseconds, or 2 milliseconds seems to be
//about the shortest delay that is usable. Anything
//lower and the motor starts to freeze.
//delayMicroseconds(2250);
delay(500);
}
Attached is an image of the motor connected to the driver. I would greatly appreciate any help in figuring out what is going on. Thanks.
