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 not working as expected...

Status
Not open for further replies.

ignisuti

New Member
I purchased a couple quadrature incremental rotatory encoders (ACZ16NBR1E-20KQA1-12C) and they're not responding as I had expected.

To test them, I connected phases A & B to 5V through LEDs and Common to ground. Yes, I know it'll damage my LEDs, but I just wanted to see the encoder work for the first time. I expected to see each LED light up 2 times for every 4 positions of the dial.

Instead, I see very erratic behavior. Typically the LED only lights up half-way through a position change. Sometimes the LED will stay on after I reached a position, but it occurs much less often than 50% of the time.

This is my first encoder experience. Please help!
 

ericgibbs

Well-Known Member
Most Helpful Member
I purchased a couple quadrature incremental rotatory encoders (ACZ16NBR1E-20KQA1-12C) and they're not responding as I had expected.

To test them, I connected phases A & B to 5V through LEDs and Common to ground. Yes, I know it'll damage my LEDs, but I just wanted to see the encoder work for the first time. I expected to see each LED light up 2 times for every 4 positions of the dial.

Instead, I see very erratic behavior. Typically the LED only lights up half-way through a position change. Sometimes the LED will stay on after I reached a position, but it occurs much less often than 50% of the time.

This is my first encoder experience. Please help!

hi,
Have you a sketch showing how you have wired the encoder.?

Using a 5v supply, you MUST use a series resistor to limit the current thru the LED and switch contacts!

EDIT: look at this image
 

Attachments

  • AAesp02.gif
    AAesp02.gif
    7 KB · Views: 1,336
Last edited:

ignisuti

New Member
I've just connected them like this as a temporary setup so that I can verify the operation of the rotary encoder. 5V through the LED will GREATLY reduce the LEDs life, but it should last long enough for me to finish this quick test. As for the contacts of the switch, it should handle 5V just fine.

I don't have a schematic, but it's simple enough to explain. Pins A & B are connected to 5V through an LED and the common pin on the encoder is connected to ground. So as the quadrature encoder moves 4 positions, I expect to see each LED light up twice.

EDIT,
Eric, I see the diagram you posted. My setup is just like that minus the resistors.
 
Last edited:

ericgibbs

Well-Known Member
Most Helpful Member
I've just connected them like this as a temporary setup so that I can verify the operation of the rotary encoder. 5V through the LED will GREATLY reduce the LEDs life, but it should last long enough for me to finish this quick test. As for the contacts of the switch, it should handle 5V just fine.

I don't have a schematic, but it's simple enough to explain. Pins A & B are connected to 5V through an LED and the common pin on the encoder is connected to ground. So as the quadrature encoder moves 4 positions, I expect to see each LED light up twice.

hi,
OK.
Its NOT the 5V thats concerns me, its the current thru the encoder contacts!
 
Last edited:

ericgibbs

Well-Known Member
Most Helpful Member
So, are you saying that my setup is invalid for verifying that the rotary encoder works the way I expect it to? If so, please explain.

Have you looked at that image I posted.?

The switching pattern of the encoder is taken from the datasheet of the type you have posted. I added the small diagram how it should be connected.

Is your circuit the same as the image, also be sure that you have correctly identified the 'C' pin.
 

ignisuti

New Member
Have you looked at that image I posted.?

The switching pattern of the encoder is taken from the datasheet of the type you have posted. I added the small diagram how it should be connected.

Is your circuit the same as the image, also be sure that you have correctly identified the 'C' pin.

Yes, my setup is the same minus the resistors. I would have to disagree if you argue that the resistors are critical for me to see what I'm trying to see.

Now, you may be onto something by questioning the C pin. I'm very confused if the C pin is on the left or right side. The datasheet shows the pinout with the switch positioned upside down which I find very odd. Eitherway, I've tested with Common being on both left and right and the results seemed the same.

Hmmm.... Maybe the datasheet is completely wrong and the Common is in the middle!? I'll have to test and report back...
 

ericgibbs

Well-Known Member
Most Helpful Member
Yes, my setup is the same minus the resistors. I would have to disagree if you argue that the resistors are critical for me to see what I'm trying to see.
I'll have to test and report back...

If you read my posts I have not said that the fact you are not using a current limiting resistor will stop seeing what you are trying to see.!

What I keep repeating is, without a limiting resistor and the fact that you are using a 5v supply, if an LED fails short circuit you will most likely damage the encoder contacts.

I am puzzled why you dont want to fit a simple resistor in series with each LED, say 470R.

Perhaps some other member will help you with this problem.
 
Last edited:

ignisuti

New Member
Resistors are fine. I just made the decision that I'd rather throw away $0.20 worth of LED's versus spend the extra 30 seconds to add resistors for my quick one-time test.

I don't see how 5V would damage these contacts. They're rated for 5V.
 

ericgibbs

Well-Known Member
Most Helpful Member
Resistors are fine. I just made the decision that I'd rather throw away $0.20 worth of LED's versus spend the extra 30 seconds to add resistors for my quick one-time test.

I don't see how 5V would damage these contacts. They're rated for 5V.

Your NOT listening, its NOT the voltage thats the problem its the possible high current!
 

be80be

Well-Known Member
There probably not meant handle more then 10ma of power
He just knocking off part of his 100,000 cycles maybe have 10 left.
Rated for 5V don't mean it can can sink a amp
 

ignisuti

New Member
I think I had the pinout right. Maybe I did do some damage as my results just aren't turning out right.

I added the resistors as suggested and am now seeing both lights light up with EVERY position change. They only light up during the transition and don't stay lit afterwards. Now I did notice that one light #1 lights up a moment before light #2 while spinning clockwise and light #2 lights up a moment before light #1 while spinning counter-clockwise.

Although I could write some code to handle this situation, I don't think it's the expected behavior. Am I wrong?

I ordered a 2nd encoder just incase, but can't seem to find it now! :mad:
 

ericgibbs

Well-Known Member
Most Helpful Member
hi,
Look at this image to see the sequence you should observe.

The design of the quadrature signal phasing is so that its possible to determine which way the shaft is being turned and by how many indentations. [steps]

Quadrature of the two signals means they are shifted in phase by 90deg relative to each other.

The 'detent' stability points on the signals are where the mechanical indents in the switch mechanism are located,, ie: at rest.

A point to remember is that if switch contacts are subject to switching currents higher than the maximum rated value the contacts can be damaged.
This damage will cause intermittent closures creating multiple signals to the external equipment.
 

Attachments

  • AAesp02.gif
    AAesp02.gif
    9.6 KB · Views: 628

ignisuti

New Member
Eric, Thanks. I found your post very helpful.

This is consistent with my previous understanding. So, looks like I must have damaged the encoder. :(

Now if I could only find the backup encoder that I ordered, or I might have a downtime of a few days... :p
 

ignisuti

New Member
Status update:
I had to order some more encoders to test if I damaged my previous one. I wired the new on up per you Eric's diagram. However, my results are the same.

I'm now seeing both LEDs light up briefly 'during' each position change. The order that they light up depends on the direction of travel. Again, I can write software to watch for which LED lights up first, but I'm still curious why my results are different than expected...

FYI: I also purchased a different type of rotary encoder for the purposes of testing and it's acting the same.

Anymore thoughts...?
 

ericgibbs

Well-Known Member
Most Helpful Member
Status update:
I had to order some more encoders to test if I damaged my previous one. I wired the new on up per you Eric's diagram. However, my results are the same.

I'm now seeing both LEDs light up briefly 'during' each position change. The order that they light up depends on the direction of travel. Again, I can write software to watch for which LED lights up first, but I'm still curious why my results are different than expected...

FYI: I also purchased a different type of rotary encoder for the purposes of testing and it's acting the same.

Anymore thoughts...?

Hi,
Been doing a little checking thru various encoder types.

You may have this type:
Contacting encoders often have detents that 'click' through an entire A/B cycle per detent

That is the mechanical indent is positioned to give only a transient switching action.

I found this link that may help.
Google Image Result for https://www.qsl.net/pa3ckr/bascom%20and%20avr/interrupts/rotary-encoder.gif

EDIT:
Relooking at your original datasheet, its misleading, it shows the detent numbers misaligned which suggests the A/B cycle is at rest.

Modified image.
 

Attachments

  • AAesp02.gif
    AAesp02.gif
    7 KB · Views: 374
Last edited:

ignisuti

New Member
You have to debounce it he seeing switch bounce

Contact bounce would be if my MCU saw several hits. This isn't the case as I havn't made it that far yet. I just built a VERY simple test circuit that lights an LED through a 390 ohm resitor. Each phase (A & B) has it's own LED.

I'm seeing both LEDs light up but only as I move from on detent location to the next. They turn off once I reach the resting point. One phase always lights up before the other, based on the direction of rotation.
 

ignisuti

New Member
Hi,
Been doing a little checking thru various encoder types.

You may have this type:
Contacting encoders often have detents that 'click' through an entire A/B cycle per detent

That is the mechanical indent is positioned to give only a transient switching action.

EDIT:
Relooking at your original datasheet, its misleading, it shows the detent numbers misaligned which suggests the A/B cycle is at rest.

Modified image.

That is a great find, but I still don't think it accounts for what I'm seeing... :(
If I had this other type of encoder, I'd see various states as I rotate. But what I see now with my current configuration is consistent with each rotation.
 
Status
Not open for further replies.

Latest threads

EE World Online Articles

Loading
Top