SLEEP/RESET problem on DRV8825 Stepper controller

Hi,

i connected SLEEP and RESET to digital Arduino output pins in to be able to switch the power state of the driver. it works so far, but at the moment of switching on, my stepper motor makes a very short movement, although there is no STEP information sent to the driver. it happens with different motors. what cane i do to prevent this behavior?

thanks a lot!

Hello.

Can you tell me more about your setup? Are you connecting both SLP and RST to a single pin on your microcontroller or separate pins? I am not entirely sure what you mean when you say “moment of switching on”. Are you supplying power to all of your electronics at once? Is everything already powered, but the SLP and/or RST pins are being toggled? Are the SLP and RST lines pulled low and then high again in the middle of your test? Also, are you microstepping?

-Jon

hi Jon,

i have the SLP-pin on a digital pin (35) on the arduino and the RST directly on a 5V output (not switched, always on). at the moment i switch pin35 high, my stepper motor does a short movement. everything is powered, only the SLP pin is toggled. yes, i am microstepping, M1 and M2 are pulled high, M0 is unconnected…

thanks!

[quote=“JonathanKosh”]Hello.

Can you tell me more about your setup? Are you connecting both SLP and RST to a single pin on your microcontroller or separate pins? I am not entirely sure what you mean when you say “moment of switching on”. Are you supplying power to all of your electronics at once? Is everything already powered, but the SLP and/or RST pins are being toggled? Are the SLP and RST lines pulled low and then high again in the middle of your test? Also, are you microstepping?

-Jon[/quote]

That behavior seems normal when energizing and de-energizing stepper motors with drivers like those. What kind of application are you using these stepper motor drivers for that you need to avoid jitter while toggling the SLP pin like that?

-Jon

it is a new kind of machine, i cannot tell the details at the moment.
what i need to do is powering on the driver but NOT moving the motor to get a holding torque. and that should happen smoothly without jitter. the motor is directly connected to a moving part with a timing belt. there is not a lot of mechanical resistance, because there is no rotating spindle or a gear. do you have any further idea? is it possible to “smooth” enable the driver somehow? does it make a difference, if i e.g. do not pull the RST pin always high, but also put it on a low pin and pull it high after pulling the SLP pin high?

[quote=“JonathanKosh”]That behavior seems normal when energizing and de-energizing stepper motors with drivers like those. What kind of application are you using these stepper motor drivers for that you need to avoid jitter while toggling the SLP pin like that?

-Jon[/quote]

ok, i researched a little bit and found out, as you certainly know, that it is technical need of the driver to set the stepper into the microstep home position. i tried to play around with the EN, SLP and RST pins - switching them in different orders, because i thought, maybe it is possible to let the driver find its him position and afterwards let go power through the h-bridges, but there always is a short jitter after setting the last of the three pins high.

so i have an other idea: is this homing-jitter only in micro stepping-mode? maybe it would be a solution to power up in full step mode and afterwards dynamically switch to micro step mode?

other idea: setting the motor power low with a relays before switching the driver high, and then powering up the motor.

do you think, one of those possibilities would work? or is it destructive for the driver? or simply not a good idea?

maybe i should describe my needs once more:

one job on my machine normally needs e.g. 2 minutes, and there can be breaks of several minutes before a user starts a new job. i want to power down the driver when there is no job done - to save energy and avoid heating. the machine itself is still powered on and the user can do e.g. settings on a display.

what is happening is the following: one job is done, machine stays on, driver goes down. but if you start the next job a few seconds later, the job starts with that jitter every time. i also thought about a timer that keeps the driver on for e.g. 1 minute. the advantage would be, that there is no jitter when the user does one job after the other. but the problem is, that it will happen that the machine suddenly looses the holding position after one minute without the influence of the user.

I tried toggling the SLP pin of a DRV8825 here both in full step mode and while microstepping, and got about the same amount of jitter. I do not expect turning the motor supply on and off to work, either. The DRV8825 does not have a separate logic and motor supply, so the chip would not be powered on to receive your logic commands until you supply power to VMOT.

As for your application, I am not entirely sure how the jitter affects the user before they start using the machine, but maybe it would help to include a start-up routine that runs after the user gets to the machine, but before the user starts actually using it.

-Jon

Hi Jon,

it would be no problem for my machine to have one jitter at the very first startup. the problem is, that the machine stays on, only the motor power should be going down and after re-connecting there should be no jitter. sometimes the interval doing a job with the machine would be quite short, e.g. 2minutes usage-one 1/2 minute pause, then used again. in that case it would be easy to implement a timer which holds the power for 1/2 a minute (and certainly have no jitter at the next beginning of a job). but if the interval is longer, i need to power down the motor (not the whole machine). in that case, unequal to the “very first startup”, it is not acceptable having a jitter, because the user should not have the feeling of a complete restart of the machine, where a jitter would be acceptable. i can also imagine having a sleep mode of my machine after e.g. one hour of not using, in that case a jitter at beginning also would be ok, but not at a usage interval of e.g. 2 min. on, 1min. off.

i did some tests with the EN - pin. first it was quite promising, because in that case the driver holds its stored micro step position. but it only works as long as no manual force is affected to the motor. unfortunately my motor has not a lot of frictional resistance, but a weight of about 1 lb. i made some experiments and i would say, as long as the motor gets 0.8 A, its force is big enough not to lose a step.

therefore i thought about another solution: i want to go in a lower-power mode!

i thought about two different approaches:

  1. two pc of the driver, one driven with 1.7A output and the other one with 0.8, both connected to the same stepper motor and switched an and off vice versa. but i am afraid it would’t work because of the voltage going bad from the coils to the driver wich is in sleep-position. a general question concerning that topic:

when the driver is off, is it protected against voltage coming from the coils? because that also can happen when the motor is moved manually and the driver AND the overall power is switched of…
and the same question for the case that the driver is on, but the EN-pin is set high? what will happen, if there comes power from the coils?

[EDIT:]Ok, i realized, that this is not a good solution, because the additional driver is not in sync deprnding the microsteps with the first one… But still the question about the voltage on the coils is interesting for me…
[end of EDIT]

2nd approach:

i de-solder the potentiometer of my driver and provide an extern reverence-voltage coming from my micro controller. don’t you think that would be an elegant solution for getting a low-power state?

[quote=“JonathanKosh”]I tried toggling the SLP pin of a DRV8825 here both in full step mode and while microstepping, and got about the same amount of jitter. I do not expect turning the motor supply on and off to work, either. The DRV8825 does not have a separate logic and motor supply, so the chip would not be powered on to receive your logic commands until you supply power to VMOT.

As for your application, I am not entirely sure how the jitter affects the user before they start using the machine, but maybe it would help to include a start-up routine that runs after the user gets to the machine, but before the user starts actually using it.

-Jon[/quote]

Adjusting the current limit with your program to achieve a low power state does seem like a good way to solve the issue. We have discussed connecting a digital pot to the AVREF pin on the DRV8825 with another forum member, and we have been keeping this kind of feature in mind. It is good to know you would also benefit from such a feature.

-Jon

thanks, i read the linked thread, and i think thats exactly meeting my topic. do you know if somebody did one of these two solutions already?

for the first solution in the linked thread - the one with the different pull down resistors - can you explain, how you would solder/desolder the parts? is the idea to cut the connection between the output of the poti and solder the pulldown in between? isn’t that hard to solder? (sorry, i am a beginner in electronics…)

one question for the other way, with the digital poti: does the digital poti need a RC filter or is there also a version which can convert pwm signals AND work as a digital poti at the same time?

if there is a RC filter and buffer necessary, could you please be so kind and help me finding the right components for that? as i mentioned, i am new to that topic, but i am willing to learn;-)

i think, having the possibility to set different power levels to the stepper motor must be a great step forward for MANY users - at least having the possibility to set one second level in order to have a “holding mode” for the stepper motor. can you imagine that pololu could sell a new version of a stepper driver containing this feature? or maybe a small additional pcb?

[quote=“JonathanKosh”]Adjusting the current limit with your program to achieve a low power state does seem like a good way to solve the issue. We have discussed connecting a digital pot to the AVREF pin on the DRV8825 with another forum member, and we have been keeping this kind of feature in mind. It is good to know you would also benefit from such a feature.

-Jon[/quote]

Hi.

If you want to use a resistor network to select between a few current limits, you should not remove the potentiometer. Instead, you should set it to a value that corresponds to the maximum current limit you want to use. To connect the extra resistors in your network you would probably need a MOSFET that is controlled by the I/O pins of a microcontroller between the VREF node and each resistor. the physical connections to the VREF node could be made by soldering a wire to the VREF via and then connecting from that to the top of each MOSFET.

If you want to use hardware PWM, an RC filter would be necessary, but if you want to use a digital potentiometer instead, you should not need the RC filter. I am not very familiar with digital potentiometers, but I am not aware of one that takes PWM inputs.

-Claire

Finally i decided to the current limitation with a pwm-based and rc-filtered voltage control. can you tell me exactly where to put the signal pin? i destroyed one drive just by measuring the values on the poti-pins and i don’t want to destroy the next one, too;-)

what do you think would be good values for a rc-filter? i have got a 488 or 977 Hz 5V pwm signal. Is it a good idea to build the RC filter with a 1uF capacitor and a 15 K Ohms Resistor?

You should connect your current limiting signal in place of the wiper of the potentiometer. The wiper connects to the pad on the inner side of the potentiometer (the side closer to the VREF via). It is the bottom pad connected to the potentiometer in this picture:

As for the RC filter, I have not tried controlling the reference voltage on that driver like that myself, so I am not sure what filter values would be best. The values you chose might work. If you try it, I would be interested to hear how it goes.

-Claire

Hi Claire,

Finally i got it working. I made a RC filter with a 11kOhm Resistor and a 22uF Capacitor.
During the movement of my stepper everything works fine. When i apply my voltage, the stepper dose its job at the desired amount of mA. When i disconnect the voltage the stepper makes very poor and weak movements, i guess that behavior is also ok. But what makes me wondering is the following:

when i stop my inner loop, where the step-function of my motor stands, and go back to the main loop, the stepper stops at high force. the funny thing is, that the same behavior also happens without the voltage given on the poti-pin. and one more interesting thing: at this state the driver ic on the drv8825 doesn’t get hot, although there is a high force on the coils. that makes me believe, that the driver is switched off at this stadium, and only the voltage goes through the coils. do you know this behavior? what can be the reason for that?

What do you mean by disconnecting the voltage? When controlling VREF with an external signal, you should always be supplying some signal. In your case, if you were to stop sending a PWM signal the VREF input might float, making the current limit unpredictable.

I am not sure what you mean by “the stepper stops at high force”, but in general, if you stop supplying a step signal to the stepper motor driver, the motor will stop immediately; it won’t take anymore steps. However, when no step signal is applied the motor will still hold its position. If you have the current limit set to a low value, it might not be able to provide enough current to your motor, and that would cause the motor to jitter or miss steps. When a low current limit is set, I would also expect the driver to run cooler, though it will still try to hold its position when not stepping.

-Claire

hi claire,

thanks for your answer.
i am afraid, my case a little heavier;-):

i know, that the stepper should run cooler when less current is supplied. the problem is a different one:

i now know that the pwm signal is soldered on the right pad of the desolders poti-pin, and providing different voltages via different pwm-values has the right effect on my stepper, but not always. i want to give you an example:

i am able to run a program on my uController that just holds the stepper in position without moving. when i change the pwm value in my program, the holding force of the driver and the stepper changes like i want it to.

the same right behavior if i let the stepper run at a certain speed: if i just change the pwm value, the stepper still works, and also with the desired change of force.

but now to the case that doesn’t work:

if i let the stepper run a certain time and then stop and let it hold on a certain position (that means i just stop sending step-signals to the driver and keep the rest of the program like it is), the driver shows a very strange behavior:

it holds the motor in position, but on very high force, even if the pwm-signal is set very low. and the driver does not get hot, although the force is at a very high level!

it does not seem to be a programming mistake, because if i leave the program as it is and just disconnect the slp-wire manually and connect it again, the driver behaves like it should, because it goes to the desired holding-state with the amount of current given by the pwm-signal. so the problem is, that at the moment i don’t know how to get the driver from running-state into holding-state without resting it. i know, that normally, when the poti is soldered and the whole driver is like you ship it, it shows the right behavior in that way that it changes between running and holding just by providing steps or not providing steps. but i have no explanation why the driver behaves differently when the ref-voltages comes from an external signal instead of the poti??

maybe it helps if i post a small sample sketch:

int SleepPin = 35;
int Poti_M1 = 13;//thats the pin for the PWM signal on the desolderd potentiometer of the pololu stepper driver
int toggle= 1;


int StepPinM1 = 12;//goes to the STEP PIN of the Pololu stepper driver
boolean toggleM1 = false;

static long timer_1 = 0; 
static long timer_2 = 0;
static unsigned long lastMicros = 0;
#define TIMER_INTERVAL_1 5000000

#define TIMER_INTERVAL_2 100


void setup(){
  timer_1 = TIMER_INTERVAL_1;
  timer_2 = TIMER_INTERVAL_2; 
 
  digitalWrite(SleepPin, HIGH);
  digitalWrite(12, HIGH);
  analogWrite(Poti_M1, 3);

 lastMicros = micros(); // do this last in setup  
}



void loop(){
  
 
 // set millisTick at the top of each loop if and only if millis() has changed
  unsigned long deltaMicros = 0; // clear last result
  unsigned long thisMicros = micros(); 
  // do this just once to prevent getting different answers from multiple calls to   millis()
  if (thisMicros != lastMicros) {
  // we have ticked over
  // calculate how many millis have gone past
  deltaMicros = thisMicros-lastMicros; // note this works even if millis() has rolled over back to 0
  lastMicros = thisMicros;
}   



timer_1 -= deltaMicros;
  if (timer_1 <= 0) {
    // reset timer since this is a repeating timer
    timer_1 += TIMER_INTERVAL_1; // note this prevents the delay accumulating if we miss a mS or two 
    // if we want exactly 1000 delay to next time even if this one was late then just use timeOut = 1000;

    // do time out stuff here
  toggle=0; 
   
  }

if (toggle==1)
{
  
  timer_2 -= deltaMicros;
    if (timer_2 <= 0) {
      // reset timer since this is a repeating timer
    timer_2 += TIMER_INTERVAL_2; // note this prevents the delay accumulating if we miss a mS or two 
    // if we want exactly 1000 delay to next time even if this one was late then just use timeOut = 1000;
      toggleM1 = !toggleM1;
    digitalWrite(StepPinM1, toggleM1); 
    }
  }
  
}

What do you mean by disconnecting the voltage? When controlling VREF with an external signal, you should always be supplying some signal. In your case, if you were to stop sending a PWM signal the VREF input might float, making the current limit unpredictable.

I am not sure what you mean by “the stepper stops at high force”, but in general, if you stop supplying a step signal to the stepper motor driver, the motor will stop immediately; it won’t take anymore steps. However, when no step signal is applied the motor will still hold its position. If you have the current limit set to a low value, it might not be able to provide enough current to your motor, and that would cause the motor to jitter or miss steps. When a low current limit is set, I would also expect the driver to run cooler, though it will still try to hold its position when not stepping.

-Claire[/quote]

That sounds like an unusual issue. Does it happen consistently every time you command the motor to stop stepping? How are you determining the differences in the stepper motor’s holding force? Do you have access to an oscilloscope? If so, could you look at the signal on the VREF node when the motor is behaving correctly and when it is in the unexpected high-force holding state?

-Claire