Implementing a Hall Effect Rotary Encoder

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
nSomnius
 
Posts: 62
Joined: Wed Mar 21, 2012 4:25 am

Implementing a Hall Effect Rotary Encoder

Post by nSomnius »

I've been dissatisfied with the responsiveness of the rotary encoders I've tried so far, Adafruit's, and others. No amount of code tweaking has helped so far. This leaves me wondering about using a hall effect encoder to eliminate the mechanical switching aspect of the encoder. I found this guy:

http://www.alliedelec.com/search/produc ... n=octopart

Not exactly inexpensive. I looked over the data sheet, which seems sparse to me and am wondering if someone can tell me if it'd be a drop in replacement for the common rotary encoder. The pins suggest it would be but I'm probably missing something. This isn't exactly my day job : ).

User avatar
adafruit_support_mike
 
Posts: 67485
Joined: Thu Feb 11, 2010 2:51 pm

Re: Implementing a Hall Effect Rotary Encoder

Post by adafruit_support_mike »

The datasheet I found for that device says the output is ratiometric to the supply voltage, which makes me think it's an analog signal instead of a digital one. That wouldn't be a drop-in replacement for a standard Gray-code rotary encoder.

What problems are you having with the mechanical types?

nSomnius
 
Posts: 62
Joined: Wed Mar 21, 2012 4:25 am

Re: Implementing a Hall Effect Rotary Encoder

Post by nSomnius »

Fascinating, ratiometric is a new one on me. In the interest of science I bought one and will see what I can about it. Googling results in so few hits regarding hall effect rotary encoder usage.

I'd call the encoder responsiveness 'indecisive'. Jittery at times. As I understand it, changing it's timing can help stabilize it but it was never even 95% hit rate for me. I know this is relative gibberish without the code and circuit to refer to and I thank you for your help. I guess I had hoped to touch on a nerve and find others with the same experience to help pin it down.

User avatar
adafruit_support_mike
 
Posts: 67485
Joined: Thu Feb 11, 2010 2:51 pm

Re: Implementing a Hall Effect Rotary Encoder

Post by adafruit_support_mike »

Do you use a debouncing filter on the pins?

All mechanical switches are noisy.. there's a whole array of microarcing and stick-and-slip interactions during the first few milliseconds of contact. That plays havoc with digital systems that want nice, clean HIGH/LOW transitions.

Here's a suggested filter from a Bourns datasheet that should leave the pulses but eliminate the noise:
filter.png
filter.png (27.61 KiB) Viewed 1783 times

nSomnius
 
Posts: 62
Joined: Wed Mar 21, 2012 4:25 am

Re: Implementing a Hall Effect Rotary Encoder

Post by nSomnius »

I have not been using such a filter. Does this example look about right?:

Image

User avatar
Renate
 
Posts: 291
Joined: Tue Nov 13, 2012 3:21 pm

Re: Implementing a Hall Effect Rotary Encoder

Post by Renate »

nSomnius wrote:Does this example look about right?
Nope, the capacitors are in the wrong place.
Move them outward (left & right) one hole.
You want them from the Arduino inputs to ground.

nSomnius
 
Posts: 62
Joined: Wed Mar 21, 2012 4:25 am

Re: Implementing a Hall Effect Rotary Encoder

Post by nSomnius »

My level of inexpertise is showing : } This is correct then?

Image

User avatar
Renate
 
Posts: 291
Joined: Tue Nov 13, 2012 3:21 pm

Re: Implementing a Hall Effect Rotary Encoder

Post by Renate »

Remove the green jumpers.

These rotary encoders do 24 physical clicks per rotation.
Each click represents a full cycle on each of the biphase outputs.
The travel between two clicks represents 4 input states.

Normally for such a detent encoder you only want to use the 24 coarse positions, not the 96 fine positions.
You want to have the phasing adjusted so that the coarse state changes on the "hill" of the detent.
When the knob is in the valley it is possible for a big of wiggling of the knob to switch between the fine states.

You might want to add a bit of hysteresis so that going back and forth between two fine states does not continually change the coarse state.

nSomnius
 
Posts: 62
Joined: Wed Mar 21, 2012 4:25 am

Re: Implementing a Hall Effect Rotary Encoder

Post by nSomnius »

Thanks very much for the info and corrections. Here's (hopefully) a final version in case it's of use to others.

Image

Locked
Please be positive and constructive with your questions and comments.

Return to “General Project help”