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?
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.
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:
- Standard 5V stepper driven by a ULN2003 driver board using a full wave step pattern.
- Standard 5V stepper driven by a ULN2003 driver board using a half wave step pattern.
- Standard 5V stepper driven by a ULN2003 driver board in a half wave pattern but at 50% motor overvoltage.
- 5V stepper modified to bipolar configuration driven by L298 half bridge using a half wave step pattern.
- 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.
|Motor||Driver||Supply V||Motor V||Step Pattern||Test ID|
|5V Modded||L298||10.7||10||Half Wave||10_L298_H|
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).
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.
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.
- 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.
- The standard 12V motor/ULN2003 combination is a better choice than the 5V/ULN2003 for my robotic application.
- 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.