1

I'm a beginner with Arduino. I managed to grasp the basic understanding and try to use each component/shield that came with my Arduino kit.

I'm unable to use the following component:

  • Step Motor 28BYJ-48
  • Step Motor controller board ULN2003APG

I connected the Arduino to the ULN2003APG and put some coding such that I can see that the ULN2003APG's LED turned on from 1, 2, 3, 4, 1, 2, 3, 4, and so on. So this is as expected as per programming below.

My issue:

  1. I noticed the LED in the ULN2003APG is not as bright as a regular LED.
  2. Once I plugged in the 28BYJ-48 to the ULN2003APG, the ULN2003APG's LED all off.
  3. The motor (28BYJ-48) doesn't spin - at all.
  4. I tried to spin the motor with my 2 fingers, it seems pretty heavy - is this normal?

Is this a faulty ULN2003APG or is it a faulty 28BYJ-48 or is it a faulty programming? please help.

Program:

#include <Stepper.h>

int pin1=8;
int pin2=9;
int pin3=10;
int pin4=11;
int _step=0;
void setup() {
    Serial.begin(9600);
    pinMode(pin1, INPUT);
    pinMode(pin2, INPUT);
    pinMode(pin3, INPUT);
    pinMode(pin4, INPUT);
}

void loop() {
  switch (_step){
    case 0:
      digitalWrite (pin1, HIGH);
      digitalWrite (pin2, LOW);
      digitalWrite (pin3, LOW);
      digitalWrite (pin4, LOW);
      break;
    case 1:
      digitalWrite (pin1, LOW);
      digitalWrite (pin2, HIGH);
      digitalWrite (pin3, LOW);
      digitalWrite (pin4, LOW);
      break;
    case 2:
      digitalWrite (pin1, LOW);
      digitalWrite (pin2, LOW);
      digitalWrite (pin3, HIGH);
      digitalWrite (pin4, LOW);
      break;
    case 3:
      digitalWrite (pin1, LOW);
      digitalWrite (pin2, LOW);
      digitalWrite (pin3, LOW);
      digitalWrite (pin4, HIGH);
      break;
  }
  _step ++;
  if (_step == 4){
    _step = 0;
  }
  Serial.println(_step);
  delay(250); 

}
1

What happens if you change

pinMode(pin1, INPUT);
pinMode(pin1, INPUT); // Pin 2 ?
pinMode(pin3, INPUT);
pinMode(pin4, INPUT);

to

pinMode(pin1, OUTPUT);
pinMode(pin2, OUTPUT);
pinMode(pin3, OUTPUT);
pinMode(pin4, OUTPUT);

Answer for Q1 - Q3. You are using pinMode as an input. Using digitalWrite() on an INPUT will enable (HIGH) or disable (LOW) the internal pullup resistor on the input pin. The pin will not be able to "source" enough current to operate the stepper motor.

A4. The stepper motor has a "mechanical" 1/64 gear ratio. This is why it is hard to turn by hand.

Here are 2 pages that will help you to understand the issue: https://www.arduino.cc/en/Reference/PinMode and https://www.arduino.cc/en/Reference/DigitalWrite.

|improve this answer|||||
  • Hey, sorry let me fix that. – RonPringadi Oct 2 '17 at 3:18
  • It works, thanks a lot! I noticed the typo on the pin1 and pin1. Then, as you point out the INPUT should be OUTPUT. Thanks again! – RonPringadi Oct 2 '17 at 12:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.