As promised in my previous post here is information on how to adjust the A4988 current limit setting for use with stepper motors rated for a maximum current less than 2A per phase.
There’s also “bonus” info on how to measure the current of a stepper motor under load conditions, Ohm’s law, adding current monitoring capability to the Arduino and finally a really simple process to address power dissipation requirements without any calculations.
The A4988 Driver Chip Ratings
The A4988 stepper driver chip is designed to operate any bipolar stepper motor with a drive capacity of up to 35V and ±2A per phase. The stepper motor supply voltage provided to the A4988 break out board however must be between 8-35V and ±4A.
In selecting a stepper motor for your indexing head, your primary concern should be selecting a motor with sufficient holding torque @ a rated amperage of ±2A/ph or less.
You may use a motor with a voltage rating of less than 8volts and/or less than 2A per coil but you should be aware of how your choice of motor may impact the power dissipation requirements of the A4988 driver chip and may require adjustment to the current limiter.
Failure to provide sufficient power dissipation can result in under specification torque output due to current drop off due to chip over heating, while failure to adjust the current limit may result in catastrophic motor failure.
Ohm’s Law
If your motor is rated less than 2A per phase then you may need to adjust the A4988 current limiter, but then again you may not. Here’s how to determine if you will need to limit the current of the driver output.
Ohm's Law states that the current (I) flowing through a conductor (our stepper motor coil winding) between two points (the ends of motor leads) is proportional to the voltage difference across those points. The 'constant of proportionality' is known as the resistance and is measured in Ohms (Ω
. The formula for calculating the current is expressed as:
I = V / R
For example, the Soyo model SY57ST76-0686A stepper motor that I’ve selected for my project is rated at:
Current rating: 680 mA (0.68A) per coil
Coil Resistance: 17.65 Ω (Ohms) per coil
Voltage rating: 12 Volts
The ratings mean that with the fixed resistance of 17.65 Ω across the stepper motor windings and a supply voltage of 12 volts across it, the current flowing through the motor shall be 0.68 amps.
I = V / R, or 12 ÷ 17.65 = 0.68 amps
This motor is well suited for the controller design. The current rating well below the maximum the current output capability of the A4988 driver means my controller shouldn’t require any additional cooling.
In theory I don’t need to adjust the current limiter on the A4988 driver since the voltage input to the motor matches that of the motor rating. This means that the 12V supply voltage is acting as the current limiter.
However, there is nothing physically preventing someone from plugging in a power supply greater than my 12V design input, which would result in higher than rated current being supplied to the stepper motor. Cheap unregulated DC power supplies can also deliver voltages higher than their rated output so it may be advisable to set the current limiter to match the motor rating just to be safe.
Here’s a not so ideal example:
A common stepper motor is rated as follows:
Current rating: 600 mA (0.6A) per coil
Coil Resistance: 6.5 Ω (Ohms) per coil
Voltage rating: 3.9 Volts
The motor has a known, fixed resistance of 6.5 Ohms when we apply the 12 volt supply across it rather than the 3.9 volts it’s rated for, the current flowing through the motor will be 1.846 amps (I = V / R). This exceeds the rated input by a factor of 3!
Where’s that excess current going? It’s being converted to heat within the motor windings. The motor can’t handle that excess heat. If this is your stepper motor prepare to see magic blue smoke wafting out of the motor housing in short order if you don’t shut down driver or limit the current flow!
Adjusting the Stepper Motor Current Limit setting of the A4988 Driver
We can still use that stepper motor rated for 0.6A @ 3.9 volts but the current must actively be limited to under 0.6A to prevent damage to the motor. The trimmer potentiometer on the A4988 board allows the user to adjust the current limit to suit their stepper motor requirements.
There are two main methods of determining the current output and current limit setting of the driver.
The first method measures the voltage at a reference pin on the driver board and employs a simple math equation.
The second involves more complicated measurement the current flow across the stepper motor coil.
Both methods apply a correction factor, since the A4988 driver only outputs 70% of current limit setting when running in full-step mode. We’ll be operating our steppers in full-step mode so we need to be aware of correction factors to determine to actual current limit setting.
I’m including the more complex measurement technique since my next post will illustrate how to modify this method of measurement to permit the Arduino controller to display the A4988 output current. Adding output current to the display outputs will make it easy to adjust the A4988 current limit and to monitor the chip output during normal operating conditions. At the end of this post I’ll explain more why it can be beneficial to do so.
Method 1:
To set the current limit with this method you measure the voltage between a “reference pin” and ground on the A4988 board and then calculate the resulting current limit setting.
The reference pin voltage is accessible on a “via”, a copper lined thru hole that makes an electrical connection between the layers of the printed circuit board. The pin is circled on the bottom silkscreen of the circuit board, but is accessible on both sides of the board. See the attached photo from the Pololu website.
The current limit relates to the reference voltage as follows:
Current Limit Setting = VREF × 2.5
For example, if the reference voltage is 0.8 V, the current limit setting is 2.0 A.
Remember, as mentioned previously, in full step mode, the current through the coils is limited to 70% of the current limit setting so we need to correct for that to assure we get sufficient current to our motor so it can provide maximum torque.
Now let’s consider our previous stepper motor example with the following rating:
Current rating: 600 mA (0.6) per coil
Coil Resistance: 6.5 Ω (Ohms) per coil
Voltage rating: 3.9 Volts
We wish to limit the current to the 0.60A of the stepper motor we first need to correct for the 70% power rating to find the correct current limit setting to be applied, 0.60A ÷ 0.7 = 0.857A.
The current limit setting of 0.857A corresponds to a VREF of 0.857A ÷ 2.5 = 0.343V. Simply turn the adjustment screw on the trim potentiometer until you get a reference voltage reading of 0.343V
Behind that simple looking equation are voltage comparator circuits, current sensing resistors (shunts), and Ohms law. I’ll have more about current sensing resistors in my next post.
Method 2:
To adjust the current limit setting with this method you put the driver into full-step mode and use an ammeter to directly measure the current flow through a motor coil and adjust the trim potentiometer to obtain the desired current setting.
However there are a few caveats, the first of which is that we need to be driving the motor in full-step mode without clocking the STEP input.
Secondly, recall that to we first need to correct for the 70% power rating in full-step mode to find the correct current limit setting to be applied. Therefore to limit the full-step mode current to the 0.60A for our example stepper motor we first calculate the full power setting to be applied:
0.60A ÷ 0.7 = 0.857A
If you forget to apply the correction factor our motor would happily run all day long, but it will perform below its rated holding torque, perhaps too low to use for your purposes.
Finally due to the A4988 driver circuit design you must measure the current only across the motor coil. Measuring a motor’s current at the power supply inlet while not normally an incorrect method in this case will result in an inaccurate reading since the A4988 driver circuit and motor coil together can act like a switching step-down power supply where different loops in the circuit have different voltages and currents across the loops.
Also, you must ensure to measure the current with an ammeter that’s wired in series with the motor coil you are measuring. People often try to incorrectly measure current by connecting the ammeter in parallel to the circuit, since that’s how we connect a voltage meter but by doing so all the current will bypass the much higher resistance of the motor coil in favour of the short circuit created by the zero resistance path thru the ammeter.
Knowing how to properly connect your ammeter in series with the motor coil is helpful since we can build upon that knowledge and later wire a shunt (a special type of current sensing resistor) into the circuit in the same manner as an ammeter and use that shunt to add a current meter function to our controller.
Why it’s beneficial to add current metering to your controller.
Firstly, the most practical benefit of adding a current meter to your controller is that it acts as a surrogate power dissipation monitor. If the A4988 driver does not have sufficient cooling the current output of the driver will diminish as the chip heats up. Eventually the output may shut down due to the IC chip’s thermal overload protection.
The conditions you normally operate your indexing head will likely vary greatly from the bench conditions where you tested the driver current output and set the current limit. Measuring the current output with ammeter only during the short time period it takes to adjust the current limiter will not tell you how the driver will perform during your normal operation. Building in current meter functionality to your controller can help assure you that the driver will continue to deliver the set output during normal operations so your stepper motor will deliver the maximum holding torque.
Secondly building the ability to display the A4988 current output into your controller will allow you to easily swap out stepper motors if you need to replace your motor with one of a different specification (such as if your first motor lacked sufficient torque).
NOTE: the current limiting potentiometer is not designed for repeated adjustment but rather as a set it and forget feature. You should not expect the pot to deliver more than a handful of current adjustments over the course of its lifespan. It should however be sufficient to allow a few motor changes over the life of the A4988 carrier board.
p.s. don’t solder the driver carrier to the PCB but rather solder female headers into the circuit board and plug the carrier board into the header instead to facilitate easy replacement of the driver if necessary.
In my case I intend to design my controller to fit into a pretty small enclosure. I intend to purchase and install the minimal number of parts required to suit my space and budget.
Since the motor I selected is rated for 125 oz-in of holding torque at a modest 0.68A I shouldn’t require any additional cooling and therefore I plan to omit both a heat sink and a cooling fan from my initial build. My sole source of cooling will be air circulation vents on the bottom and rear of the enclosure.
If the rated torque is too low to provide sufficient holding power to allow me to cut 60 tooth gears 3” in ¼” wide steel blanks I may have to source a new motor with higher specifications and adjust the current output.
I’ll be cutting gears over work sessions lasting hours at a time, which is ample time for heat to build up inside the enclosure. If my enclosure is too small or if the air vents lack sufficient free area to allow adequate air circulation the chip may over heat resulting in the current output dropping over time.
By monitoring the current during normal operation I can ascertain if there is any current drop off and implement the following incremental steps one at a time, stopping after each implementation to determine if current drop off has been mitigated:
Increase the free area or number of air vents in the enclosure;
Add heat sink to the top of the A4988 chip;
Add a very small cooling fan;
Add larger cooling fan;
Make larger enclosure;
Increase the free area or number of air vents in the larger enclosure;
Add larger cooling fan;
Add largest cooling fan possible.
That’s all for this post, if you read to the end of this post thanks, that’s great!