Searching \ for '[EE] Stepper motor as an encoder - and accidental' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/io/sensors.htm?key=encoder
Search entire site for: 'Stepper motor as an encoder - and accidental'.

Exact match. Not showing close matches.
PICList Thread
'[EE] Stepper motor as an encoder - and accidental '
2008\11\01@201850 by Jinx

face picon face
I've got 23 size 1.8 degree bipolar stepper motors that I want to use for two-
dimensional positioners, similar to, but not, a plotter. One function that is
needed is having them move to preset positions via way-points. ie start at A
and move to E via B C and D co-ordinates

To do this I thought of using them initially as quadrature encoders. A test using
an LM339 and the two pairs of windings suggests that will work. The intention
is to record the way-points (ie count step and direction) with a PIC, reset the
steppers to a home position, and have them move through those points when
driven

However, the steppers are very sensitive to the sound of their own rotation
and handling and, to a lesser extent, external noise. This appears as unwanted
output from the LM339

Has anyone got or seen a solution to filtering this noise output from the steppers,
leaving the output that results from just the stepping ?

A major setting movement by hand, eg position A to position B, might take
0.5s to cover perhaps 90 degrees, ie 50 steps => 100Hz output. For 'careful'
minor adjustment perhaps 0.5s or more per step

The unwanted output is of a different nature to the signal generated by hand
turning. It's generally non-quadrature and 'messy'. The signal shape and level
at the stepper coils depends on speed. At a very low stepping rate, about
+/- 300mV, kind of 'lumpily' sinusoidal, at higher step rates the voltage goes
up to several volts and is much more sinusoidal

Noise out put from the LM339 is much more prevalent at low stepping rates,
because the voltage generated by the actual turning is so much lower, whereas
vibration voltage is fairly consistently high

My thoughts are

- use conditioning s/w in the PIC to filter by pulse width / non-quadratureness
- rubber or spring suspension
- a low-pass filter before the comparators
- all of the above
- something else
- use proper encoders, but I'd rather not if I don't have to (some wiggle room
is acceptable re accuracy)

I've Googled, but yet to find anything like this. The vast majority of steppers
used in reverse are for power generation, not as encoders

TIA

2008\11\03@055515 by Alan B. Pearce

face picon face
>The unwanted output is of a different nature to the signal
>generated by hand turning. It's generally non-quadrature and
>'messy'. The signal shape and level at the stepper coils
>depends on speed. At a very low stepping rate, about +/- 300mV,
>kind of 'lumpily' sinusoidal, at higher step rates the voltage
>goes up to several volts and is much more sinusoidal

It sounds rather like you are seeing harmonics of the step signal. I
remember reading an HP journal back in the 70's where they put a lot of work
into driving a stepper assembly on a plotter with a waveform that had
appropriate harmonics added to the drive waveform, in order to get maximum
speed from the motors. It sounds to me like you are seeing the same problem
in reverse.

2008\11\03@063738 by Jinx

face picon face
> It sounds rather like you are seeing harmonics of the step signal

Actually, no. The stepper will put out noise without it moving. Just
lightly tapping it or the bench, even fingerprint ridges across the shaft,
or a loud clap nearby, will cause a small AC voltage on the windings

Most nuisancesome. Put a motor on the scope and try it

I'm having some success by mounting it on a foam cushion, putting
10k across each winding and using a bridge of Schottky diodes
as a rectifier. This somewhat removes that low-level noise which was
being amplified by the following comparator

Still tinkering to do on the comparator, as the AC output from a slow
step is not very sinusoidal. Looking at filtering and gain/hysteresis

The idea has potential and there could be a product in the making.
Getting it to work with these particular motors (9.6V, 0.4A, 23 ohm)
would be just great, as I have a lot of them and they're free. We'll see

2008\11\03@083354 by olin piclist

face picon face
Jinx wrote:
> Actually, no. The stepper will put out noise without it moving. Just
> lightly tapping it or the bench, even fingerprint ridges across the
> shaft, or a loud clap nearby, will cause a small AC voltage on the
> windings

But surely those are small signals compared to the result of true rotation?


********************************************************************
Embed Inc, Littleton Massachusetts, http://www.embedinc.com/products
(978) 742-9014.  Gold level PIC consultants since 2000.

2008\11\03@211522 by Jinx

face picon face
> > shaft, or a loud clap nearby, will cause a small AC voltage on the
> > windings
>
> But surely those are small signals compared to the result of true rotation?

Yes, when the motor is turned by hand faster than say 4 or 5 steps per
second, and the voltage goes up and the waveform is more defined. Slower
than that though, vibrational noise can be a fair part of the output signal. I
think a LPF will help, if it can attenuate noise without affecting the signal
from a fast-ish turn (ie the higher output frequencies) . Although at that
speed the step signal is a few volts. Some simple circuitry is probably all
that's needed, my hope was that using a stepper as an encoder was on the
web somewhere as a completed project

Might have a look around the robotics forums

And don't call me Shirley




2008\11\04@000410 by Xiaofan Chen

face picon face
On Tue, Nov 4, 2008 at 8:52 AM, Jinx <spam_OUTjoecolquittTakeThisOuTspamclear.net.nz> wrote:
> that's needed, my hope was that using a stepper as an encoder was on the
> web somewhere as a completed project

So use Google and search "using step motor as a rotary encoder"
and you will find some hits.
1. http://www.webx.dk/oz2cpu/20m/encoder.htm
With PIC inside ;-)
2. http://www.4qdtec.com/stpen.html
3. http://users.tkk.fi/~jwagner/electr/rotary-enc/ (MSP430 inside)

Xiaofan

2008\11\04@025705 by Jinx

face picon face
> So use Google and search "using step motor as a rotary encoder"

Ah, I tried several searches like it but not that phrase

This circuit is close to what I'm working on, and has a tiny Australian
for a knob - "Looks good, the weight is 330 grames of pure cobber"

Good onya mate

> 1. http://www.webx.dk/oz2cpu/20m/encoder.htm
> With PIC inside ;-)

> 2. http://www.4qdtec.com/stpen.html

Found this one with my search

> 3. http://users.tkk.fi/~jwagner/electr/rotary-enc/ (MSP430 inside)

Thanks

2008\11\04@025729 by Jinx

face picon face
> So use Google and search "using step motor as a rotary encoder"

Ah, I tried several searches like it but not that phrase

This circuit is close to what I'm working on, and has a tiny Australian
for a knob - "Looks good, the weight is 330 grames of pure cobber"

Good onya mate

> 1. http://www.webx.dk/oz2cpu/20m/encoder.htm
> With PIC inside ;-)

> 2. http://www.4qdtec.com/stpen.html

Found this one with my search

> 3. http://users.tkk.fi/~jwagner/electr/rotary-enc/ (MSP430 inside)

Thanks

2008\11\04@071617 by olin piclist

face picon face
Jinx wrote:
> Yes, when the motor is turned by hand faster than say 4 or 5 steps per
> second, and the voltage goes up and the waveform is more defined.

A sensor that works on changing magnetic field is not going to work below
some frequency.  If you need steady state, then get a real shaft encoder.

Go back to first principals and see that what you really want is a
integrator.  In theory, the integral of open circuit voltage over one step
will be the same regardless of speed.  Below some speed however, the signal
is buried in noise and the offset of the integrator becomes significant.  I
would therefore set up a integrator with a opamp and bleed off the
accumulation capacitor at the lowest rolloff frequency you can tolerate.
For rates of about twice that frequency and above, you should get a roughly
constant size pulse.  Then you can use a comparator with a fixed threshold.

Note that this is a fancy way of deriving a single pole low pass filter,
just a different way of looking at it.


********************************************************************
Embed Inc, Littleton Massachusetts, http://www.embedinc.com/products
(978) 742-9014.  Gold level PIC consultants since 2000.

2008\11\05@021110 by Jinx

face picon face
> A sensor that works on changing magnetic field is not going to work
> below some frequency

I may have to admit defeat on this one. I've tried a variety of integrators,
filters, bridges, comparators, amps, but separating out the actual pulse at
a slow step is still not happening reliably. Noise from vibration can be filtered
out fairly easily because of its amplitude, but the waveform from the motor
is too indistinct, and for this application the overall frequency range is too
narrow to apply any high-Q filters. The human variable (hand turning) is a
big factor. Because the detent is quite weak it's possible to move the motor
and make voltage without passing through a pole and generating a bona fide
pulse. And that's quite likely to happen in practise

Both of the web circuits I tried do not work very well at all, with these
motors at least. I suspect the task becomes more difficult the finer the step
angle

> If you need steady state, then get a real shaft encoder

There's another option available. The object being moved is on a gimbal
made of two circular plates, for rotation and elevation. Each of these plates
can be 150mm diameter. Plan B is to stick a printed alternate black/white
pattern on the circumference. If the plate was 159mm diameter, that's
500mm circumference, ie 200 x 2.5mm or even finer. Two reflective sensors,
staggered by 1.25mm, can sense movement and direction for each plate

It would have been nice to use the motor in a dual role, but not to be

2008\11\05@033647 by cdb

flavicon
face


:: The human variable (hand turning) is a
:: big factor.

Would some form of 'fuzzy logic' algorithm help sort out the wheat form the chaff?

Colin
--
cdb, .....colinKILLspamspam@spam@btech-online.co.uk on 5/11/2008

Web presence: http://www.btech-online.co.uk  

Hosted by:  http://www.1and1.co.uk/?k_id=7988359






2008\11\05@034915 by Jinx

face picon face
> The human variable (hand turning) is a big factor.
>
> Would some form of 'fuzzy logic' algorithm help sort out the wheat
> from the chaff?

I thought of some sort of interpreter using the A2D, and that might work,
with a sufficient and very uneconomic amount of time. But the chaff does
often look too much like the wheat. And as I mentioned, sometimes it's
all chaff anyway

Good thought though Colin

2008\11\05@035205 by Peter

picon face
Jinx <joecolquitt <at> clear.net.nz> writes:
> There's another option available. The object being moved is on a gimbal
> made of two circular plates, for rotation and elevation. Each of these plates
> can be 150mm diameter. Plan B is to stick a printed alternate black/white
> pattern on the circumference. If the plate was 159mm diameter, that's
> 500mm circumference, ie 200 x 2.5mm or even finer. Two reflective sensors,
> staggered by 1.25mm, can sense movement and direction for each plate
>
> It would have been nice to use the motor in a dual role, but not to be

Try to go back to basics: RC on each coil, calculated for critical damping.

The way to sense slow motion past a point with a coil+magnet device is to use
hysteresis in the magnetic circuit. You do not have that option. A dynamic way
would be to set up an ac bridge and measure the inductivity of each coil
directly.

The best way to use optical sensing is to put an encoder disk on the motor
axle, since what you really want is to "learn" the motor motions ?

Peter


2008\11\05@044408 by Jinx

face picon face
> A dynamic way would be to set up an ac bridge and measure the
> inductivity of each coil directly

Peter, I estimate the inductance at 10mH per coil

http://www.thekeeser.com/Electronics%20info/measure_an_unknown_inductor.htm

Using 1k1 and 45n, peaking at 7600Hz

Have you a suggestion for a better filter ?

2008\11\05@051719 by apptech

face
flavicon
face

Feeding two coil inputs into a comparator can work wonders.
Two transistors in a basic long tailed pair may suffice.

I had to measure RPM on an alternator whose load was a PWM'd resistor
(exercise equiment).
The slow speed alternator waveform and PWM played havoc with most attempts
to derive speed pulses from the alternator.

Fed two phases via say 100k to two NPN bases. Join emitters with say 10k to
ground and say 10k or 100k or ? to supply (I could look circuit up if
interested)
result was stunningly good. Directly analogous to current requirement.


 Russell

2008\11\05@115435 by Peter

picon face
Jinx <joecolquitt <at> clear.net.nz> writes:

> > A dynamic way would be to set up an ac bridge and measure the
> > inductivity of each coil directly
>
> Peter, I estimate the inductance at 10mH per coil

Try series RC in parallel with each phase, like 1 uF and 220 to 100 ohms (try
the large value first), and also try what Russell said (in addition to the RC).
There will always be a lower limit where it will not work reliably. The ac
bridge method involves injecting ac capacitively and measuring the impedance
continuously.

Peter


More... (looser matching)
- Last day of these posts
- In 2008 , 2009 only
- Today
- New search...