a4983 sleeping mode?

Hello,

I am trying to step rather slow steps with a Pololu a4983 driver, from 2 steps/second to 2 steps/hour. The slower I drive a stepper the hotter the driver gets. I guess sleep mode was added for this reason. However, there are so few people using that function that I couldn’t find any good examples on stepping well 1stp/second or slower.

When I try stepping using sleep mode in between, usually I only hear a sound in a stepper with no stepping happening.

For example, my code to step once per 5 seconds:

  for(j=0; j<=800; j++) {
    digitalWrite(stepPin, LOW);
    delayMicroseconds(2);
    digitalWrite(stepPin, HIGH);
    delay(5000);
  }

Works very well except the heat.

Trying to get a nap in between:

  for(j=0; j<=800; j++) {
    digitalWrite(stepPin, LOW);
    delayMicroseconds(2);
    digitalWrite(stepPin, HIGH);
    delay(1000); //testing if time is needed to make a step before going to sleep, didn't help 
    digitalWrite(sleepPin, LOW); //going to sleep
    delay(4000); //"alarm clock"
    digitalWrite(sleepPin, HIGH); //waking up 
    delay(2); //datasheet says a4983 needs 1ms for a morning exercise, gave it two, not working.  
  }

The heat issue is not so much of a problem, glued a large heat-sink. The problem is the stepper must work for at least 12 hours from a battery, letting a camera make beautiful pictures :slight_smile:

What could be wrong? Do you have a recommendation for sleeping during the pauses between steps?

Thanks in advance,
Paulius

Hello.

I think you should be using the enable pin, which leaves the internal control logic active but disables the motor outputs (so you won’t be wasting current through the stepper motor coils and the stepper motor will stay cool). Note that when the output FETs are off, the stepper motor will not have any holding torque beyond the its detent torque, so this approach will only work well if there is light to no torque on the motor shaft between steps.

I’m not completely sure why the sleep pin isn’t working for you, but sleeping does affect the internal control logic:

Are you using microstepping? If you’re curious, there are some tests you can try to get to the bottom of what is going on. You are able to successfully step the motor when sleep is not being used, you can try various combinations of stepping and sleeping. For example, write a program that takes five steps over five seconds, then pauses for five seconds, then repeats. Once you have this working, add sleeping during the five second gap between steps and see how that affects the behavior.

- Ben

Thank you Ben for the quick reply.

It works!

  for(j=0; j<=800; j++) {
                digitalWrite(enablePin, LOW);
             // digitalWrite(sleepPin, HIGH);
    delayMicroseconds(2);
    digitalWrite(stepPin, LOW);
    delayMicroseconds(2);
    digitalWrite(stepPin, HIGH);
    delay(500);
             // digitalWrite(sleepPin, LOW);
                digitalWrite(enablePin, HIGH);
    delay(2000);
}

However, if I uncomment the sleep lines and comment the enable (or leave as is), the motor sounds the same, clicking for turning off, ampermeter shows the same current draw (0.25A usually), but the stepper does not move, only clicks. Strange behavior.
Though since the current draw of disabled and sleeping modes seems to be roughly the same, disabling will be fine, thank you.

Paulius