Stepper library fixup

The stepper library seems to have "hot" bug.
It steps nice but after finishing step() method some pins still have HIGH level!
It causes stepper motor HEATING! It can even burn out because always 2 coils are powered.

I modified this library in this way:

  • created private method stop:
void Stepper::_stop()
{
digitalWrite(motor_pin_1, LOW);
digitalWrite(motor_pin_2, LOW);
digitalWrite(motor_pin_3, LOW);
digitalWrite(motor_pin_4, LOW);
digitalWrite(motor_pin_5, LOW);
}
  • added it at the end of: void Stepper::step(int steps_to_move)

It is normal for stepper motors to be be very hot - uncomfortable to touch with a finger.

Stepper motors ALWAYS have coils powered. That is how they hold position. If you de-power the coils there is no guarantee that the motor will stay in position.

If your motors are being damaged it sounds like you are using a too-high voltage or you have not properly adjusted the current limit on your stepper driver board.

Post a link to the datasheet for your stepper motor.
Tell us what stepper driver you are using.
Tell us about your stepper power supply (volts and amps).

...R
Stepper Motor Basics
Simple Stepper Code

Good point! I forgot about holding positions.
I use common 28BYJ-48 5V.
It's not burned yet, but it heats a lot :).

In my case it don't need to hold position with powered coils, and no point to heat :).

So for exchange maybe just add public stop() method to release coils when no need to hold position - for example when device is in IDE/STANDBY state.

Of course always can control it with disable/enable Vcc, but some kind of stop() or release() would be nice :).