Quadrature encoder "decoding" - simple problem?

Iteration #2, putting encoder B output through the Schmitt trigger before applying it to the circuit would be a better practice: Please view in a fixed-width font such as Courier.

. . VCC . +------+-----------------------+----------- . | | | 74HC132:C . | | | __ . [10K] [10K] | VCC-| \ _ . | | | | >o-> B . +------|-----------------------|-----|__/ . | | | . | | .---+ . | | 7.5ms debounce | | 555 . | | ---------- . | | | RST VCC | . | | | | ____ . | +-[68K]---+---+-|THR Q|-------> A_DB . | | | | | | . o o | '-|TRIG | . \ B \ A === | | . o o 0.1U | | GND | . | | | ---------- . | | | | . '------+---------+-----------+-------------- . GND . . . sample pulse generator . 74HC86:B . ____ ___ . A_DB >----+------------------------------\\ \ . | ___ 74HC132:A || >-> A_TRANS . -\\ \ __ .--//__/ . || >-[10K]----+--| \ | . VCC>---//__/ | | >o-' . +--|__/ 150us nom . 74HC86:A | . 0.1U === ________ . | __| |__ . GND . . . . delay 1.5us nom . . A_TRANS>----[10K]--+---. output clock steering . | | . 0.001U=== | . | | . GND | . ____ ___ | 74HC132:B . A_DB >--\\ \ | __ . _ || >---+----|-----------| \ __ __ . B >--//__/ | | | >o-> CW |________| . | +-----------|__/ . 74HC86:C | | . | | . | | . | | . | | 74HC86:D . | | ___ 74HC132:D . '----|-----\\ \ __ . | || >-| \ __ __ . | VCC-//__/ | >o-> CCW |________| . '------------|__/ . . . . Both transitions of A are used to sense B, B is unstable at detents . . . Panasonic EVQ-WTE encoder

Reply to
bloggs.fredbloggs.fred
Loading thread data ...

In summary:

All the suggested arrangements that treat the A and B inputs as "equals" are prone to the rocking problem. At a detent, the B input could be in a "teased" state where any rocking will generate not only unwanted transitions but potentially come to rest in the alternate state. Hence the reason I stated sampling B at A transitions only, and by inference ignoring B transitions as an input event.

The 12F508/ELM40x chips would have saved a lot of board space, but they treat the A and B inputs symmetrically and respond to B transitions> This makes them unsuitable for decoding this type of encoder with detents coincident with transitions of one input - typical of most of the ALPS encoder range as well as these old Panasonic units.

To advance/retreat the following counter by one count per detent (which is the objective), both A transitions need to generate a count. This impacts the debounce requirement somewhat. I'm still playing pencil-and-paper schematic doodling in the search for a minimum bi-di debounce plus pulse-gen arrangement. What I don't want to end up with is an armful of different chips (schmidt, one-shot, D-f/f, nand/nor/xor) with most parts largely unused.

Thanks to all for your suggestions.

Reply to
who where

One other thing you're overlooking is that for some of the encoders a trans ition on one switch causes bounce in the quadrature switch. I don't think y ou're going to get away with less than three MSI, all of which are totally used, like shown below. If you find something get back to us : Please view in a fixed-width font such as Courier.

. . VCC . +------+-----------------------+----------- . | | | 74HC132:C . | | | __ . [10K] [10K] | VCC-| \ _ . | | | | >o-> B . +------|-----------------------|-----|__/ . | | | . | | .---+ . | | 7.5ms debounce | | 555 . | | ---------- . | | | RST VCC | . | | | | ____ . | +-[68K]-+-[1K]+-|THR Q|-------> A_DB . | | | | | | . o o 0.1U| '-|TRIG | . \ B \ A === | | . o o | | GND | . | | | ---------- . | | | | . '------+-------+-------------+-------------- . GND . . . sample pulse generator . 74HC86:B . ____ ___ . A_DB >----+--------------------------------\\ \ . | ___ 74HC132:A || >-> A_TRANS . -\\ \ __ .-//__/ . || >-[10K]-+-[1K]-+-| \ | . VCC>---//__/ | | | >o-' . | '-|__/ 150us nom . 74HC86:A 0.1U| ________ . === __| |__ . | . GND . . . . delay 1.5us nom . . A_TRANS>----[10K]--+---. output clock steering . | | . 0.001U=== | . | | . GND | . ____ ___ [1K] 74HC132:B . A_DB >--\\ \ | __ . _ || >---+----|-----------| \ __ __ . B >--//__/ | | | >o-> CW |________| . | +-----------|__/ . 74HC86:C | | . | | . | | . | | . | | 74HC86:D . | | ___ 74HC132:D . '----|-----\\ \ __ . | || >-| \ __ __ . | VCC-//__/ | >o-> CCW |________| . '------------|__/ . . . . Both transitions of A are used to sense B, B is unstable at detents . . . Panasonic EVQ-WTE encoder . . . ___ . option for single CLK and INC / DEC line . . . delay 1.5us nom . . A_TRANS>----[10K]--+---. output clock steering . | | . 0.001U=== | . | | . GND | . ____ ___ [1K] 74HC132:B . A_DB >--\\ \ | __ . _ || >---+----|-----------| \ __ __ . B >--//__/ | | | >o-> CLK |________| . | '-----------|__/ . 74HC86:C | . | ___ . '-----------------------> CW / CCW . . . . .

Reply to
bloggs.fredbloggs.fred

I don't remember anymore. Is this a one-off? Or do you need a few?

Either way, I could code up PIC12F508 for you. (Though I don't know why you don't select the much cheaper PIC10F200 in SOT-23 or PDIP-8 or DFN-8.) No charge. I'll go buy the switch myself, test it thoroughly after coding, and ship it... without charge. Source code is also free if you want it. Makes no difference to me.

Problem is, if you need more than one and don't want to burn them yourself I'd have to go into the business of burning them for you. So, one-off is good and easy on us both. More than that means we'd need to talk. But I'm easy.

Jon

Reply to
Jon Kirwan

I believe you are incorrect in this. The ELM rotary decoders

formatting link
do have logic built in to detect multiple pulses at the detent position. I quote from the ELM404 data sheet:

The logic to decode the motion of an encoder shaft is not as simple as it would first appear. Some authorities recommend simply monitoring an input and when it changes, provide an output based on the level of the other input. This does not always work, as the encoder can output multiple signals from only the ?A¹ or or only the ?B¹ contact if the shaft is moved ever so slightly when at the detent or at the mid-point position (between detents). Simply seeing one input change is not sufficient to say that there is any significant shaft rotation. The ELM404 monitors both ?A¹ and ?B¹ transitions, and determines the outputs based on the sequence in which the transitions have occurred. This is a better way to guarantee that the output signals are generated properly.

--
Jim
Reply to
Jim

That is your prerogative.

I have read that, several times in fact. Nowhere does it state - or infer - that unwanted B transitions from teasing or rocking will not generate count pulses. Are you suggesting otherwise?

In the application at hand, any such unwanted pulses from B jiggling are unacceptable and I figured that had been made reasonably clear earlier in the thread.

Reply to
who where

½B? contact if the

nsitions, and determines the

The datasheet shows otherwise, the output pulse logic only responds to the first instance B transition encountered and ignores all others until after the next A transition. The only drawback of that logic is you lose a pulse every time the rotation is reversed.

Reply to
bloggs.fredbloggs.fred

On Friday, November 30, 2012 8:42:15 AM UTC-5, Jim wrote:

the

the

That is okay as far as it goes but the MSI logic I proposed does not act up in response to dithering the shaft around A transitions between detents. Y ou may get multiple pulses but they are always the right sense. So you may get an UP then a DOWN then an UP etc depending up the true displacement of the shaft relative to the A transition point. An example of an oversimplifi cation that does give multiple wrong polarity pulses is that dual FF/NAND g ate job Thompson linked to. The ELM circuit does not necessarily advance at the detent stops and it loses a pulse when rotation is reversed. But this is probably okay for most of the intended applcations. Availability and pri cing favors the MSI approach, convenience the ELM. I added more filtering b ecause these crummy switches bounce while in the closed position as the spr ing contact is being dragged across the switch COM pad. Please view in a fixed-width font such as Courier.

. . VCC . +------+-----------------------+----------- . | | | 74HC132:C . | | | __ . [10K] [10K] | VCC-| \ _ . | | | | >o-> B . +------|---[68K]---+---[1K]----|-----|__/ . | | | | . | | 0.1U| .---+ . | | === | | 555 7.5ms debounce . | | | ---------- . | | GND | RST VCC | . | | | | ____ . | +-[68K]-+-[1K]+-|THR Q|-------> A_DB . | | | | | | . o o 0.1U| '-|TRIG | . \ B \ A === | | . o o | | GND | . | | | ---------- . | | | | . '------+-------+-------------+-------------- . GND . . . sample pulse generator . 74HC86:B . ____ ___ . A_DB >----+--------------------------------\\ \ . | ___ 74HC132:A || >-> A_TRANS . -\\ \ __ .-//__/ . || >-[10K]-+-[1K]-+-| \ | . VCC>---//__/ | | | >o-' . | '-|__/ 150us nom . 74HC86:A 0.1U| ________ . === __| |__ . | . GND . . . . delay 1.5us nom . . A_TRANS>----[10K]--+---. output clock steering . | | . 0.001U=== | . | | . GND | . ____ ___ [1K] 74HC132:B . A_DB >--\\ \ | __ . _ || >---+----|-----------| \ __ __ . B >--//__/ | | | >o-> CW |________| . | +-----------|__/ . 74HC86:C | | . | | . | | . | | . | | 74HC86:D . | | ___ 74HC132:D . '----|-----\\ \ __ . | || >-| \ __ __ . | VCC-//__/ | >o-> CCW |________| . '------------|__/ . . . . Both transitions of A are used to sense B, B is unstable at detents . . . Panasonic EVQ-WTE encoder . . . ___ . option for single CLK and INC / DEC line . . . delay 1.5us nom . . A_TRANS>----[10K]--+---. output clock steering . | | . 0.001U=== | . | | . GND | . ____ ___ [1K] 74HC132:B . A_DB >--\\ \ | __ . _ || >---+----|-----------| \ __ __ . B >--//__/ | | | >o-> CLK |________| . | '-----------|__/ . 74HC86:C | . | ___ . '-----------------------> CW / CCW . .

Reply to
bloggs.fredbloggs.fred

In the application at hand, any such unwanted pulses from B jiggling are unacceptable and I figured that had been made reasonably clear earlier in the thread.

formatting link

Reply to
joey899244

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.