Hi, I am using a ROHS STEP MOTOR 28BYJ-48 5VDC 15031801 with a ULN2003APG to connect with the arduino, however the stepper motor is not working as such here is my code
#include <Stepper.h>
// Define motor pins connected to ULN2003 driver
#define MP1 8 // IN1 on the ULN2003
#define MP2 9 // IN2 on the ULN2003
#define MP3 10 // IN3 on the ULN2003
#define MP4 11 // IN4 on the ULN2003
#define SPR 2048 // Steps per revolution (for 28BYJ-48 stepper motor)
// Create Stepper object
Stepper stepper(SPR, MP1, MP2, MP3, MP4);
void setup() {
// Set motor speed
stepper.setSpeed(10); // Set speed to 10 RPM
}
void loop() {
// Move the motor 100 steps forward
stepper.step(100);
delay(1000); // Wait for 1 second
// Move the motor 100 steps backward
stepper.step(-100);
delay(1000); // Wait for 1 second
}
Must have external 5V supply or you may damage the Arduino!
Also
Change:
Stepper stepper(SPR, MP1, MP2, MP3, MP4)`
to:
Stepper stepper(SPR, MP1, MP3, MP2, MP4)
did what you said, the stepper motor makes a little noise, but not movement, I have also connected the external battery pack to vin and gnd on the arduino @jim-p
Connect exactly as shown in the diagram.
Connect your battery pack where it says 5V adaptor.
Your battery pack should be less than 6V but more than 4V.
Power the Arduino via USB
Did you make the changes to the code?
Change the number of steps to something larger like 2000
That's not good the board may be bad.
Disconnect the battery.
Disconnect the motor.
Reconnect the battery.
Run your code. All four LED should blink off and on.
#include <Stepper.h>
// Define motor pins connected to ULN2003 driver
#define MP1 8 // IN1 on the ULN2003
#define MP2 9 // IN2 on the ULN2003
#define MP3 10 // IN3 on the ULN2003
#define MP4 11 // IN4 on the ULN2003
#define SPR 2048 // Steps per revolution (for 28BYJ-48 stepper motor)
// Create Stepper object with modified pin sequence
Stepper stepper(SPR, MP1, MP3, MP2, MP4);
void setup() {
// Set motor speed
stepper.setSpeed(10); // Set speed to 10 RPM
}
void loop() {
// Move the motor 2000 steps forward
stepper.step(2000);
delay(1000); // Wait for 1 second
// Move the motor 2000 steps backward
stepper.step(-2000);
delay(1000); // Wait for 1 second
}
still no luck, the b and d are only ones on @jim-p
if i put them in pins 8,9,10,11- b and d light up. Such as if I put IN2 in pin 0 on the arduino, A lights up, IN1 in pin 1, b lights up, IN4 in pin 4 lights up, however c blinks in pin 6 @jim-p
Well, either you have a bad connection somewhere, the ULN2003 board is bad, or the Arduino is damaged
Check and make sure your connections are good, no loose wires.
Try different pins on the arduino, maybe 2, 3, 4 and 5.
Try my test code again with the new pins.
If it still does not work, I think the ULN board is bad.