# Help Needed in Code to reduce heat in Stepper Motor

Hi all,

Sorry if the question looks stupid…

With my current sketch, my stepper motor generates lot of heat as the two coils are kept charged in standby mode…

My sketch does a clockwise movement for a HIGH signal and anticlockwise movement for LOW signal

But in standby mode (when nothing is clicked) step motor gets heated a lot. In short in standby mode two coils in the motor is charged. Is there a way to reduce it with my code.

#include <Stepper.h> //including stepper motor library
#include <EEPROM.h>
//defining pins section

int stepIN1Pin = 2;
int stepIN2Pin = 3;
int stepIN3Pin = 4;
int stepIN4Pin = 5;
int stepsPerRevolution = 4096; // amount of steps per revolution

const int button1Pin = 8;

Stepper myStepper(stepsPerRevolution, stepIN1Pin, stepIN3Pin, stepIN2Pin, stepIN4Pin);

void setup() {
// Set up the pushbutton pins to be an input:
pinMode(button1Pin, INPUT);
myStepper.setSpeed(5);
}

void loop() {

// A == B means "EQUIVALENT". This is true if both sides are the same.
// A && B means "AND". This is true if both sides are true.
// A || B means "OR". This is true if either side is true.
// !A means "NOT". This makes anything after it the opposite (true or false).

//This section layouts the button scheme one button is clockwise rotation, the other counter clockwise rotation

if(button1State == LOW)
if (Dooropen == 1){
myStepper.step(stepsPerRevolution/4);
EEPROM.write(255,2);}
if(button1State == HIGH)
if(Dooropen == 2){
myStepper.step(-stepsPerRevolution/4);
EEPROM.write(255,1);}
}

What stepper motor driver are you using? Most specialized stepper driver have an enable pin that can be used to depower the motor.

However when you depower a stepper motor you risk losing position including the possibility of a spurious extra step when power is restored.

It is normal for stepper motors to run very hot - uncomfortable to touch.

As Robin2 already said - post the specs/types of your devices (driver and motor). Depending on the driver you are using it might come with an Enable pin to depower the motor.

If you e.g. use a DRV8825 or A4988, those come with enable and sleep pins. But if your stepper needs a bit of torque when it stands still, this is no solution for you. The only workaround then would be to reduce the current to a lower value level so that your application still is running, but with reduced current/torque and thus by lowering the stepper's temperature.

Unfortunately the above mentioned drivers have no automatic or controlled power reduction feature. But, if you use one of those drivers, they could 1:1 be replaced by a Trinamics silent stepper driver. This driver automatically can detect a standstill and reduces the current flowing through the coils by 2/3 after 3-4 sec and thus reducing the heat dissipation to ca. 1/3*1/3 = 1/9 of its previous value.

If you have the luxury of programming the current with an analog voltage under software control
you can simply reduce the current when the motor is stationary, which can really help. The common
DRV8825 and A4988 breakout boards only have a preset-pot for controlling the current, so they are not
suitable for this, but the chips themselves support dynamically changing the programmed current.

Powering down the chip completely can cause the motor to skip as there is no longer any holding
torque (reducing the current to 50% is pretty safe from this and reduces power dissipation by a
factor of 4).

Look around for stepper chips that already have power saving built in - some detect a lack of steps
for a certain time and automatically drop power until the next step pulse.

I'm using a basic stepper motor (5V) which is 28BYJ-48 with driver ULN2003A. I dint find an enable pin for this driver. is there any option??

I would actually need initial torque as this motor is going to pull up/ pull down a 1KG board as a door.

Is there a particular driver i can try that automatically adjusts the current ??

Thanks

Gokz

I'm using a basic stepper motor (5V) which is 28BYJ-48 with driver ULN2003A

Ooh ooh. That motor is a unipolar stepper on the cheapest price level. I don't say it's not ok, but compared to "professional" stepper motors it's a bit of a toy. But when it solves your requirements, why not.

Is there a particular driver i can try that automatically adjusts the current ??

Afaik, you would need to do the following: 1. convert the stepper from unipolar to bipolar, look at this link 2. then it is ready to be controlled by A4988 / DRV8825 or by a Trinamic TMC2100 which are bipolar stepper drivers and you could adjust/reduce the current to a level which is at least required by your application = delivers just enough torque and not more than needed - this will require you use a multimeter!

The A4988 / DRV8825 can be tuned to deliver the least required current, but as I have already posted in my first reply they don't reduce automatically the current when the motor stands still. That's why I recommended the Trinamic silent stepper (=TMC2100) which is able to reduce the current down to 1/3 automatically.

But pls pay attention: all 3 drivers don't ADJUST the "normal operating" current (by themselves)! You will have to adjust the current manually yourself. After that setting the TMC2100 will then automatically reduce the stand still current.

Thank you rpt007

I will try for the same and post back.

Cheers,

Gokz

does setSpeed(0) lock the motor (current on) or does it allow free spin (no current=no power=no heat)?

This stalls the stepper with full current on.

Wonder if you could high side switch the 5V supply to the motor with a P channel logic level mosfet like NDP6020P and 2N2222 for level inversion and PWM down to a current level just high enough to hold the load when the motor was commanded to zero speed?

captnKrunch: does setSpeed(0) lock the motor (current on) or does it allow free spin (no current=no power=no heat)?

Don't double Post.