Position Encoding.

Dec 21, 2011 446 Replies

Such sequences exist and are called De Bruijn sequences. One way of creating them is to insert a 0 into the longest run of zeroes in one period of the output of a maximal length LFSR. A De Bruijn sequence of period 2^n can be generated by a n-stage feedback shift register with _nonlinear_ feedback.

The longest run of zeroes from a n-stage maximal-length LFSR is n-1 consecutive zeroes. This is because if the LFSR ever gets into the all-zeroes state it would continue in that state forever and produce a sequence of zeroes only). The nonlinear feedback actually is just the feedback that occurs in the LFSR **except** that a 0 is fed back instead of a 1 when the register contents are

000...01 (100...00 for you Republicans) so that the next contents are 000...00 (regardless of which party you belong to!) instead of 100...00 (or 000...01) as would be the case with a LFSR. Nonlinear feedback strikes again when the shift register contents are 000...00, feeding back a 1 instead of a 0 so that the next contents are 100...00 (or 000...01) and the linear feedback resumes. In short, if we draw a state transition diagram for the De Bruijn register, it looks very much like the state transition diagram for the LFSR except for the notable difference that the 000...00 state is inserted between 000...01 and 100...00 (and it needs nonlinear feedback to accomplish this).

Dilip Sarwate

You are correct, I slipped a digit. It should be x^4 + x + 1 (and the first time I typed that it had x^5 again!!!).

I have written mod-2 polynomial arithmetic packages, including Sieves of Eratosthenes to find primitive polynomials, at least four times that I can distinctly remember, and probably more often than that.

I may even have one or two of them around, still.

My liberal friends think I'm a conservative kook. My conservative friends think I'm a liberal kook. Why am I not happy that they have found common ground? Tim Wescott, Communications, Control, Circuits & Software http://www.wescottdesign.com

Why give Slowman the time of the day? He's vociferously clueless. ...Jim Thompson

| James E.Thompson, CTO | mens | | Analog Innovations, Inc. | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | Phoenix, Arizona 85048 Skype: Contacts Only | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at http://www.analog-innovations.com | 1962 | I love to cook with wine. Sometimes I even put it in the food.

If you're implementing one of those in logic, you probably want to count zeros, and when you get to 2^N-1 of them, then hold off the LFSR for one cycle and insert a zero into the stream (and if you're paranoid about cosmic rays zeroing out your LFSR, insert the right pattern into it at that point, to boot).

That takes less logic than a ginormous zero-detector, or at least it does in an FPGA.

My liberal friends think I'm a conservative kook. My conservative friends think I'm a liberal kook. Why am I not happy that they have found common ground? Tim Wescott, Communications, Control, Circuits & Software http://www.wescottdesign.com

the

can

te

if

_

F.

ve

t

th

of

Now that's irony for you.

-- Bill Sloman, Nijmegen

Tim,

You're just having way too much fun!

Fred

Maybe that's why I don't like these cross-posted threads. Most of us don't know how to filter what we're reading because we don't know those other folks.

Fred

It would be fairly easy to do with a microprocessor, too -- they generally come with oodles of ROM these days. My two biggest concerns are that I would much rather do it with something off the shelf, and the TAOS parts look like they are not in any standard package, and may be a bit of a production headache.

My liberal friends think I'm a conservative kook. My conservative friends think I'm a liberal kook. Why am I not happy that they have found common ground? Tim Wescott, Communications, Control, Circuits & Software http://www.wescottdesign.com

Thanks Syd. That would be perfect -- except that I failed to mention that the shaft I need to get the position of goes all the way through the machine.

My bad -- I certainly should have said.

My liberal friends think I'm a conservative kook. My conservative friends think I'm a liberal kook. Why am I not happy that they have found common ground? Tim Wescott, Communications, Control, Circuits & Software http://www.wescottdesign.com

Well, theoretical fun. I really want to find a solution; the off the shelf ones I've found are spendy, and I'd like to not have a "roll your own" one unless there's not a good alternative.

My liberal friends think I'm a conservative kook. My conservative friends think I'm a liberal kook. Why am I not happy that they have found common ground? Tim Wescott, Communications, Control, Circuits & Software http://www.wescottdesign.com

e

pdf

I was answering the "Have you seen this, has it been done, how do you do it?" part of your post.

A COTS version would just be called an "absolute encoder." Pretty pricey. So, I thought the how-to info might be handy. They even give codewheel-printing PostScript source code.

usdigital.com is a decent place for encoder-shopping, both parts and complete units. TAOS and Avagotech.com make the optical sensors.

-- Cheers, James Arthur

And I do appreciate the effort!

I know. You can get incremental encoder chips from Avago, with directions on making the encoder strip or wheel or whatever (at least you could -- I'm not sure you still can). But I didn't see anything on the Avago web site about chips for absolute encoders. Maybe I'll look again...

I'll look. I was hoping for something between raw components and encoders that are stout enough for a gorilla to climb on -- I guess it'll be roll-my-own.

Well, I tried...

My liberal friends think I'm a conservative kook. My conservative friends think I'm a liberal kook. Why am I not happy that they have found common ground? Tim Wescott, Communications, Control, Circuits & Software http://www.wescottdesign.com

(snip, I wrote)

The design I remember needs a clock faster than the fastest possible actual transition. (Not counting going back and forth, bouncing across one edge.) I suppose many processors are fast enough to do an input loop fast enough to do that, but it is much easier with a clock and FF's in an FPGA.

The tiniest FPGA should do it if the BRAM is big enough.

-- glen

We boogered one of our VME waveform generators to simulate motion dynamics from a 8 million count encoder. I asked the customer what it was for and got the usual "we'd have to kill you if we told you" answer.

John

the

y a

4b.pdf

he

ght

ve

Impressive. And, did they kill you?

Grins, James

I think you only need the LFSR track and a detector the width of the word. That is, for an 8 bit encoder including the lockup state you'd have a track 256 bits long with the detector sitting over 8 consecutive bits. That way you'd map the output from the detector to a lookup table which would output position, and you could get direction by comparing 2 successive outputs from the LUT.

(snip)

(snip)

This has complications if the bits don't change at the same time, and they never do. You need some way to know where the bits are centered under the detectors.

One way is to have a set of detectors half way in between, or somewhere around the track such that at least one changes state half way between the spot where the detector bits change. You then need to debounce that signal appropriately, latch the detector bits, and apply them to the look-up table. You can also compare to the previous bits to detect transitions.

You do have to take care of very fast bounce noise on the data lines if they are sitting right on a transition.

Reminds me, there was discussion in the FPGA groups some time ago about an effect which is presumably true for all asynchronous SRAMs, but seems to have been mostly noticed in FPGAs. If you have the wrong kind of noise on the address inputs of an SRAM in read mode, it is possible to change the stored bits. Consider that the address bits select which cell to connect to the read lines, and switching fast enough could cause two cells to be selected, during the switch time, long enough or cummulatively enough to flip the cell. That could happen for a look-up table on asynchronous optical encoder data.

-- glen

d,

DSP,

er.

e/

t any

and

se

uy

e

ve

There are degrees of difficulty here; quadrature detectors can be made to work without any optics, while a detector capable of extracting single-bit information from a pseudo-random binary sequence encoded strip probably needs a lens to focus the light source onto the strip sufficiently tightly that the illuminated spot is not bigger than the narrowest stripe on the strip, and may need a second lens to concentrate the light that got through onto the detector.

An eight-point detector ideally needs eight closely spaced detectors looking at a well focussed image of the - moving - encoded strip, with a light source that provides relatively uniform illumination at all eight detectors.

The mechanical design gets bulkier - and more difficult to get aligned and keep aligned - as the optics get more demanding. Tim claims to be looking for something a gorilla can put together.

-- Bill Sloman, Nijmegen

,

SP,

r.

/

any

nd

e
y
e

ttdesign.com

How about a Potentiometer with continual 360 degrees rotation or in your optical vein a disk with a gradient of clear to dark in 360 degrees. Intensity =3D position.

regards, al

If it simplifies the construction, the detector can sook at every nth line rather than adjacent ones. Tom wanted a device a gorilla could sit on.

Jerry

Engineering is the art of making what you want from things you can get. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required