# Stepper motor, micro-stepping: Left vs Right

Started by March 31, 2012
```Using 12bit DAC, I would like to have 32 microsteps.

I have mounted a laser on the shaft so I can see the laser beam
on my wall, where I have 32 grid lines.

I've experimented, and it goes pretty well,
all 32 steps are more or less on grid - when I go right.

But when I turn back left, the laser dot moves fast,
then slow, then fast again - not on grid.

I haven't found anything on the net about this.
Maybe I could have two DAC tables, one for moving right
and for moving left, but I would like to read something
about this - if anyone can guide me further...?
```
```On Mar 31, 1:23=A0pm, aleks...@gmail.com wrote:
> Using 12bit DAC, I would like to have 32 microsteps.
>
> I have mounted a laser on the shaft so I can see the laser beam
> on my wall, where I have 32 grid lines.
>
> I've experimented, and it goes pretty well,
> all 32 steps are more or less on grid - when I go right.
>
> But when I turn back left, the laser dot moves fast,
> then slow, then fast again - not on grid.
>
> I haven't found anything on the net about this.
> Maybe I could have two DAC tables, one for moving right
> and for moving left, but I would like to read something
> about this - if anyone can guide me further...?

Something's wrong.  Either the currents, or there's mechanical drag.

--
Cheers,
James Arthur
```
```On 3/31/2012 10:23 AM, aleksazr@gmail.com wrote:
> Using 12bit DAC, I would like to have 32 microsteps.

I'm not sure I understand your use of this figure in what follows.
The motor has a fixed (*whole*) step size.  E.g., 1.8 degrees
(200 steps per shaft revolution).  Microstepping allows you to
drive the motor to "fractional step positions".  So, for the
1.8 degree step size, 32 microsteps PER STEP would translate to
6400 microsteps per shaft revolution.

[In which case, I can't understand how you are "seeing this"
in a light projection on the wall]

> I have mounted a laser on the shaft so I can see the laser beam
> on my wall, where I have 32 grid lines.

Here I don't quite follow.  Is the laser's light *parallel*
to the motor shaft (so the laser traces out a circle when
the shaft rotates)?  In which case, the "grid lines" are
really *rays* emanating from the point at which the
center of the shaft intersects the wall (?)

> I've experimented, and it goes pretty well,
> all 32 steps are more or less on grid - when I go right.

"Right" being clockwise when viewing the laser light on
the wall?

> But when I turn back left, the laser dot moves fast,
> then slow, then fast again - not on grid.
>
> I haven't found anything on the net about this.
> Maybe I could have two DAC tables, one for moving right
> and for moving left, but I would like to read something
> about this - if anyone can guide me further...?

Sounds like mechanical slop, backlash or stiction in the
motor (is there a gearhead on the motor?).  OTOH, if it is
that "regular", it could be that your excitation isn't as
it should be!

The first thing to verify is the voltage from your controller
at each microstep point.  I.e., the waveform should have the
same relative shape (and instantaneous values) just "reflected"
as the direction changes (looking at each individual drive
channel in isolation).

Remember, microstepping "balances" the armature's position
based on the relative magnetic strengths of the motor's
coils.  So, if one waveform isn't in the proper phase
relationship with the other, this "sweet spot" can move
off of "ideal".

[In practice, this doesn't hold up as the motor is accelerated
or decelerated]

Finer grained microstepping (32 is a rather high target) suffers
from repeatability issues.  Especially if the motor's manufacturing
tolerances didn't take this form of operation into account.

"Lots of microsteps" are often of primary value in delivering
*smooth* operation -- not "near infinite angular shaft resolution".
I suspect you may be looking at signal amid noise.

Does the motor "run as smooth" clockwise vs. counterclockwise?
I.e., the *sound* of the motor should have roughly the same
frequency distributions regardless of direction -- unless it
truly *is* cogging in one direction, only (or, "more than the
other") WHEN OPERATED AT SOME NOMINAL SPEED.
```
```On 2 Apr., 23:47, Don Y <t...@isnotme.com> wrote:
> On 3/31/2012 10:23 AM, aleks...@gmail.com wrote:
>
> > Using 12bit DAC, I would like to have 32 microsteps.
>
> I'm not sure I understand your use of this figure in what follows.
> The motor has a fixed (*whole*) step size. =A0E.g., 1.8 degrees
> (200 steps per shaft revolution). =A0Microstepping allows you to
> drive the motor to "fractional step positions". =A0So, for the
> 1.8 degree step size, 32 microsteps PER STEP would translate to
> 6400 microsteps per shaft revolution.
>
> [In which case, I can't understand how you are "seeing this"
> in a light projection on the wall]
>
> > I have mounted a laser on the shaft so I can see the laser beam
> > on my wall, where I have 32 grid lines.
>
> Here I don't quite follow. =A0Is the laser's light *parallel*
> to the motor shaft (so the laser traces out a circle when
> the shaft rotates)? =A0In which case, the "grid lines" are
> really *rays* emanating from the point at which the
> center of the shaft intersects the wall (?)
>
snip

I'm guessing shaft vertical, laser mounted so beam is horisontal

spot on wall moves when shaft turns, the further from wall the more
the spot moves per degree so it is easier to see and measure the
angle

-Lasse

```
```On 4/2/2012 3:05 PM, langwadt@fonz.dk wrote:
> On 2 Apr., 23:47, Don Y<t...@isnotme.com>  wrote:
>> On 3/31/2012 10:23 AM, aleks...@gmail.com wrote:
>>
>>> Using 12bit DAC, I would like to have 32 microsteps.
>>
>> I'm not sure I understand your use of this figure in what follows.
>> The motor has a fixed (*whole*) step size.  E.g., 1.8 degrees
>> (200 steps per shaft revolution).  Microstepping allows you to
>> drive the motor to "fractional step positions".  So, for the
>> 1.8 degree step size, 32 microsteps PER STEP would translate to
>> 6400 microsteps per shaft revolution.
>>
>> [In which case, I can't understand how you are "seeing this"
>> in a light projection on the wall]
>>
>>> I have mounted a laser on the shaft so I can see the laser beam
>>> on my wall, where I have 32 grid lines.
>>
>> Here I don't quite follow.  Is the laser's light *parallel*
>> to the motor shaft (so the laser traces out a circle when
>> the shaft rotates)?  In which case, the "grid lines" are
>> really *rays* emanating from the point at which the
>> center of the shaft intersects the wall (?)
>>
> snip
>
> I'm guessing shaft vertical, laser mounted so beam is horisontal

Ah, OK.

> spot on wall moves when shaft turns, the further from wall the more
> the spot moves per degree so it is easier to see and measure the
> angle

But, still, to resolve a 32nd of a step you'd need either *big*
steps or to be pretty far from the wall (and doing your math
carefully!)  0-th order approximation:  sine = tan = angle
for angle close to 0.  Smallest angle would be O(2pi/6400)
which my shirtsleeve says is "about 0.001".  So, the spacing
between lines would approach D/1000 (where D is distance
to wall).  At 5 *ft* you're looking at 1/16" -- double
that at 10'.  How good is the laser?  One of those handheld
"pointers"? :>

[Assuming my shirtsleeve isn't out of calibration]

It would seem simpler to mount a mirror on the shaft and
aim the laser at the "center" of the mirror -- less mass to
support and accelerate (maybe even "borrow" a mirror
from a barcode scanner).  *If* you want to go that way...

Seems like I would be looking at waveforms before messing
with clumsy measurement jigs.

Has the OP decided that mechanical reduction can't provide the
resolution/holding torque desired?
```
```On Apr 2, 5:47=A0pm, Don Y <t...@isnotme.com> wrote:
> On 3/31/2012 10:23 AM, aleks...@gmail.com wrote:
>
> > Using 12bit DAC, I would like to have 32 microsteps.
>
> I'm not sure I understand your use of this figure in what follows.
> The motor has a fixed (*whole*) step size. =A0E.g., 1.8 degrees
> (200 steps per shaft revolution). =A0Microstepping allows you to
> drive the motor to "fractional step positions". =A0So, for the
> 1.8 degree step size, 32 microsteps PER STEP would translate to
> 6400 microsteps per shaft revolution.
>
> [In which case, I can't understand how you are "seeing this"
> in a light projection on the wall]
>
> > I have mounted a laser on the shaft so I can see the laser beam
> > on my wall, where I have 32 grid lines.
>
> Here I don't quite follow. =A0Is the laser's light *parallel*
> to the motor shaft (so the laser traces out a circle when
> the shaft rotates)? =A0In which case, the "grid lines" are
> really *rays* emanating from the point at which the
> center of the shaft intersects the wall (?)
>
> > I've experimented, and it goes pretty well,
> > all 32 steps are more or less on grid - when I go right.
>
> "Right" being clockwise when viewing the laser light on
> the wall?
>
> > But when I turn back left, the laser dot moves fast,
> > then slow, then fast again - not on grid.
>
> > I haven't found anything on the net about this.
> > Maybe I could have two DAC tables, one for moving right
> > and for moving left, but I would like to read something
> > about this - if anyone can guide me further...?
>
> Sounds like mechanical slop, backlash or stiction in the
> motor (is there a gearhead on the motor?). =A0OTOH, if it is
> that "regular", it could be that your excitation isn't as
> it should be!

Stiction perhaps, but that doesn't account for the correct operation
turning CW.

--
Cheers,
James Arthur
```
```aleksazr@gmail.com wrote:

> Using 12bit DAC, I would like to have 32 microsteps.
>
> I have mounted a laser on the shaft so I can see the laser beam
> on my wall, where I have 32 grid lines.
>
> I've experimented, and it goes pretty well,
> all 32 steps are more or less on grid - when I go right.
>
> But when I turn back left, the laser dot moves fast,
> then slow, then fast again - not on grid.
>
> I haven't found anything on the net about this.
> Maybe I could have two DAC tables, one for moving right
> and for moving left, but I would like to read something
> about this - if anyone can guide me further...?

You have something wrong in your code or what ever. Also, I am
trying to wrap my head around how you're using a 12 bit DAC to
operate a stepper motor?

Jamie

```
```Hi James,

On 4/2/2012 3:55 PM, dagmargoodboat@yahoo.com wrote:
> On Apr 2, 5:47 pm, Don Y<t...@isnotme.com>  wrote:
>> On 3/31/2012 10:23 AM, aleks...@gmail.com wrote:
>>
>>> Using 12bit DAC, I would like to have 32 microsteps.
>>
>> I'm not sure I understand your use of this figure in what follows.
>> The motor has a fixed (*whole*) step size.  E.g., 1.8 degrees
>> (200 steps per shaft revolution).  Microstepping allows you to
>> drive the motor to "fractional step positions".  So, for the
>> 1.8 degree step size, 32 microsteps PER STEP would translate to
>> 6400 microsteps per shaft revolution.
>>
>> [In which case, I can't understand how you are "seeing this"
>> in a light projection on the wall]
>>
>>> I have mounted a laser on the shaft so I can see the laser beam
>>> on my wall, where I have 32 grid lines.
>>
>> Here I don't quite follow.  Is the laser's light *parallel*
>> to the motor shaft (so the laser traces out a circle when
>> the shaft rotates)?  In which case, the "grid lines" are
>> really *rays* emanating from the point at which the
>> center of the shaft intersects the wall (?)
>>
>>> I've experimented, and it goes pretty well,
>>> all 32 steps are more or less on grid - when I go right.
>>
>> "Right" being clockwise when viewing the laser light on
>> the wall?
>>
>>> But when I turn back left, the laser dot moves fast,
>>> then slow, then fast again - not on grid.
>>
>>> I haven't found anything on the net about this.
>>> Maybe I could have two DAC tables, one for moving right
>>> and for moving left, but I would like to read something
>>> about this - if anyone can guide me further...?
>>
>> Sounds like mechanical slop, backlash or stiction in the
>> motor (is there a gearhead on the motor?).  OTOH, if it is
>> that "regular", it could be that your excitation isn't as
>> it should be!
>
> Stiction perhaps, but that doesn't account for the correct operation
> turning CW.

Could be the armature has a "flare" to it that affects operation
in one direction more than the other...

<shrug>

I'd want to look at 'scope traces before casting judgement.
```
```Something came up, so I'll have to stop
working on this for some time (maybe a week).

There are 6400 steps total, and the shaft is vertical/laser horizontal, yes.
Its a cheap laser, yes, but that shouldn't matter much here.
(it just doesn't show as a *round* dot, but you can always find it's center)

I have a 4m wide room, the stepper is in the middle.
I've placed two mirrors on the walls, so the total beam "length" is around 10m.
The beam on the final wall travels for about 30cm for one full step.

I'll try several other steppers, to see if they behave the same.

This one has another odd thing: at one particular micro-step,
the beam comes to the grid as it should, but then instead of
just sitting there, it slowly slides to the right for a few micro-steps.
```
```On Apr 3, 3:45=A0pm, aleks...@gmail.com wrote:
> Something came up, so I'll have to stop
> working on this for some time (maybe a week).
>
> There are 6400 steps total, and the shaft is vertical/laser horizontal, y=
es.
> Its a cheap laser, yes, but that shouldn't matter much here.
> (it just doesn't show as a *round* dot, but you can always find it's cent=
er)
>
> I have a 4m wide room, the stepper is in the middle.
> I've placed two mirrors on the walls, so the total beam "length" is aroun=
d 10m.
> The beam on the final wall travels for about 30cm for one full step.
>
> I'll try several other steppers, to see if they behave the same.
>
> This one has another odd thing: at one particular micro-step,
> the beam comes to the grid as it should, but then instead of
> just sitting there, it slowly slides to the right for a few micro-steps.

You can tap or twist the shaft and see if there's stiction, etc.  If
you can disturb the shaft, then observe its rebound and hysteresis,
you'll start getting a feel for what's what.

I'd suspect stiction and currents and motor design.

Most driver circuits don't produce low-valued currents to the accuracy
you need.  A current-mode driver, for example, will have a blanking
time.  That enforces, effectively, a minimum current.  The average
current you asked for is not the average current you get.  Some
drivers make zero amps, some don't.

AIUI, stepper motors simply don't microstep accurately to the level
you're attempting.  Accuracy varies widely with motor design, I hear.
YMMV.

--
Cheers,
James Arthur
```