Categories
Arduino hardware software

28BYJ Stepper Motor Limits Testing

Stepper motors are great motors for position control and one of the least expensive options for makers to use is the 28BYJ series of motors. They usually come with a ULN2003 based driver board, making them super easy to use, and they have been used in countless hobby applications.

So what are the parameters for these motors and how hard can we push them?

Why Test?

I wanted to replace the DC motors in my SmartCar bot (see this previous post) with stepper motors to get more precise control. However, I really wanted to dig down to understand what I could do to optimize the output of these motors.

As the electrical power in the bot comes from a battery pack it is important to get the best out of this limited resource. So in this application I want to get the most output motor torque for the power input (voltage and current) for different motor variations.

Torque is a measure of how much a force acting on an object causes that object to rotate. It is measured as the cross product between the distance vector (the distance from the pivot point to the point where force is applied) and the force vector. In SI units this is often given as Nm (Newton metres), but any ‘force’ and ‘distance’ dot product could be used (eg, lb⋅ft).

The input power is the voltage supplied times the current drawn (VI) to run the motor, measured in Watts (W). This will be an average value, given that the current will vary up and down when each stepper coil is energised.

General Motor Specifications

This 28BYJ-48 is a 5V unipolar geared stepper motor. They are manufactured in large quantities for the HVAC industry, where they are used as actuators for airflow control in ducts and vanes. These stepper motor with integrated gearbox are extremely popular with makers due to their really low cost and hacking potential.

The motor datasheet gives the following specifications:

The motors have 32 full steps per revolution and the plastic gearbox produces high-torque/low-speed with a 63.68395:1 ratio, usually rounded to 64:1. This gives a total of 2037.8864 (rounded to 2038) full steps for one output revolution. The plastic gears are not particularly robust but seem to be adequate for reasonable loads.

The output shaft is a 9mm long, 5mm diameter, flat-sided shaft (aka double D), mounting lugs.The motor weights around 40g.

Electrical connection is through five conductors terminated into a 0.1″ pitch connector. For hobby use, the motors are usually paired with a ULN2003 driver board.

Because they are so extensively used there are a lot of resources on the web, with a extensive repeats and large range in the quality of information. An interesting video breaking down the internal construction is found here.

Test Motors

My testing trying to determine which motors, and what configuration, would suit my robotics project, so I tested five different configurations of motor/motor driver:

  1. Standard 5V stepper driven by a ULN2003 driver board using a full wave step pattern.
  2. Standard 5V stepper driven by a ULN2003 driver board using a half wave step pattern.
  3. Standard 5V stepper driven by a ULN2003 driver board in a half wave pattern but at 50% motor overvoltage.
  4. 5V stepper modified to bipolar configuration driven by L298 half bridge using a half wave step pattern.
  5. Standard 12V stepper driven by a ULN2003 driver board using a half wave step pattern.

The unipolar/bipolar conversion (test 3) eliminates one of the wires (the red center tap) and allows the motor to be safely driven with doubled voltage. This is an easy modification – a description of what needs to be done is found here.

Tests 1, 2 and 3 were conducted using the same motor, tests 4 and 5 each use different motors – a total of three motors.

A summary of the motors used is given in the table below. In the rest of the analysis, each is referenced by its Test ID.

MotorDriverSupply VMotor VStep PatternTest ID
5VULN20035.85Full Wave5_ULN_F
5VULN20035.85Half Wave5_ULN_H
5VULN20038.88Half Wave8_ULN_H
5V ModdedL29810.710Half Wave10_L298_H
12VULN200312.812Half Wave12_ULN_H

Testing Setup

The test setup is shown in the photos below.

The pulley wheel has a diameter of 40mm and was designed in Fusion360. The motor support block was described in this previous post. The pulley and blocks were 3D printed and connected to the edge of a 3mm MDF scrap so that the pulley could overhang the edge of a bench. The washers in the plastic container are used to weigh the apparatus down onto the bench.

The pulley is connected to the ‘load’ container using fishing line. The variable test weight is an accumulation of M10 galvanised washers – I had a heap of these left over from a decking project. Each washer weighs about 5g.

For a range of motor speeds (measured as step frequency or steps/s), the tests measured the amount of weight the motor could pull up from a standing start. Knowing that the pulley radius is 2cm, the measured weight in grams is multiplied by 2 to gives a torque measured in gf⋅cm (gram force dot product centimeter). This only differs from the official SI units by powers of 10 and acceleration due to gravity (9.8m/s2).

Test Software

To drive the motors I used the MD_Stepper library. This library uses a hardware timer interrupt at the required frequency to step each motor. It keeps time to within a few microseconds of the required step rate and provides a very consistent pattern of pulses.

The controller is connected to two tact switches (a run and a stop switch) and the motor. The Serial Monitor is used to set up the upper and lower limits of travel, other parameters and run the test. If the motor stalls or something else goes wrong, the test can be stopped using the stop switch. Software used for the test is available as the library’s Torque_Test example sketch.

Conducing the test(s) was a long series of putting weight in the suspended container, setting the driving frequency and testing the motor until the difference between ‘stalling at start’ and ‘not stalling at start’ was one washer. This weight was recorded, and then onto the next frequency.

It is worth noting that the highest speed tested (1350 steps/sec) is roughly ⅔ of a rev/s, or about 40 rpm, and the lowest speed tested (50 steps/s) is .025 rev/s or 1.5 rpm.

Results

The first test was to see if there was a significant difference between the torque at different speeds when the motor was run with full steps compared to a half step pattern.

In the chart below we see that full wave generally provides a slightly higher torque but has a lower limit for the starting speed. However, it also sounds ‘rougher’ and is noisier, so I decided to do all the other tests in half step mode only.

The chart also shows a definite step pattern in the output torque, with torque breaks at 1000, 800 and 600 steps/s. This is a pattern that is repeated in the other tests. I have no explanation for this observation.

The next chart maps the torque at different speeds, with all motors driven in half step mode.

The best torque output is with the modified 5V motor using a L298 driver. In other words, the half-bridge configuration outperforms all ULN2033 driven motors.

Of the ULN2003 setups, the 5V motor driven at 8V provides the best torque output. However, in the chart below, this configuration uses the most power and, it turns out, is also the least efficient.

The remaining 2 curves are as you would expect for the 5V and 12V standard setup – the 12V provides a higher torque but also uses more power.

The Torque/Power curves are also as expected. All the motors produce more toque with more power input, the relationship is basically linear and with roughly the same slope (ie, a change in input power creates approximately the same absolute change in output torque).

The final chart shows the Torque/Power (the measure of the efficiency I was looking for – Torque output per unit power) at the different speeds.

The most efficient configuration at just about all speeds is the modified 5V motor (purple line) driven by the half bridge driver, and it gets comparatively more efficient at higher speeds.

Of the standard ULN2003 driven configurations

  • the 12V motor (light blue line) is most efficient over most of the range of speeds but is roughly equivalent to the 5V motor (red) between 800 and 500 steps/s.
  • the 5V overdriven motor (green) is the the least efficient, by a big margin.
  • the 5V configurations driven at full wave (dark blue) and half wave (red) step patterns are similar.

Conclusion

  1. Ignore the advice to drive the 5V motors at a higher voltage to get more torque unless you don’t care about your power supply. Motors also run much hotter at this higher voltage, especially when it stalls, which could eventually damage the motor.
  2. The standard 12V motor/ULN2003 combination is a better choice than the 5V/ULN2003 for my robotic application.
  3. The unipolar motor configuration never as efficient as the bipolar, so consider modifying the cheaper 5V motors and run them at 10V with an alternative motor driver. These give the best performance but there is the additional cost of the half-bridge driver.

5 replies on “28BYJ Stepper Motor Limits Testing”

I would be surprised if there is any difference. The driver board has a handful of very standard components and the motors are all built to a spec. I have ordered these 3 times from different places (all on the cheap side) and they all behave pretty much the same.

Liked by 1 person

Would these work with esp8266 without using the logic converter thingie? I would think it might, plus what is the easiest way to create a zero position. I want to make one of those old time elevator position things and it will not be able to remember where it is when turned off, although I suppose I could use the eprom to store that info too. But a zero position sensor would probably be the best option.

Like

The ULN2003 datasheet says the inputs to the IC are designed for 5V. You may be able to get away with 3.3V, I guess you just need to try it.
For a zero position you normally mount some kind of sensor (like a limit switch) and drive the motor in the direction of the sensor until it changes state due to the presence of the thing you are moving. Remembering zero between MCU reset cycles is not a viable option as the device can be moved manually and the ‘last’ position before power down may not be the same as the ‘first’ position after power up. Once you have detected a zero on power up you can keep track of the pulses back and forth to know where the device is, provided there is no slippage in the motor or moving object.

Liked by 1 person

So there really is no easy way to maintain a zero position, because the slop over time (fancy word: precession) will render that useless. I have some light sensors in a box somewhere, maybe I’ll try that, have it do a full spin and note where the light level gets lowest and that becomes the zero position. Make a table and save only the readings where the light is different from the prior light to keep the table size small and then pick the point where the number is lowest for the zero, light sensor position. So actually need two tables.

Thanks for your help. I use your clock and parola libraries on most of my little projects, fun stuff.

Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s