Newbie problems with seeting stepper motors voltage ( RAMPS shield + DRV8825 )

Hello guys,

I am currently trying to learn how to control stepper motors with arduino (later i'll want to build a small cnc router).

The main trouble is with adjusting the drivers voltage.

I have the following setup : - arduino mega 2560 + RAMPS 1.4 shield + DRV8825 drivers - 3 stepper motors with the following specifications Step Angle 1.8° Step Accuracy 5% Holding Torque 59Ncm( Rated Current/phase 2.0A Phase Resistance 1.4ohms Voltage 2.8V Inductance 3.0mH±20%(1KHz)

  • using an ATX power supply for PC

What software would be recommended for these components? So far I have tried two different ways: [1] Repetier firmware flashed on arduino , with RepHost application on PC [2] GrblForCyclone firmware flashed on Arduino , with Easel application on PC .

Do you have any better suggestions about what software to use for my components ?

First of all : is it normal that the drivers voltage needs to be changed depending on which firmware that is flashed on the Arduino ?

When using Repetier firmware and RepHost application , I was able to find a setting where the X axis worked. The Y and Z axis not working at all.

But then I installed GrblForCyclone firmware . And the motors started to buzz immediately after powering up. I decreased the drivers voltage ; motors no longer buzzing . At some point the X axis worked.

But then, when going back to flash Repetier : none of the motors moved. I adjusted again the drivers voltage until I was able to make the X move again. But Y motor not moving at all. The Z axis moving only a little bit.

When trying to measure the voltage , I have : - 0.48V for X ( this is the motor that works) - 0.70V for Y (doesn't work. If I increase it , at some point it begins to vibrate and buzz). - 1.4V for Z (this is the motor that moves, but it moves less compared to the X . Maybe the Repetier software handles the Z differently.)

Shouldn't it be normal that the Y-axis driver behaves like X-axis if i set to the same 0.48V ? But for 0.48V it doesn't do anything.

Apparently it is possible to rotate forever in both directions. Is there any rule about when to stop rotating the knob clockwise and counterclockwise?

Frankly I don't really understand how to apply in practice the formula "Current Limit = VREF × 2" that is given on the polulu website .

Thanks, Adrian

Have a look at the background info in Stepper Motor Basics

It would be normal to power those motors with 24v or more (up to the limit of the DRV8825).

Note that the max current for the DRV8825 is not much more than the 2 amps required by your motors and the DRV8825 will probably be struggling unless you have heat sinks and a cooling fan. A driver that can manage 3 or 4 amps would be a better choice (but considerably more expensive).

As you already have the DRV 8825 you could start by setting its current limit to 1.5 amps. That will not give full torque from the motor but it should certainly get you started.

The power supply for the motors, and the current limit setting are quite independent of the software you use.

For adjusting the current limit, you need a multimeter to measure VRef. You then adjust the potentiometer until VRef reads (for example) 0.75 volts if you want the maximum current to be 1.5 amps. The motor does not need to be working when you are adjusting this setting.

I have no experience of off-the-shelf Arduino CNC software as I wrote my own program for my small lathe (being more interested in programming than lathe work :) )

You will probably get more advice about off-the-shelf Arduino CNC software on the RepRap Forum or one of the many CNC Forums. The Arduino Forum is primarily about helping you write your own programs.


Ah, ok, I am beginning to understand. So for 1.5A i should set to 0.75V. Later I could try to increase upto 2A which will require setting to 1V, right ?

It is great that you mentioned writing your own software, because this gave me the idea to search for information about how to program the RAMPS shield directly. Found some basic code :

void loop() {
  if (millis() %10000 <5000) {
    digitalWrite(X_DIR_PIN    , HIGH);    
    digitalWrite(Y_DIR_PIN    , HIGH);   
    digitalWrite(Z_DIR_PIN    , HIGH);
  else {
    digitalWrite(X_DIR_PIN    , LOW);
    digitalWrite(Y_DIR_PIN    , LOW);
    digitalWrite(Z_DIR_PIN    , LOW);
  digitalWrite(X_STEP_PIN    , HIGH);
  digitalWrite(Y_STEP_PIN    , HIGH);
  digitalWrite(Z_STEP_PIN    , HIGH);
  digitalWrite(X_STEP_PIN    , LOW);
  digitalWrite(Y_STEP_PIN    , LOW);
  digitalWrite(Z_STEP_PIN    , LOW);

It’s in fact easier to use this because the code moves the motors in endless loop (no need to click in an application each time when trying to test a motor).

I did some progress : the X and Y motors seem to work fine now , with voltage around 0.75V.
But still having trouble with the Z motor : no movement. Beginning to suspect that it could be a connection problem between the arduino and the shield .

Regarding the code above, if i want the motor to do more steps is this the right way to do ?

for (int step=0 ; step<50; step++) { 
  digitalWrite(X_STEP_PIN    , HIGH);
  delay(1); // what would be the effect of increasing this delay ?
  digitalWrite(X_STEP_PIN    , LOW);
  // delay(10);   is there any need to add delay between motor steps ? 

I am not sure about that delay(1), should I keep it unchanged ?
I mean : the motor will rotate exactly one step, no matter what is the delay ?


I think all you need to make a satisfactory pulse is

digitalWrite(stepPin, HIGH);
digitalWrite(stepPin, LOW);

because the digitalWrite() function is slow enough to give the required pulse length.

Have a look at the second example in this Simple Stepper Code which uses millis() for non-blocking timing. You will need that with multiple motors.

Once you can make a pulse all of the timing can be used for the interval between pulses.


Robin, thanks for your explanations.

It looks like my problem with the third motor is because of malfunctioning drivers : i have 2 drivers that work fine no matter in which socket of the RAMPS shield i put them. And 3 drivers that don't move the motors , regardless the socket and the vmax setting (in fact one of the drivers makes the motor buzz , but there is no rotation). The motors are ok because all three of them work with the good drivers ...

I'll order a new drv8825 and hopefully this would solve the z axis.


I'm trying to build this 3D printer:

I'm using a RAMPS 1.4 board, Arduino MEGA and the same DRV8825 drivers and I'm having some troubles with the Repetier.

Did the Repetier work for you? If it did, what configuration did you use to move your motors? I can't even move one of them.

shp96: Did the Repetier work for you? If it did, what configuration did you use to move your motors? I can't even move one of them.

You are more likely to get useful information on the RepRap Forum that specializes in 3 D printing. Or maybe there is a Repetier website.

This Arduino Forum is really for helping people write their own Arduino programs. Repetier is a complex ready-made program.