Hi guys,
I am currently making a device which requires a stepper motor to perform a full rotation every certain amount of time.
When testing the prototype I found that the stepper motor heats up when is at rest while the code runs counting down the time before the next rotation.
I am looking for some way for the motor to not be powered while the time passes and then being powered back up again when required.
At the moment while testing I am using the motor connected to the 5V Power on the Arduino UNO.
Fair warning: I'm no expert on coding.
This is what it looks like at the moment
#include <Stepper.h>
#define STEPS 2038
//In this code the stepper performs motion
//and repeats after the time delay has passed
int second;
int minute;
Stepper stepper(STEPS, 9, 11, 10, 12); //Stepper is connected from 9 to 12
void setup() {
second = 0; //reset any int values
minute = 0;
}
void loop() {
stepper.setSpeed (6); // sets the speed is in rpm
stepper.step(2038); //sets the number of steps to perform
while (minute < 5){ //while to serve as delay
delay(1000);
second = second+1;
minute = second/60;
} //endwhile
minute = 0;
second = 0;
}
Unfortunately, the Arduino stepper library does not contain any provisions for doing this. There have been some attempts to add this functionality to the library:
but none were accepted yet. You can look at the code of those pull requests and implement the functionality in your own code if you like.
The caveat is that when you power the stepper off there is nothing holding the shaft in the current position. So if there is torque on the shaft it will rotate some indeterminate amount. That said, it can be an extremely useful technique in the right application. In addition to allowing the motor to cool, it also avoids unnecessary power consumption (important for battery powered devices) and also shuts off that annoying whining noise!
First of all a stepper motor driver is required that controls the motor current. A high voltage is required for fast movement, but that voltage can be much too high in steady state, where it results in a multiple of the allowed current. Good stepper motor drivers do not only have means to limit the motor current during steps, but also have a Break input that reduces the motor current further while not stepping.
The most economic solution is a (self-locking) gear box, that allows to turn off the motor between moves. This applies to all kinds of motors, not only to steppers.
If your motor is getting hot, then you may be exceeding the stepper specifications.
Here is a very good Stepper Motors 101 from Adafruit. Cheap hobby steppers aren't meant to drive loads for a long time. They are expected to be installed in model aircraft and cars, and the battery capacity on those is usually under 30-minutes. So if your project has the stepper running for hours, you need a bigger stepper.
A stepper motor never "stops". Depending on the quality of the stepper, it may constantly hunt for the target position.
You can try to use a Mosfet transistor like the 2N7000 to remove the power to the motor. The gate of the 2n7000 can be connected through a 1K resistor to a GPIO pin of the Arduino. The 2N7000 is good to 200mA which should be adequate for most hobby stepper motors. If you need higher current, the IRFZ44 would work.
As stated above, when you remove power from a stepper motor, it is likely to move some while the power is off.
I am very concerned about the way you are powering this motor, if it is getting hot then it means it is pulling way too much current from the Arduino for the Arduino’s good.
However you could try using the pinMode call to make those output pins into inputs when going into the delay. And then using it again for making them outputs when the delay is over.
AHXV:
Hi guys,
I am currently making a device which requires a stepper motor to perform a full rotation every certain amount of time.
When testing the prototype I found that the stepper motor heats up when is at rest while the code runs counting down the time before the next rotation.
if you are looking at toy motors, you would not expect them to get hot. However, if you want to use an industrial device in a hobby application, then you need to know the working envelope.
A stepper should be hot enough that you would not be able to hold your hand on it for more than a minute.
it should not be so hot that you would actually burn yourself.
if you are not seeking any sort of performance, then you can drop your voltage down to nameplate and do away with any sort of drivers. since delivering power at nameplate does not require any sort of chopping circuitry it makes it a bit less on the parts count. however without a driver, you lose the ability of microstepping.
Moving back to your needs. the stepper is running, even while stopped. not moving, it is holding position.
If you shut off the power, then it will either move due to the load, or move to a natural step (equilibrium between magnets)
if you want to use battery power, I think you might want to use some other type of motor. a simple DC motor, with an encoder and some electronics (driver) turns into a Servo
a simple DC gear motor with a worm can run very high resolution.
Maybe the right question would be to start off with your device and seek the best motor for the application.
pert:
The caveat is that when you power the stepper off there is nothing holding the shaft in the current position. So if there is torque on the shaft it will rotate some indeterminate amount. That said, it can be an extremely useful technique in the right application. In addition to allowing the motor to cool, it also avoids unnecessary power consumption (important for battery powered devices) and also shuts off that annoying whining noise!
For the application there would not be any load that the unpowered motor couldn't hold. I've tried spinning it by hand and its much harder than I'd need.
The motor is a 28BYJ -48 5V With its correspondent driver.
Motor is connected to the driver which is connected to the 5V and GND on the UNO's board.
IN1, IN2, IN3, and IN4 are connected to pins 9, 10, 11, and 12, respectively.
I'll be checking the resources recommended by everyone here later today and see how it goes.
Thanks everyone!
I have a 28BYJ-48 stepper motor powered from a 5v source (not the Arduino) and even though it is active all the time it is stationary it does not get hot - just warm.
The ULN2003 that is used to drive a 28BYJ motor does not have an enable pin. People have been assuming you are using a bigger stepper motor.