Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Rotary encoder circuit acting strange

Status
Not open for further replies.

sgergo

New Member
Hi!

I'd like to use a rotary encoder in my design and to make the MCU job easier I decided to use this circuit:

https://basicelectronic.blogspot.com/2006/08/rotary-encoder-converter-circuit.html

I'm using an NXP 74HC74D chip and a Bourns quadratic incremental encoder. I've built the circuit on breadboard with two LEDs hooked up to the Q outputs of the flipflop. The output pins of the encoder (A and B) are pulled up to 5V with 10K resistors, the common pin is to GND.


I was expecting to see when rotating the encoder shaft there is only one LED flashing at a time. However both LEDs are flashing always: one is by the expected rate of the rotation, the other one is by every second or fourth 'click' of the encoder shaft.

I checked the breadboard several times and there are no errors in the wiring. I simulated the circuit in multisim which confirmed the expected behaviour of the circuit and did not showed the behaviour I experienced.

I also checked the encoder with a scope and it is functional. Both A and B pins are signalling high and low states and their order is changing according to the direction of the rotation.

I'm out of ideas now. Any tip or idea would be highly regarded. Thank you!
 
hi,
Do you have a datasheet for the Bourne quadratic incremental encoder or a link with type number.?
 
Hi Eric, thank you for the reply. Here is the datasheet. The exact type is PEC11-4220F-S0012.

hi,
That encoder and 74HC74 work ok in simulation.??

Are your breadboard power rails capacitor decoupled, it could be 'noise'.
 

Attachments

  • Encoder1.gif
    Encoder1.gif
    41.2 KB · Views: 637
hi,
That encoder and 74HC74 work ok in simulation.??

Are your breadboard power rails capacitor decoupled, it could be 'noise'.

Yes, my simulation is working fine. Mine is not so nice but does the job. I'm simulating the encoder behaviour with 2 pulse sources with 90 deg phase shift between A and B or B and A (CW/CCW).

I haven't placed decoupling caps so I do it now. EDIT: placed 100nF and 1uF, not much changed.
 

Attachments

  • encoder_logic.jpg
    encoder_logic.jpg
    123.9 KB · Views: 1,238
Last edited:
Ah, those quad encoders!
Been there, done that, went mad in the process!:eek:

If you take your meter and look at the state of the two outputs, you will see that at the detent positions, both contacts are open circuit.
As you turn the thing from one detent click to the next, you will see that the two contacts do make a quadrature code, but go open circuit at the detents.

I also found that the switches had a lot of bounce.

I hated those quads so much that I discarded them and used something else which had a true quadrature output.

JimB
 
....................
If you take your meter and look at the state of the two outputs, you will see that at the detent positions, both contacts are open circuit.
As you turn the thing from one detent click to the next, you will see that the two contacts do make a quadrature code, but go open circuit at the detents.
That certainly sounds like a faulty design. A true quadrature output should never have both contacts open at the same time.:confused:
 
No, it's pretty standard Crutschow. They have 2 signal wires and a common ground, so the contacts are either open or closed; OO OC CC CO

The problem is that some brands have only one mechanical detent for each full quadrature cycle. The ones I have here are the same and like JimB I got caught out too, I was almost going to send them back as faulty until I put one on the CRO. They do work fine, but the shaft (knob) detent the user feels is always after 4 quad steps so the user cannot set the encoder to full resolution which is a bit ripped off.
 
No, it's pretty standard Crutschow. They have 2 signal wires and a common ground, so the contacts are either open or closed; OO OC CC CO
...........
You are correct. My thinking was off.:eek:
 
Hi JimB,

thank you for the input. I've added those optical ones to my next Farnell order. Not cheap tho' :-(
 
sgergo

One problem I did have with the optical encoders, every so often they appeared to miss a step.
The way I read the encoder was with a PIC.
When the encoder moved it generated an interupt and the PIC read the state of the encoder.
What I noticed was that the rise-time of the signals from the encoder was fairly slow, and I think that the PIC was too fast to see the correct new step code.
So I put in a short delay (5mS if I remember correctly) in the interupt routine before reading the encoder and it has worked perfectly since then.

JimB
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top