UPDATE: Current adjustment for motor drivers (DRV8825 / A4988)

This is just some remarks about adjusting stepper drivers like DRV8825 and A4988; it might also apply to other motor drivers with internal Vref voltages.

I write these notes as a lot of people are searching for simple recipes to answer the question:
"How to adjust/limit the driver's motor current?"

Although there is a lot of information in this forum and in the I-Net answering to this question, I think a lot of them are just copying what others said, but if you are really looking for what you should do, step by step - without losing an important step (coming to that later) - then this piece is missing most of the times.

The recipe looks quite simple:

  • find the Vref adjustment point of the driver
  • use the adequate formula to translate the required max. current (per coil) to Vref
  • adjust to that value by turning the adjustment potentiometer

All of these steps are correct.

But the following questions are not answered:
-> under what conditions can I do that adjustment? with the following questions

  1. Do I need to power only the logic power supply from Arduino to the Vin of the driver?
  2. Do I need to have Vmot connected and powered?
  3. Do I need to have the stepper motor connected or not?
  4. Do I need to turn the motor by running the Arduino's motor sketch?
  5. Do I need to turn the potentiometer clock-/or counter-clockwise to raise Vref (and as a result the current)?

If you look at the DRV8825/A4988 CHIP (!) datasheet, it will give us some answers.

  • The A4988 does NOT come with an internal power regulator to be used for Vref, so it needs +Vdd (and GND) from the Arduino.
  • An exception is a "larger carrier version" of the A4988 breakout board made by Pololu which comes with an internal voltage regulator - in this case you don't need +Vdd from Arduino
  • The DRV8825 has an internal 3V3 regulator (Pin V3P3OUT) which is used by the breakout board to provide this voltage to the reference potentiometer as its max. reference point, so NO need and no connection pin for +Vdd
  • If there is no +Vdd from the Arduino needed or possible (the DRV8825 does not come with a "+Vdd" pin), then you will need Vmot to power the chip and use its internal voltage regulator to produce the output voltage to the potentiometer which then can adjust Vref to the appropriate Vref sense pin of the driver.
  • Referring to the datasheet of the chips it doesn't matter if the motor is connected or not as this has no influence on the "production" of Vref
  • Same applies to the question, if the motor is turning (getting step and direction information from the Arduino) or not
  • If the coil current is raised or lowered by turning the potentiometer CW is a question of how the manufacturer of the breakout board implemented the pot

Answers 1-5:

1a. If you have an A4988 (normal build without voltage regulator on breakout board) you need to connect +5V and GND from Arduino to the driver
1b. If you have an A4988 with voltage regulator then you can omit the +5V connection
1c. The DRV8825 has its own chip internal regulator, so you won't find a +Vdd connector on board

  1. 1a does not need Vmot
    1b does not need Vmot
    1c needs Vmot (watch the Vmot limits < 45V; recommendation: stay under 40Vmax)

  2. No, but if it is connected, it doesn't matter
    Edit: it DOES matter with some clones (see posts #14/#15) -> to be on the safe side: don't connect the motor yet! Otherwise it could be that you can't measure any Vref value.

  3. No. So you don't need to run a sketch while adjusting current limits. But - after you have set the current limit by adjusting Vref to the equivalence of Imax (of one coil) you might lower the current while it is turning under load until it's close to lose steps (most of the time Imax will result in more torque than your application needs; re-adjusting by lowering the current saves energy and lowers the operating temperature of driver and motor).

  4. Because it's a question of how the manufacturer set up the board design, there is only one correct answer: for the original pololu breakout boards of A4988 and DRV8825 you turn the potentiometer clockwise to raise Vref and thus the current and CCW to lower the current.
    For all other drivers it's a matter of either your manufacturer provides an information about that or you have to find out on your own (be careful only to turn the screwdriver in very small portions).

To summarize:

Find out the Vref location on the breakout board - Pololu comes with two locations: a via close to the chip and the center point of the potentiometer; clones mostly only provide the center point of the potentiometer

Connect GND with your multimeter "-" probe; connect "+"probe with Vref on the driver board (with an unisolated screwdriver you can attach the "+" wire of the multimeter and then you can adjust while measuring. Be careful not to cause a shortage by sliding around with the tip of the screwdriver

Connect +5V from Arduino if your driver is a normal A4988 w/o voltage regulator

Connect Vmot to DRV8825 (and to A4988 with own regulator; constellation is not often found)

You can have the stepper connected or not (see above: 3. and 4.)

Adjust Vref (=Imax) by turning the potentiometer CW/CCW (see 5.) to a value which follows the driver's calculation formula.

Find the formula for the current sense circuit for your actual driver. Do not use advice from another driver: they might be different. This should be given to you when you bought the driver. It might be in the product description or on a piece of paper in the box. The formula below (for DRV8825) is based on the very common 0.1 Ohm sense resistors but yours might be different. For A4988, most common Rcs = 0,05 Ohm.

The formula for drivers is often written in a "non expert" way, such as Imax = x * Vref.

For simplification I follow this:

  • DRV8825: Imax = 2 * Vref (which means if Imax = 1.5A, then Vref is to be set to 1.5/2 V = 0.75V)
  • A4988 : Imax = 2,5 * Vref // with Rcs = 0,05 Ohm

To conclude you will find below some useful links:
DRV8825 chip datasheet
Pololu's A4988 description
Pololu's DRV8825 description

Addit:

If you want to use another method, have an amp meter and are skilled enough in electronics you could also use the "direct" method to adjust the current:

You will typically want to set the driver’s current limit to be at or below the current rating of your stepper motor. One way to set the current limit is to put the driver into full-step mode and to measure the current running through a single motor coil without clocking the STEP input. The measured current will be 0.7 times the current limit (since both coils are always on and limited to approximately 70% of the current limit setting in full-step mode).

This is a quote from Pololu's website about the DRV8825 and applies also to the A4988.

######### UPDATE (January 2017): ############
Important!
Pls read reply #16 to get updated information on Pololu's A4988 boards (since Jan 2017).

Great post rpt007! I know exactly what you mean.

I was simply following those other online procedures for setting Vref, but doesn't seem clear in terms of what connections actually matter.

I figured I'll put up a diagram of connections for setting Vref.

Also, for adding the mini heatsink to the DRV8825 (not shown here), I like to remove the sticky patch from the under-side of the heatsink with acetone, and then use a curing/setting heatsink compound for bonding the heatsink to the surface of the chip casing. Once the adhesive compound has cured (hard set), the heatsink becomes strongly attached to the chip. The mini heatsink usually comes with the DRV8825 package - but usually need to manually install the heatsink.

The sticky patch is actually ok to use though, otherwise they wouldn't send the heatsink with the sticky patch.

@rpt007, thanks for that. I will bookmark it. I presume you don't mind if I refer others to it.

...R

@Southpark:

Thanks for the edited picture which will help newbies to set their 8825 up.
One remark: the logic power supply from Arduino to RESET/SLEEP is actually not needed to adjust the current limit.

That said I am thinking of adding a post about what is essential to get the motor run and how to set up microstepping of the A4988 and DRV8825.

@Robin2:
I am fine with sharing this knowledge, admitting that I only concentrated existing information in one place - but at the time when I started with stepper motors and drivers I wished it would have been found in one place.

About getting your stepper move in full and micro steps

In post#1 it was all about setting the current limits. So I only concentrated on the minimal wiring for doing that and you could see the difference in powering the A4988 and DRV8825.

To prevent your stepper motor from being overheated and burnt this step is essential at the very beginning of a project. But the real fun part of dealing with stepper motors is just watching them turn for the first time.

To get to this point we have to consider some more points which will be described below.

  1. A4988:

A4988 Stepper Motor Driver Carrier.jpg
Shows the minimal wiring to get an A4988 run the stepper.
Note:
MS1 and MS3 have internal 100kΩ pull-down resistors and MS2 has an internal 50kΩ pull-down resistor, so leaving these three microstep selection pins disconnected results in full-step mode. If you want to achieve microstepping, then use the following table.

A4988 Microstepping.jpg
Microstepping table for A4988

  1. DRV8825:
    DRV8825 Stepper Motor Driver Carrier.jpg
    Minimal wiring to get a DRV8825 run
    Note:
    The resolution (step size) selector inputs (MODE0, MODE1, and MODE2) enable selection from the six step resolutions according to the table below. All three selector inputs have internal 100kΩ pull-down resistors, so leaving these three microstep selection pins disconnected results in full-step mode.

DRV8825 Microstepping.jpg
Microstepping table for DRV8825

Having finished the wiring of your stepper and Arduino the last part is to upload a sketch to your Arduino so that the driver gets the direction and step pulses to actually let the stepper turn.

This is not part of my little contribution here.
I will refer to Robin2's basic and very helpful informations here:
Simple Stepper Program
and
Stepper Motor Basics

rpt007:
One remark: the logic power supply from Arduino to RESET/SLEEP is actually not needed to adjust the current limit.

Thanks rpt007! I just saw your kind remark a moment ago, and then accordingly edited the diagram for showing the connections for a Vref adjustment. Thanks for that!

@Southpark:

Oh, I think it was not needed to edit your picture.
It doesn't hurt if the logic power supply is attached.

People tend to not carefully read, especially when the text as in my post#1 is so long and has so many "ifs".
Then they might forget after having set the current limits to wire the logic power and wonder why the stepper is not turning.

So I wouldn't mind if you take your first picture - my reply was jsut a technical remark. For practical purposes your set up is very well done.

rpt007:
So I wouldn't mind if you take your first picture - my reply was jsut a technical remark. For practical purposes your set up is very well done.

Thanks for letting me know rpt007! I still had the previous pic, so loaded it again now. Much appreciated.

The above mentioned formulas are only valid if the breakout boards come with the specified sense resistors; e.g. for DRV8825 these resistors come with 0.1 Ohms (per coil).

I would put this as step 1. For boards other than the Pololu ones, the sense resistors are likely to be different. Particularly because the datasheet for the DRV8825 shows different sense resistors.

STEP 1 Find the formula for the current sense circuit for your actual driver. Do not use advice from another driver: they might be different. This should be given to you when you bought the driver. It might be in the product description or on a piece of paper in the box. The formula below is based on the very common 0.1 Ohm sense resistors but yours might be different.

@MorganS:

Thank you for bringing this up. I followed your recommendation and modified my first post accordingly.

hello, good tips, but I still have some problems..

i bought four drv8825 and a cnc shield, I could not calibrate any because when I touch the potentiometer the reading is 0...

I followed the steps, I connected the drv8825 on the shield with the pins A1, A2, B1, B2 on the side connectors for the motor, connect an external 12V supply, I touch gnd with the tester and the potentiometer's screw and the reading is 0, turn sideways but nothing happens yet ..

I'm sure they are not damaged because it had special care not to connect the other way around

any ideas?

any ideas?

My tips/information are absolutely valid for original Pololu's.
Besides of Pololu's "original" drv8825 driver boards there are meanwhile a lot of other flavours - many different clones on the market.

They (hopefully) come with original TI drv8825 chips, but the board design is not always identical with Pololu's driver boards. Pololu's board has two measure points:

  1. a via close to the chip
  2. mid pin of the trim potentiometer / normally same as the metal screw of the trimmer itself.

Some of the clones have exactly the same measure point(s) as the original boards, some of them come with only the via point directly connected to the chip's measure point, unfortunately some have no easily accessible measure point "on board" at all - these are the most critical ones.

Having those critical ones the only chance is to identify the TI chip's pin (see TI's datasheet) and very very very cautiously use a small wire fixed at the probe and measure the voltage at the chip directly (pins 12 or 13 in the attached schematic).

Warning: this is very dangerous as you can easily short two neighboured pins (11 or 14) and potentially destroy the sensitive chip.

My favourite solution:
I happened to get some of these clones with the "critical" issue, although I thought I had bought an "industrial" clone type, when Pololu's weren't available in the desired time frame in my country. As I need 10-20 drv8825 per month I have built a test configuration with an Arduino nano, drv8825 and a stepper. I power the test configuration with a laboratory power supply.

The reference is my original Pololu drv8825 with adjusted voltage for my project. When driving the stepper at a given speed I notified the current, delivered by my lab power supply and this is my "reference current" (note: this value is NOT the current running through the stepper coils - it's much lower!). When adjusting a drv8825 with the "critical" issue, I set the trimmer to the lowest current point, then start the arduino sketch, the stepper begins to turn and I adjust the drv8825 by trimming it until the lab power supply current is equal to the reference current level of the Pololu's drv8825.

thanks for answering...

these are definitely the critics one because as I said, in the potentiometer the reading is 0, in the via the reading is the voltage of the source..

had read something about the pins 12 and 13 but could not read anything, now tried again and at one point there is a reading of 0,512V.. but changes to 0 again when I turn the potentiometer to either side

It also seems a bit critical as you don't have a permanent and good connection to the pins when measuring; but as you can see in the schematics of the board, pins 12 and 13 should normally be connected.

Problem is, that this schematics is only 100% true to original Pololus. Clones might be different.

well.. guess what? i got it! the solution is NEVER measure vref with the driver connected in the shield...

i made the "Minimal wiring to get a DRV8825 run" in a protoboard, touch the top of the potentiometer and magically the read isn't 0, and when i turn to either side it change gradually, it seems to work well.

remember, DON'T measure vref with the driver connected in the shield, do it in a protoboard, at least work for me..

thanks very much rpt007, you've been very helpful.. I hope this comment helps others also :slight_smile:

@nanofede:

Thank you very much for your observation and feedback!
You deserve a BIG Karma point for that!

I edited my very first post already and referred to your findings. Clones are sometimes very strangely designed, so some of them act like this, some act like that - to be on the safe side, I follow your recommendation to NOT connect a motor in the "adjust current" phase of setting up the driver (at least for the drv8825).

I don't have A4988 clones, so I can't say if this also applies to their clones. But - if somebody runs into the same issue not finding any Vref-level on the MM, disconnecting the motor should help then (Attention: power OFF first before disconnecting or connecting a motor).

Update for ORIGINAL Pololu's A4988 (since January 2017):

As Pololu changed their A4988 boards in January 2017, the Vref-adjustment formula changes accordingly:

RCS is the current sense resistance; original versions of this board used 0.050 Ω current sense resistors, but we switched to using 0.068 Ω current sense resistors in January 2017, which makes more of the adjustment potentiometer’s range useful.

The formula for Vref = 8 * Imax * Rcs
is still the same, but the values change due to the change of the current sense resistors (Rcs).

Example for calculation of Vref:
Let's say you want to limit the current to 1A per coil, then

  1. OLD board with Rcs = 0.5 Ohm -> Vref = 0.40 V
  2. NEW board with Rcs = 0.68 Ohm -> Vref = 0.544 V

If you have the old or new board, this can be determined by the following picture:
Pololu - A4988 Stepper Motor Driver Carrier.jpg
The updated information can be found on Pololu's website

Concerning the point "For the microstep modes to function correctly, the current limit must be set low enough (see below) so that current limiting gets engaged" reported in the Pololu drv8825 datasheet, do you know the maximum allowed current for a given microstep setting?
Thank you

Sorry for the late answer but I was absent over the past months due to some health issues.

Concerning the point "For the microstep modes to function correctly, the current limit must be set low enough (see below) so that current limiting gets engaged" reported in the Pololu drv8825 datasheet, do you know the maximum allowed current for a given microstep setting?

What Pololu wants to express is that you have to be careful about the maximum current you are setting - if you are going with full step only, you can set the current limit as high as the datasheet of the motor tells you.

BUT:
If you want to go with microstepping - regardless of the microstepping as such (so the settings for the current limit are always the same - from 1/2 to 1/32 microstepping), you MUST only set the limit to 70% of the full step mode!!

Here is what they (Pololu) say few lines lower on the same page which you are referring to:

One way to set the current limit is to put the driver into full-step mode and to measure the current running through a single motor coil without clocking the STEP input. The measured current will be 0.7 times the current limit (since both coils are always on and limited to approximately 70% of the current limit setting in full-step mode).

If your application allows, just limit the current 15-20% (or more) lower than the datasheet of the motor says. All your related electronic devices will thank you for their extended lifetime.

Hope that answers your question in case it is still relevant after such a long time.

No, the rated current of a stepper is what you set the driver to, irrespective of mode. I think
you misunderstand microstepping drivers.