Go Down

Topic: Stopping stepper motor drift in low-power application (Read 230 times) previous topic - next topic

lmorris99

Yet Another Clock project: Using Arduino Pro Mini, a 28BYJ-4b geared stepper motor, a RTC clock chip, and an Easydriver board.

The clock keeps perfect time as long as I keep the Easydriver board powered up.  But that eats my batteries.

When I keep the Easydriver board powered down until (once a minute) I need to move the pointer, the clock starts losing time gradually - like, 2 minutes every 15.

I power down the Easydriver with a high-side MOSFET transistor, because disable mode on the Easydriver still uses too much current, and sleep mode still drifts (hmmm... I think....).
I'm careful to give the Easydriver board 100msec to wake up fully before I start to drive it.
I also wait 100msec after it's done before I power it down.
The more frequently I wake it up, the worse the drift gets.

It could be that when I power the board down, the stepper motor's magnets flip to the nearest comfortable detent.   But I'm using full-step mode, so wouldn't it always stop at a natural detent?  And even if it didn't,  wouldn't it randomly move a hair forward sometimes, and a hair backward other times, cancelling out the effect?

It could be that there's some mechanical tendency moving the mechanism while the stepper motor is asleep.  But it's a 64-1 gear ratio in the motor, physically hard to turn, and a reprap-type belt drive and gear which almost certainly has no slip.  And there's no weight or pressure tending to turn it one way or the other.

It could be that the mechanism has some inertia.  But I use the Accelstepper library to decelerate it.

So I'm stumped.  My next idea is to put a very long arm (like, a giant second hand) on the motor so I can actually see how the rotation differs when it stays powered up vs when it wakes up and moves.

Anybody have other thoughts? 

jremington

#1
Apr 08, 2017, 09:58 pm Last Edit: Apr 08, 2017, 10:13 pm by jremington
I don't have an explanation for the effect, but the Easydriver board is overkill for that stepper.

The vastly simpler ULN2003 drivers that typically come with those steppers (from eBay) are just transistor switches, use less power and don't need to be powered up to keep track of steps.

Furthermore with that driver you can use a "wave" step sequence (one coil active at a time) instead of the typical full step sequence with two coils active at the same time, so there is no confusion about which pole the armature will be pointing at between power up/down sequences.

Endian

I can see two problems with the design approach used:

1. In full step mode the motor steps the rotor to positions midway between the natural magnetic detent locations, thus when power is removed the motor may move forwards or backwards half a step. There is likely to be a "preferred" direction for this half step move due to the magnetic BH curve influence of the last step and mechanical lead/lag.

2. When the motor driver is powered up it goes into the reset "home-state" with a particular output phase. As a electrical phase cycle drive moves the motor 4 steps there is a low probability (1 in 4) that the motor will lock to the last commanded position. In this case, typically the motor will tend to move backwards towards the advancing electrical phase as 2 steps from the electrical drive phase there is zero torque point and so the motor "waits" for the electrical phase to advance. Using the "Sleep" pin also puts the motor driver into the "home state".  To maintain the correct phase you can use the "Enable" pin but maybe that does not save enough power?

lmorris99

#3
Apr 09, 2017, 04:00 pm Last Edit: Apr 09, 2017, 04:13 pm by lmorris99
Wow, Endian, that's really helpful! I was hoping there was some rational explanation. So, some solutions:
  • I could rig up a brake: a physical spring loaded thing that holds the motor in position while the driver board is sleeping.  It would have to be quite accurate though - doesn't feel like the right answer.
  • I could also add 2 steps (or 3, or 4) every time it wakes up.
  • I could use a rotary encoder to report the true position of the motor.  But wouldn't I have to leave that powered up all the time, too? Defeats the purpose.
  • This driver chip claims to be very low power and offers " valuable motor status feedback".  Do you think it (or some other low-power motor driver) would solve this problem?

Thanks very much for your insights.

bobcousins

But I use the Accelstepper library to decelerate it.
Could be a bug in AccelStepper?

Otherwise, controlling the motor phases directly might help, but I think there is still a risk of losing position. I don't think an encoder would help.

I think I would try to create an indexing position to synchronise with, for example a microswitch operated by a cam.

Please don't PM me asking for help. Ask questions in the forum.

lmorris99

Thanks, bob.
I don't think it can be a bug in accelstepper, because things work perfectly as long as the driver board stays powered up.
I do have limit switches, but the drift is quite noticeable before the limit switch is hit.

Endian, could I get the motor to stop exactly on a "natural magnetic detent" position? Perhaps by using a "wave step" sequence at the very end of the run?

bobcousins

Hmm, well I would be interested to know the root cause, because I had an idea to use a stepper motor for a clock project as well.

Adding a second hand or encoder for debug might help nail it down. To get a long baseline, attaching a small laser pointer projecting to a wall or surface can be used.
Please don't PM me asking for help. Ask questions in the forum.

lmorris99


Endian

Wow, Endian, that's really helpful! I was hoping there was some rational explanation. So, some solutions:
  • I could rig up a brake: a physical spring loaded thing that holds the motor in position while the driver board is sleeping.  It would have to be quite accurate though - doesn't feel like the right answer.
  • I could also add 2 steps (or 3, or 4) every time it wakes up.
  • I could use a rotary encoder to report the true position of the motor.  But wouldn't I have to leave that powered up all the time, too? Defeats the purpose.
  • This driver chip claims to be very low power and offers " valuable motor status feedback".  Do you think it (or some other low-power motor driver) would solve this problem?

Thanks very much for your insights.
You need a driver that you can power down and where you can control the start/power up step phase from the Arduino board.  The ULN2003 drivers mentioend earlier will give that level of control. If you use the "Wave drive" method then only on phase is on at a time and the motor will stay aligned to the magnetic detent postions so the motor will stay where it is when powered down.

lmorris99

SOLVED!
The Easydriver board uses the Allegro A3967 chip, which has an internal step table with four entries (for full-step mode anyway - half-step has 8, etc.), and always starts at step table entry #1 when powered up.

So if I make sure my gadget always moves in multiples of four steps before I power it down, it always powers up keeping the same position.  Works perfectly in a variety of configurations. Thank you Brian Schmalz (easydriver creator)!!!

Go Up