0
\$\begingroup\$

I've been using a 28BYJ-48 5V stepper motor in a little project for a pan-tilt camera system, where the stepper is the pan motor. I'm powering it with 6 AAA NiMH batteries in series so it's about ~7.5-8V supplied. I'm using an Arduino Pro Micro (ATMega32u4).

I've noticed that upon startup (where I am turning on the pins on the microcontroller and buffered via a ULN2003 IC), the stepper motor refuses to turn. After about a minute, the stepper will start move in small jerks in the direction I am telling it to move and then by the 2 minute mark, it will be turning smoothly as it should be.

Are there any interesting points about steppers that I do not know about regarding startup issues? Have any of you seen this before? (Sorry in advance, I understand this is extremely vague and too many variables, but I'm not sure if it's a common issue because I don't work with motors usually)

I've been wondering if it has to do with the extremely poor ventilation around the stepper because I pack a bunch of other wires around it and the bottom of the stepper is hot-glued to a base (instead of using the mounting flanges). Or perhaps the wires around it are adding to some overall magnetic flux imbalance (seems unlikely as they are mostly low-current signal wires, not power wires, and nothing is more than 1A draw in the system).

\$\endgroup\$
  • \$\begingroup\$ Stepper motors need proper acceleration/deceleration profiles in order to startup and run smoothly. Do you have these? \$\endgroup\$ – Eugene Sh. Jul 31 '18 at 17:29
  • \$\begingroup\$ Ah, that's very interesting. I just quickly glanced over a TI whitepaper. It seems to me that this refers to the inertia of the motor load. Does that apply to every time the motor shaft is moved or just in the very beginning? What I see is that it's only for the first 2 minutes of when I turn on the battery pack, but after the 2 minutes, even if the stepper is left in a single position for a few minutes, it can run smoothly upon application of a new set of commands. \$\endgroup\$ – lemonlime Jul 31 '18 at 17:34
  • \$\begingroup\$ If you just start giving it steps in somewhat high rate, the stopped shaft is just not able to keep up with these. The reason it is able to start sometimes is a difference in starting position or some mechanical impact or vibration that can help kick-starting it. \$\endgroup\$ – Eugene Sh. Jul 31 '18 at 17:37
  • \$\begingroup\$ I have spent quite some time on this recently. Accel/decel profiles are indeed the way to get the motor up to a high rate. But first see if this is your problem - try the motor at a lowish speed (something in the tens to hundreds of Hz) and see if you still have the issue. Also : is the motor mechanically loaded? And check the power supply at the device. Are you using a stepper driver IC or module? they are so cheap it is hardly worth not doing so. (I just realised that I really don't have space here and also I want to post a link so I will post an "answer"). \$\endgroup\$ – dmb Jul 31 '18 at 17:59
  • \$\begingroup\$ Unless you have some kind of sticky grease that isn't fluid until the coils have warmed the motor, this sounds like an issue with your driver IC or even power source, not the motor. The time scales are far long than those of an acceleration profile. \$\endgroup\$ – Chris Stratton Jul 31 '18 at 20:14
0
\$\begingroup\$

There is no startup time. There is inertia in the rotor but for your application this is negligible. I suspect there is an electrical or signal problem.

Have you looked at the output signals to the motor with a scope or logic analyzer? You may not be outputting what you think you are.

\$\endgroup\$
  • \$\begingroup\$ I have not tried yet, but I will. But just in terms of microcontroller code, I send the same output signals over and over again and then after a minute or 2, then the motor begins to respond jerkily until it begins running smoothly. \$\endgroup\$ – lemonlime Jul 31 '18 at 17:37
  • 1
    \$\begingroup\$ It is really not negligible. \$\endgroup\$ – Eugene Sh. Jul 31 '18 at 17:38
  • \$\begingroup\$ But since as you say there is no startup time besides the acceleration of the inertia, then it must be in the electrical domain and likely how I am sending stepping commands, as Eugene Sh. says \$\endgroup\$ – lemonlime Jul 31 '18 at 17:39
  • \$\begingroup\$ Pink, Orange, Yellow, and Blue should be tied to the output of the ULN2003 while red should be tied to ground. The outputs of the micro should be low on startup and when you want the motor to be off. Leaving the proper output on will keep the rotor locked to that position but for a small pancake stepper this is not an always used feature. Don't worry about the acceleration profile, its not needed for small motor operation. For larger stepper it is important. What is important is the frequency and duty cycle. Are you sure you are outputting 100hz as specified by the datasheet? \$\endgroup\$ – the_anomaly Jul 31 '18 at 17:39
  • \$\begingroup\$ Ah, I haven't been controlling the frequency of the steps, and simply just running the code as fast as the microcontroller can. Question though: the frequency of the code commands probably stays the same, so why does it take approximately the same amount of time every time I start the system? I've tried manually turning the shaft by hand to help it move in the startup, but it still takes a couple minutes to start moving smoothly. So why is the too-fast frequency in the beginning okay for the motor after a minute or 2? \$\endgroup\$ – lemonlime Jul 31 '18 at 17:48
0
\$\begingroup\$

I found this article to be extremely helpful for creating an acceleration profile. Although I don't need to (and most likely nor do you) generate the acceleration profile in real time, the equation (3) for acceleration can easily be derived, which is instructive, and equation (8) can be used to create a static constant C array (for example) (I did it with a python script) which defines the profile. What I then did was write a state machine running from the ISR which ramps up through the profile a given number of steps, then runs at some maximum speed for however many steps, and finally ramps down. In my case the "target" number of steps is known in advance and the "recipe" is calculated before the move starts, which keeps the ISR as light as possible.

I found it far easier to use a dedicated stepper driver IC (which has DIRECTION and PULSE signals) than to generate the individual signals. You can then generate signals for a number of motors easily enough in one ISR which runs at some (high w.r.t. the maxiumum drive frequency) rate. Each motor has its own accumulator, you add a number representing the speed each timer tick, and roll over on some maximum fixed value. Each time you roll over, you generate a rising or falling edge in your state machine. You can also (if you wish) scale the motors against each other by using different maximum values. One every rising edge you inc/dec a counter to keep track of position.

The result is motors that start smoothly and accelerate nicely to pretty high rates. A word to the wise : if you care about absolute positioning you need to thoroughly test your code for missed pulses, and so on. Very easy to mess this up!

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.