[sdiy] dave smith *instruments*

Tom Wiltshire tom at electricdruid.net
Mon Feb 1 20:39:03 CET 2010


I completely agree that letting the LCD get left behind is preferable  
to ignoring the encoder. But that means that you get a meaningless  
blur when you spin the encoder fast, and as we've seen, sometimes  
your customers will post messages to online mail lists about this ;)

There's one other issue with encoders, which is that (detents or not)  
it is very difficult to get enough resolution out of the movement you  
can do in one turn. Whereas with a (decent quality) pot I can get  
somewhere between 8 and 10-bit resolution (e.g. 250-1000 separate  
readings) fairly reliably, I can't get any like such a high number  
from 300 degrees of travel on a rotary encoder. Even if I do it the  
hard way and use every single phase transition to give me 4  
increments per detent - typical encoder has 20-30 detents, times four  
equals around 100 positions. And that's in 360 degrees.
The result is that you're left twiddling the knob for ages, which  
just makes you think that these modern digital interfaces aren't any  
good and why don't they do it like the old days?!
I've experimented with velocity-dependent increments (e.g. the faster  
you turn the encoder, the more the values go up) and whilst this  
allows you to get to big values quicker, I never managed to find a  
response curve that felt at all natural. Mostly it felt like it was  
either crawling along or running away from you. Trying to reach a  
specific value is very difficult with such a system. I've  
experimented with a pot, an ADC channel on a PIC, and an LCD, and  
found I can turn the pot to a specific value between 0 and 1023 and  
get it exactly right very quickly. I haven't managed such a thing  
with an encoder in a way that I'm happy with at all.

This is the answer (I reckon) to another question asked in the  
original mail: Why did DSI release a "Pots edition"?

T.



On 1 Feb 2010, at 19:02, Antti Huovilainen wrote:

> On Mon, 1 Feb 2010, Eric Brombaugh wrote:
>
>> That's a good way to go if you want high resolution. A somewhat  
>> simpler approach with less resolution is to hook one of the  
>> encoder phases to an IRQ. When you get an interrupt, debounce and  
>> check if rising or falling. If rising, the state of the other  
>> phase indicates if you need to increment or decrement the  
>> controlled parameter. Exit without update if falling.
>
> I'd be very vary of ever hooking an unconditioned switch to IRQ  
> pin. The beauty of the timer method is that you don't need any  
> debouncing as long as you consider the properties of gray code  
> (which encoders use).
> In a typical cheap encoder, you have four possible states as follows:
>
> 0 A b
> 1 A B
> 2 a B
> 3 a b
>
> Only a single bit at a time will change state whenever the encoder  
> is rotated. Therefore only transitions between adjacent states (and  
> 0 <-> 3) are valid. If you then encounter an invalid transition,  
> you know it's a glitch and you can keep ignoring changes until  
> you've found one or two sequential valid transitions again.
>
>> If you're using encoders with detents this yields one pulse per  
>> detent which is probably all you really want. If you've got  
>> continuous encoders then Antti's suggestion is probably the better  
>> approach since it allows the rotation to stop anywhere and still  
>> take advantage of every transition on both phases.
>
> I have detented encoders and still use my method as it's inherently  
> glitch-safe (meaning a glitch will only mean missing one or two  
> ticks but never outright corruption). An extra bonus is that you  
> can switch to undetented encoders without needing to change the logic.
>
> Antti
>
> "No boom today. Boom tomorrow. There's always a boom tomorrow"
>   -- Lt. Cmdr. Ivanova
> _______________________________________________
> Synth-diy mailing list
> Synth-diy at dropmix.xs4all.nl
> http://dropmix.xs4all.nl/mailman/listinfo/synth-diy




More information about the Synth-diy mailing list