Erratic movement of 28BYJ-48 5V

Hello

I'm quite new to arduino, completely new to stepper motors. Anyway, I have a 28BYJ-48 5V stepper motor with the corresponding ULN2003 driver, both part of a starter kit with arduinio uno I got some time ago. I've been reading all I've found about steppers, and I think I got the main ideas. I've tested the motor with the stepper library, and it seems to work, although the number of steps per revolution is driving me nuts.

I've seen some sources say that this particular model is a 64 steps per revolution, while other places say it's 32. And then it has an almost 64:1 reduction, so a total of 64x64=4096 steps per revolution (a little less, 4076 apparently, the gear ratio is no exactly 64).

According to this, if I tell arduinio to drive for 4076 steps, it should give me a full 360º rotation of the shaft, shouldn't it? Well, not quite. The rotation I'm getting depends on the speed stetting! :crazy_face: With a value of 300, I get a quite-consistent 270º. If I go to 400, it gets me almost 1 rev, a few degrees more. If I lower it to 200, the movement is muche less smoth, jumpier, and I get a bit less than 270º. Going to 100 get's smoother again, but it gives me almost 2 revolutions! From 500 and up, the movement becomes very jumpy and slow, and at 700 it doesn't move.

I don't knwo what the speed setting is really doing, I think it's related to the delay between each step is commanded, but the non-linear behaviour I see is killing me. Other erratic aspect is that when I drive it CW and CCW, I don't get back to the initial point, it's like with every loop it skips or gains a few steps on each direction, completely random, so it ends up drifing away from the stating orientation.
Am I doing something wrong? Or is it that I have a crappy motor and I should be getting a better one?

The circuit is fairly simple, so I don't think I've mess it up. I'm powering the ardunio from the USB, the motor with an external 5v power source, the arduino GND connected to the GND of the 5v supply. Pins for the motor coils are 8 to 11.

This is my sketch, taken form an exapmle online at Stepper Motors with Arduino – Bipolar & Unipolar, with some changes, like the stes per revolution value from 32 to 64.

#include <Stepper.h>

// Define Constants

// Number of steps per internal motor revolution 
const float STEPS_PER_REV = 64; 

//  Amount of Gear Reduction
const float GEAR_RED = 64;

// Number of steps per geared output rotation
//const float STEPS_PER_OUT_REV = STEPS_PER_REV * GEAR_RED;
const float STEPS_PER_OUT_REV = 4076;
// Define Variables


// Create Instance of Stepper Class
// Specify Pins used for motor coils
// The pins used are 8,9,10,11 
// Connected to ULN2003 Motor Driver In1, In2, In3, In4 
// Pins entered in sequence 1-3-2-4 for proper step sequencing

Stepper steppermotor(STEPS_PER_REV, 8, 10, 9, 11);

void setup()
{
// Nothing  (Stepper Library sets pins as outputs)
}

void loop()
{
  steppermotor.setSpeed(400);  
  steppermotor.step(STEPS_PER_OUT_REV);
  delay(1000);
  steppermotor.step(-STEPS_PER_OUT_REV);
  delay(1000);

}

Thanks a lot for any help you can provide.

Hi, the hearing on these motors is rarely specific to "X-pulses = 1 turn. These motors are often used on thinks like fans and aircon flaps where there are limit switches to control position.

One of my motors has 2038.6 pules per turn (and this is not exact either).
So, if you want a more precise movement then a non-geared stepper is the best, followed by a servo.
Yes, the gearing will drive you nuts, until you add positional switches or rotary encoders.
Do not relay on only pulse counting for positioning with this.

I have done testing with my stepper. I find that 10rpm is about the maximum you will get without skipping steps. I fine 6.5 rpm to be best using 4ms pulses with 500us interpulse delay.

" Jumpy" steppes means you either have a phase not connected or you are pulsing too quickly.

These motors are supposed to move slowly. Try reducing your speed.

Depends, wether the stepper class uses fullsteps or halfsteps. As far as I know it does fullstep, which means one revolution is about 2048 steps ( depending of the exact gear ratio ).

steppermotor.setSpeed(400);  

means 400 rev per minute and of course the actual steprate depends on the STEPS_PER_REV value when creating the steppermotor object.

I don't know ... but my 28BYJ does what it is supposed to do with your sketch. ( And it does 2 revolutions back and forth )

The 400 rpm makes sense, divided by 64 it's 6.25, so around 10s per revolution, more or less what I'm getting.

I want the motor to drive a gear set which must rotate a certain agular value, I don't need to be super precise, but I cannot have it drifting over time, so I will implement some position control, perhaps with some switches to stop the movement when the gear reaches its desired position, or a potentionmeter driven by the gear as well. As I'm still working on the mechanical design, I can make the changes.

Thanks for your support!

The internal gear ratio varies from motor to motor as several different manufacturers make them. nominally its 64:1 reduction, but in reality its
probably different (mine is 64x403 : 405, or about 63.684:1). The motor is
32 steps/rev, followed by about 64:1 reduction gives about 2048 steps/rev.

If you use x2 microstepping (aka half-steps) you of course multiply the 2048 by 2
(4096, not 4076 as in your code!).

If you need to know the actual gear ratio you'll have to disassemble your motor and count the gear teeth...

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.