Stepper Motor doesn't work

I'm using 28BYJ-48 stepper motor from the arduino mega project kit along with a ULN2003APG stepper Motor driver. I attached all the hardware correctly as a copied it exactly from the manual, and a YouTube video. I used a multimeter on the battery and it's not dead, so I'm not sure what the issue is. Here's the code I used:

If this helps, I added the serial.print command at the end because I noticed that it took around 6 seconds to get a response from the serial monitor when I had the mystepper.step command, compared to when I didn't.

Your code works... all the pins "output" and "2048" shows about every six seconds.

Check your wiring.
Check your polarity of your battery and motors.
Do you see lights on the motor driver?

You should post your code as text in a code block, not as an image.

1 Like

Code:

> #include <Stepper.h>
> int spr = 2048;
> int motSpeed = 10;
> Stepper myStepper(spr, 8, 10, 9, 11); 
> void setup() {
>   Serial.begin(9600);
>   myStepper.setSpeed(motSpeed);
> 
> }
> 
> void loop() {
>   myStepper.step(spr);
> 
>   Serial.println(spr);
> }

Polarity and wiring looks good, no lights on the motor driver. There is a light on the power source though, only because of the button beside it. Here is a photo if you'd like to take a look for yourself.

Are you getting 5vdc to the ULN2003? Check voltage at the breadboard VCC and GND rails (near the stepper motor). I suspect the 9VDC battery.

I am getting 0.623 volts from there

  • Dead battery.

  • Use 6v directly i.e. 4 X AA batteries, use no breadboard power supply.

1 Like

When you get the 4xAA batteries (4 x 1.5 = 6vdc... or 5xAA = 5 x 1.5 = 7.5vdc), replace the sketch you are using with this sketch... the reason is, this sketch move backwards and forwards at 18 RPM, then 1 RPM for 2048 steps, rather than continually moving forward. It lets you see more than just movement.

int stepperrev = 2048;

Stepper myStepper(stepperrev, 8, 10, 9, 11); // sequence
void setup() {
  Serial.begin(115200);
}

void loop() {
  myStepper.setSpeed(18); // RPM
  myStepper.step(stepperrev); // forward
  Serial.println(stepperrev); // 2048
  myStepper.setSpeed(1); // RPM - look at the pretty lights
  myStepper.step(-stepperrev); // reverse
  Serial.println(-stepperrev); // 2048
}

After taking out the power supply on the breadboard, where am I supposed to plug the 4 x AA batteries into? Also are you able to explain why it can't be 9V please?

They are for smoke alarms............
PP3 NO2

Plug the battery module into the UNL2003 (motor driver module) where you will see a "- +" (near the "5v 12v" jumper)

I don't know where I'm supposed to add it. I used a circular shaped end of the cord, correct?

On the motor driver module, the two wires together (red and black) are for your power supply. From where are those red and black wires in the picture?

They connect to the breadboard which connects to the power supply. I don't have a 4 x AA battery holder yet so it is still in place

Make the motor power supply go straight to the motor power connections. Solderless breadboards are for low-power devices.

I see... you are using the breadboard power supply for the motor.

Use the breadboard power supply just for the low-power devices, and put the 4xAA power supply directly on the motor driver module.

Ensure grounds from each device and power supply meets on a bus-bar or a single point.

The only device as of now I'm trying to power is the stepper motor and its driver module. How am I supposed to put the 4xAA power supply directly on the motor driver module?? You can use the other pictures for reference

The 4xAA power supply probably has bare wire at the end of the red wire and black wire. I like to cut a male-male jumper wire into two, then solder each piece of jumper to the power supply wires. That gives you male ends for the power supply and male ends for the motor driver module. Using two female-female DuPont jumper wires, connect red-male-pins together and black-male-pins together.

OR...

Cut one female-female DuPont jumper wire and solder the female pieces directly to the power supply red/black wires... you will have female pins on the power supply with male pins on the motor driver module.

I do not have a solder machine

For a temporary solution of mating two bare wires, strip enough wire from one end of each wire where you can put several twists in the pair that they stay together, then cover the bare wire with tape.

Should I just get a new power supply module instead?

Your goal with electronics, and especially power transfer, is to have a "connector-free" connection. With off-the-shelf electronic devices you can "see" (measure) the voltage drop that occurs where connections are made. That is why "soldering" (or "crimping", if higher power and heat are involved) is required, or at the hobby level, recommended.

A soldering-practice-kit cost 10 dollars/pounds/euro and with practice under the lead of a good video or ten, you will make perfect solder connections... and save money buying purpose-built power supplies.

"Should I get a new power supply?" No. You should learn to make secure connections so you KNOW the power connection (or any connection) is not the issue.

However; If you want to buy more power supplies, that is your right.