Stepper motor whistle / noise after stop (in case you search this issue)

Hi,
when I was starting with arduino and stepper motors, I had an issue with noise / whistle from stepper motor, when he stopped.
I googled a solution, but did not find any.

In case you have this issue, I can recemend to use any stepper motor driver with sleep or enable pins, such as EasyDriver etc.

I simply connecten Enable pin to one of arduinos digital outputs and put HIGH level to it when motor is stopped. Before any command to EasyDriver i put LOW level to the pin.
Works very well.

#define STEPPER_PIN_sleep 8
void setup() {
..
digitalWrite(STEPPER_PIN_sleep, HIGH); //shut up the motor
}// setup
..
void some-function() {
digitalWrite(STEPPER_PIN_sleep, LOW); //wake up the driver
.. some code for the motor
digitalWrite(STEPPER_PIN_sleep, HIGH); //shut up the motor when function for motor spin is done
}// some-function

This noise happens when you use microstepping and the motor is stopped on a position differen than a fullstep. Keep in mind, if you disable the stepper it won’t hold its position any longer - this may be acceptable or it may ruin your day.

The noise is the constant current chopper circuit, it will happen at any position as the driver is always controlling the currents to both windings. Different chips will oscillate at different frequencies, some depend on the motor
inductance too. Check datasheets for stepper chips.