A4988 DRV8825 stepper motor driver Electronics

How to set VREF for DRV8825 and A4988 motor…

Over time I stumbled accross many social media posts of electronics, robotics and 3D printing hobbyists asking about how to adjust the small onboard potentiometers to set the correct current for their stepper motors. If you’re reading this and you’re one of them, this article will help you understand how to do it.

Disclaimer: this article has affiliated links. By clicking on any of the links and purchasing any items you will be helping Zero to Hero Engineering with a small fee without any additional cost to you.

DRV8825 and A4988 are stepper motor drivers that are widely used in 3D printers, small hobby CNC machines, robot arms and many other projects. These are some of the breakout boards that you should always have around. They’re super cheap, easy to use and very useful. Therefore, I always like to have two sets of 4 in my parts boxes so that I can fix my 3D printers in case they get damaged. In fact, now that I think about it, it never happened: 7 years of printing and still going.

Although DRV8825 and A4988 are the names of the chips used, most people buy them already soldered in small boards usually named “stepsticks” which are both pin-to-pin compatible and have the proper form factor to be connected to most of the 3D printer controller boards, such as the Ramps 1.4. In addition, both drivers are very cheap, the A4988 selling for as low as 0.55€ (0.62$) and the DRV8825 for 0.85€ (0.96$) on Aliexpress. I will not go into a full comparison between the two in this article since the scope is to teach you only what you need to know to set the V_{REF} without screwing up.

As mentioned, the stepstick boards for both drivers are pin-to-pin compatible but the V_{REF} is set differently for each one. I’ll explain you how to do it for each.

But first, what is VREF and why do you need to adjust it?

V_{REF} is a Voltage reference that corresponds to the maximum current that will flow to your stepper motors. You need to set it right for two main reasons:

  1. You don’t want excess current flowing into your stepper motors. They will overheat and eventually get damaged. Also, you get the best performance when you run your motors at their rated current.
  2. You don’t want to burn your drivers. They also have a current limitation and in case your motors can withstand a 2.5A current, these drivers will not survive long under that load.

A4988

A4988 stepper motor drivers
A4988 Stepper Motor Drivers with and without heatsink

These ones are the simplest and cheapest you can get and have a current limitation of about 1A per motor coil, which means 2A in total. However, this mostly depends on how cool you can keep the chip, either by using passive cooling (heatsink), active cooling (fan blowing air) or both (heatsink + fan)

To find out the reference voltage that corresponds to the maximum desired current, I_{max}, you have to use the following equation:

\Large V_{REF}=I_{max}.8.R_{s}

R_s is the current sense resistor and this is a small, but important, detail that you must look for in your A4988 stepstick boards. Since there used to be a few different versions of the board and there are a lot of chinese manufacturers, the R_s can have a few different values (usually \small 0.05\Omega, \small 0.1\Omega or \small 0.2\Omega). The first thing you should do is read the value on top of the resistors (a magnifier lens or phone camera with zoom may be helpful). In the photo below you can read R100, which means \small 0.1\Omega.

A4988 Current sense resistors
A4988 with R_s positions marked in green

Once you know that, you can replace the R_s and I_{max} values in the equation and get your desired V_{REF} .

If you want to be safe you can also take 10% out of the calculated V_{REF} . value as a precaution.

DRV8825

DRV8825
DRV8825 Stepper Motor Drivers with and without heatsink

These ones cost a little more but are still dirt cheap. Since these drivers support higher microstepping, motors can run much smoother and with less noise. In terms of current, they can handle about 2.2A per coil, which is more than double of what the A4988 can do. Once more, running these drivers at their maximum current will require you to cooldown the chip either passively, actively or both.

To find out the reference voltage that corresponds to the maximum desired current, I_{max}, you have to use the following equation:

\Large V_{REF}=\frac{I_{max}}{2}

Once more, if you want to be safe you can also take 10% out of the calculated V_{REF} . value as a precaution.

Adjusting the potentiometers

To adjust the potentiometers you will need a 3D Printer / CNC board to plug the drivers (e.g. Ramps 1.4 + Arduino Mega), a small philips screwdriver, a multimeter and a couple of crocodile clips. Here are the steps:

  1. Plug the driver into the 3D printer board (beware the driver orientation, it is different for the A4988 and the DRV8825 stepsticks). If you’re using the Ramps board it is important that you also connect the Ramps board to the Arduino Mega. Otherwise, the driver pins will be floating and the drivers will be in an unstable mode;
ramps 1.6 a4988 drv8825
Ramps 1.6 with A4988 and DRV8825 stepper motor drivers. Notice the PCB orientations of each driver.
  1. Use one crocodile clip to connect the negative (black) probe of the multimeter to the GND of the 3D Printer board;
  2. Use another crocodile clip to connect the positive (red) probe of the multimeter to the screwdriver tip
  3. Set the multimeter to DC Voltage measurement;
VREF calibration setup A4988 DRV8825
Complete V_{REF} calibration setup
  1. Connect your 3D Printer board to the power supply and turn it on;
  2. Use the screwdriver to turn the potentiometer until you get the calculated voltage;
  3. Turn the power supply off, disconnect everything and it’s done!

Example

42BYGHW804 stepper motor drivers a4988 drv8825
42BYGHW804 Stepper motor and drivers

Let’s practice with an example. Let’s say we have two 42BYGHW804 stepper motors. First we must find out what is the rated current for these motors and to find that we have to search for them on Google. A search for “42BYGHW804” takes us to several sources which tell us that it has a rated current of 1.2A. Moreover, the same sources also tell us that it has an holding torque of 4.8Kg/cm, which is great for such a low current! Awesome!

Now we can proceed for the V_{REF} calculations. We’ll do it for both drivers, one for each motor.

For the A4988 we have to start by discovering the value of R_s , like mentioned above. After reading the symbols on top of the resistors we discover that R_s=0.1\Omega. Now we can use the equation to get V_{REF} :

V_{REF}=I_{max}.8.R_{s}=1.2\times8\times0.1=0.96V

a4988 VREF setting
Adjusting the V_{REF} setting for the A4988

For the DRV8825 we don’t need to measure anything and can go straight to the equation:

V_{REF}=\frac{I_{max}}{2}=\frac{1.2}{2}=0.6 V

Now that we have the V_{REF} for both drivers we can proceed to set everything up and adjust the potentiometers. If you want to play it safe, you can also take 10% of the calculated V_{REF} values.

And that’s it!

In conclusion, I hope I made it clear enough so that you can now feel confident to adjust your stepper drivers accordingly for all of your awesome projects. If you have any related questions feel free to leave them in the comments below.

Parts and equipment used in this article

Below you’ll find a list of parts and equipment used in this article. By buying something from the links below Zero to Hero Engineering will get a small comission at no extra cost for you. Those comissions will be invested in parts and equipment for new tutorials, projects and courses.

Mário Saleiro
PhD in Computer Vision and Robotics. MSc and BSc in Electronics Engineering. Entrepreneur. Digital Fabrication enthusiast.
2 COMMENTS
  • Jorge
    Reply

    Dear Mario, this is a nice post, but I have a doubt…

    I have a DRV8825 R250. The DRV8825 you use in the post is R100. Can I still use the Vref formula? Does the R value matter?

    Thanks for the feedback.

    1. Mário Saleiro
      Reply

      Hi Jorge. Thank you for your question. I wasn’t aware that there are manufacturers making DRV8825 modules with other resistor values. Anyway, if your drivers have a R250 resistor the formula changes a little bit. If you look at page 12 of the datasheet of the DRV8825 (https://www.ti.com/lit/ds/symlink/drv8825.pdf) you will see that the generic formula is I = VRef/(5xRsense). If you have R250 resistos in your driver, the formula becomes VRef = Ix5x0.25, or simply VRef=1.25xI.
      Hope this helps 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *