Author Topic: Progressive resolution for a rotary encoder  (Read 14311 times)

0 Members and 2 Guests are viewing this topic.

Offline ataradovTopic starter

  • Super Contributor
  • ***
  • Posts: 12495
  • Country: us
    • Personal site
Progressive resolution for a rotary encoder
« on: April 13, 2017, 12:09:11 am »
I have a project in mind, where I would need to adjust output frequency in the range 1 Hz - 100 MHz. The input will be done using a standard rotary encoder.

Is there a "standard" algorithm for progressive change of step resolution with knob velocity/acceleration? I'm trying to figure out if there are standard rule of thumb parameters for an algorithm like this? Something that feels good and natural to an average human being, but not to twitchy or takes thousands of turns to sweep the full range.
Alex
 

Offline BrianHG

  • Super Contributor
  • ***
  • Posts: 8808
  • Country: ca
    • LinkedIn
Re: Progressive resolution for a rotary encoder
« Reply #1 on: April 13, 2017, 01:07:22 am »
There are a few pointers here posted in a similar thread:
https://www.eevblog.com/forum/microcontrollers/rotary-encoder-speed-control-is-encoder-turning-fast-update-the-counter-10/
You can use my example in the middle of the thread & multiply the acceleration factor to what you like.
There is also someone else's library posted at the end of the thread.

Offline BravoV

  • Super Contributor
  • ***
  • Posts: 7572
  • Country: 00
  • +++ ATH1
Re: Progressive resolution for a rotary encoder
« Reply #2 on: April 13, 2017, 01:21:59 am »
Subbed, Alex, please share the progress and how this ended up will you ?

Offline BravoV

  • Super Contributor
  • ***
  • Posts: 7572
  • Country: 00
  • +++ ATH1
Re: Progressive resolution for a rotary encoder
« Reply #3 on: April 13, 2017, 01:39:16 am »
I do have some thought, although its still just an idea, as I got this idea from TTi psu, for the voltage adjustment its linear, while for current, it uses logarithm pot which is quite useful when cranking up the value.

So my thought is to use just a single encoder but has two modes, linear and logarithm, and both modes can be toggled using the encoder push button, maybe an indicator like a led to indicate which mode is currently activated.

In linear, its obvious to give finer resolution, user still can turn it slow or fast with constant linearly change that feels natural. But when user want to change much wider range with much less angular turn at the knob, here the logarithm mode comes in, also with added velocity in the log mode, this really improves the speed for user to reach the nearby wanted value, and then switch to linear mode back to fine tune it.

Of course, velocity also can be used in linear mode, with faster angular turn, the higher multiplier is used to increment the counter.

Just an idea, take it with a grain of salt.

Offline BrianHG

  • Super Contributor
  • ***
  • Posts: 8808
  • Country: ca
    • LinkedIn
Re: Progressive resolution for a rotary encoder
« Reply #4 on: April 13, 2017, 02:07:01 am »
Ok, do you have your example code for the linear acceleration.

With my original code, I scan the encode inputs by a fixed time interval, say 200 samples a second, which allows the generation of a timer 'time_between_each_pulse', whose count is limited to 'Max_time' (I use 100), of the encoder.

Basically, every scan of the encoder input, I increment 'time_between_each_pulse' if it is less than 'Max_time'
If the encoder moved since the last scan, I clear 'time_between_each_pulse'.

This factor generates the acceleration factor 'Speed_factor' which sets the step size.
Speed_factor = Max_time + 1 - (time_between_each_pulse);

Next, depending on the direction of the encoder, ADD, or SUBTRACT 'Speed_factor' to your user set counter.

Now, if you want an exponential acceleration instead, all you would have to do is ADD, or SUBTRACT:
(Speed_factor * your_choice) ^2.     or
Speed_factor^2 * your_choice         or
((Speed_factor-1) * your_choice) ^2 + 1     ... This one allows for an increment and decrement of exactly 1 at the slowest speed

(Note that the 'your_choice' might be something like 0.5 since 100^2, at 10000 steps per count, may be too big, or, you can change that to 10 making the max speed 1000000 per step...)

You can also change 'Max_time' to something like 10.  This will give you a very slow linear acceleration, you can call this your 'Log' mode, and use the exponential mode for that wide speed swing.

I hope this helps...

Offline sleemanj

  • Super Contributor
  • ***
  • Posts: 3176
  • Country: nz
  • Professional tightwad.
    • The electronics hobby components I sell.
Re: Progressive resolution for a rotary encoder
« Reply #5 on: April 13, 2017, 05:47:12 am »
Don't forget about the physical aspect - a big knob is better than a small knob.  For a large range you want to be able to "jog dial", if you have to grab the knob between your fingers to manipulate it, it's too slow to get it up to where you want it.  30mm is barely adequate, 40mm much better.


~~~
EEVBlog Members - get yourself 10% discount off all my electronic components for sale just use the Buy Direct links and use Coupon Code "eevblog" during checkout.  Shipping from New Zealand, international orders welcome :-)
 

Offline ataradovTopic starter

  • Super Contributor
  • ***
  • Posts: 12495
  • Country: us
    • Personal site
Re: Progressive resolution for a rotary encoder
« Reply #6 on: April 13, 2017, 05:50:42 am »
Don't forget about the physical aspect - a big knob is better than a small knob.
Well, the knob will be a typical plastic stuff from eBay. I'm not to happy with detented rotary encoders I have on hand, so I'll order some of different types to see what feels best.

Thanks, everyone, I got some ideas, and I will be trying this stuff out over the weekend.
Alex
 

Offline BravoV

  • Super Contributor
  • ***
  • Posts: 7572
  • Country: 00
  • +++ ATH1
Re: Progressive resolution for a rotary encoder
« Reply #7 on: April 13, 2017, 06:01:24 am »
Don't forget about the physical aspect - a big knob is better than a small knob.  For a large range you want to be able to "jog dial", if you have to grab the knob between your fingers to manipulate it, it's too slow to get it up to where you want it.  30mm is barely adequate, 40mm much better.

+1 , I love knob like this when it comes to rotary encoder that has the finger hole, as swirling single finger at that hole is really effective at high speed turn.


Offline David Hess

  • Super Contributor
  • ***
  • Posts: 19251
  • Country: us
  • DavidH
Re: Progressive resolution for a rotary encoder
« Reply #8 on: April 13, 2017, 12:17:53 pm »
Another system I have seen uses the encoder to simulate coarse and fine controls.  There is a fine "window" of so many degrees which gets dragged by coarse operation.  So the encoder is coarse while turning in one direction and when reversed, there is a limited fine window and once past that it becomes coarse going in the opposite direction.  No velocity calculations need to be made for this to work.

It may seem to be worse than true acceleration however it is a lot easier to get right.
 

Offline PointyOintment

  • Frequent Contributor
  • **
  • Posts: 327
  • Country: ca
  • ↑ I scanned my face
Re: Progressive resolution for a rotary encoder
« Reply #9 on: April 14, 2017, 04:53:42 am »
Another system I have seen uses the encoder to simulate coarse and fine controls.  There is a fine "window" of so many degrees which gets dragged by coarse operation.  So the encoder is coarse while turning in one direction and when reversed, there is a limited fine window and once past that it becomes coarse going in the opposite direction.  No velocity calculations need to be made for this to work.

It may seem to be worse than true acceleration however it is a lot easier to get right.

That sounds equivalent to mounting a low-value, low-friction pot onto the shaft of a high-value, high-friction pot, and putting the knob on the shaft of the low-value pot. I usually don't like hysteresis/backlash in UIs, but that particular example of it might actually be okay.
I refuse to use AD's LTspice or any other "free" software whose license agreement prohibits benchmarking it (which implies it's really bad) or publicly disclosing the existence of the agreement. Fortunately, I haven't agreed to that one, and those terms are public already.
 

Offline ataradovTopic starter

  • Super Contributor
  • ***
  • Posts: 12495
  • Country: us
    • Personal site
Re: Progressive resolution for a rotary encoder
« Reply #10 on: April 14, 2017, 05:01:03 am »
Well, I tried some of the things proposed here, and some other stuff I managed to google.

And I came to a firm conclusion that encoder is just not the right solution here. This is why professional equipment makes you select the digit (order of magnitude) you want to change.

I will simply use 2 buttons, it sounds more manageable.
Alex
 

Offline David Hess

  • Super Contributor
  • ***
  • Posts: 19251
  • Country: us
  • DavidH
Re: Progressive resolution for a rotary encoder
« Reply #11 on: April 14, 2017, 10:19:15 am »
Another system I have seen uses the encoder to simulate coarse and fine controls.  There is a fine "window" of so many degrees which gets dragged by coarse operation.  So the encoder is coarse while turning in one direction and when reversed, there is a limited fine window and once past that it becomes coarse going in the opposite direction.  No velocity calculations need to be made for this to work.

It may seem to be worse than true acceleration however it is a lot easier to get right.

That sounds equivalent to mounting a low-value, low-friction pot onto the shaft of a high-value, high-friction pot, and putting the knob on the shaft of the low-value pot. I usually don't like hysteresis/backlash in UIs, but that particular example of it might actually be okay.

That is a really good description.

One place where this method is needed is with absolute single turn encoders.  Otherwise turning the encoder fast one way and then slow the other would result in wandering out of range.

Tektronix used this method on the 4 channel 22xx and 24xx series analog oscilloscopes.
 

Offline mrflibble

  • Super Contributor
  • ***
  • Posts: 2051
  • Country: nl
Re: Progressive resolution for a rotary encoder
« Reply #12 on: April 14, 2017, 12:26:43 pm »
Don't forget about the physical aspect - a big knob is better than a small knob.  For a large range you want to be able to "jog dial", if you have to grab the knob between your fingers to manipulate it, it's too slow to get it up to where you want it.  30mm is barely adequate, 40mm much better.
Agreed. Those dials are much more pleasant to work with than those fiddly small diameter knobs. Just for reference I measured the jog dial on my HP scope ... 37 mm diameter. Incidentally, does anyone know a cheap source for say 10 dials of around 40 mm diameter? The prices on ebay I could find were a bit silly...

As for the OP: also looking for a suitable library. Ideally one that used time stamps as opposed to fixed interval sampling. For the dial jog readout the accuracy is probably not that demanding, so the fixed time interval sampling that most code out there uses is probably okay. But for motion estimation throwing away all that precious information by using fixed interval sampling is a bit ...  :-\
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 10091
  • Country: us
Re: Progressive resolution for a rotary encoder
« Reply #13 on: April 14, 2017, 03:39:37 pm »
Well, I tried some of the things proposed here, and some other stuff I managed to google.

And I came to a firm conclusion that encoder is just not the right solution here. This is why professional equipment makes you select the digit (order of magnitude) you want to change.

I will simply use 2 buttons, it sounds more manageable.

I figured it would work out like this because the range is so high.  You want to change by as much as 10s of MHz per click down to 1s of Hz per click.  Selecting the digit doesn't  have to be ugly if you use the push button on the encoder.  I'm not sure how you display which decade you are changing but it should be manageable on the display.  Maybe you begin a sequence by pressing the button and it starts the MSD blinking.  Successive presses move the digit to the right.  After some delta T, the blinking goes away because it would be distracting.

Maybe when no prior adjustment has been made lately, the encoder itself moves the digit back and forth.  The pushbutton locks it in and successive encoder operations increment or decrement the count from that digit.

Something like that...
 

Online ebastler

  • Super Contributor
  • ***
  • Posts: 7913
  • Country: de
Re: Progressive resolution for a rotary encoder
« Reply #14 on: April 15, 2017, 07:15:45 am »
Well, I tried some of the things proposed here, and some other stuff I managed to google.

And I came to a firm conclusion that encoder is just not the right solution here. This is why professional equipment makes you select the digit (order of magnitude) you want to change.

I will simply use 2 buttons, it sounds more manageable.

A row of thumbwheel BCD switches, one for each digit, would be my personal favorite for fast entry and adjustment. But a bit outdated these days... Assuming that your device has a display for the selected frequency anyway, couldn't you use a small touchscreen which simulates a row of thumbwheels?

http://www.surplussales.com/Images/Switches/Thumbwheel/swb-8872-501-6_1_lg.jpg
 

Offline ataradovTopic starter

  • Super Contributor
  • ***
  • Posts: 12495
  • Country: us
    • Personal site
Re: Progressive resolution for a rotary encoder
« Reply #15 on: April 15, 2017, 07:20:22 am »
Assuming that your device has a display for the selected frequency anyway
Nope. It was not going to have any indication except for one way UART.

Now it was "upgraded" to 0.91" OLED display.  No chance for touch screen.
Alex
 

Online ebastler

  • Super Contributor
  • ***
  • Posts: 7913
  • Country: de
Re: Progressive resolution for a rotary encoder
« Reply #16 on: April 15, 2017, 07:40:46 am »
Now it was "upgraded" to 0.91" OLED display.  No chance for touch screen.

Sounds like a cute display!
Never mind; the touchscreen thumbwheel probably would have meant too much development effort anyway. Hard to justify, unless frequency entry is the main thing the user keeps doing...

Maybe a little joystick? Push left/right to select digit, up/down to change value?
« Last Edit: April 15, 2017, 07:42:39 am by ebastler »
 

Offline ratio

  • Regular Contributor
  • *
  • Posts: 59
  • Country: us
Re: Progressive resolution for a rotary encoder
« Reply #17 on: April 15, 2017, 07:12:11 pm »
I've used in the past a knob, spring return to center, the further you turned it from the center the faster it moved. IOW, you're changing the rate-of-change with the knob. As long as the span is wide enough, you could have it stepping by Hz/sec to GHz/sec, up or down.
 

Online PA0PBZ

  • Super Contributor
  • ***
  • Posts: 5512
  • Country: nl
Re: Progressive resolution for a rotary encoder
« Reply #18 on: April 15, 2017, 07:30:56 pm »
Thinking about the select digit thing I'm wondering if you could select more than one digit. I don't think I've ever seen it but how about selecting the 3 MHz, KHz or Hz digits?

Keyboard error: Press F1 to continue.
 

Offline ataradovTopic starter

  • Super Contributor
  • ***
  • Posts: 12495
  • Country: us
    • Personal site
Re: Progressive resolution for a rotary encoder
« Reply #19 on: April 15, 2017, 08:19:40 pm »
I don't think I've ever seen it but how about selecting the 3 MHz, KHz or Hz digits?
Siglent signal generators let you do basically this. You select the lowest digit and then all other digits change in increments of the selected position.

It works, but I would not say it is the best solution.
Alex
 

Offline timb

  • Super Contributor
  • ***
  • Posts: 2536
  • Country: us
  • Pretentiously Posting Polysyllabic Prose
    • timb.us
Re: Progressive resolution for a rotary encoder
« Reply #20 on: April 15, 2017, 09:12:56 pm »
Don't forget about the physical aspect - a big knob is better than a small knob.  For a large range you want to be able to "jog dial", if you have to grab the knob between your fingers to manipulate it, it's too slow to get it up to where you want it.  30mm is barely adequate, 40mm much better.

+1 , I love knob like this when it comes to rotary encoder that has the finger hole, as swirling single finger at that hole is really effective at high speed turn.



I wish I could find a reasonably priced source of these. The only ones I can find on Digi-Key are apparently made out of an alloy of 24k gold, platinum and titanium (with a tellurium plating for low noise). At least I assume they are based on the price! (Were talking $20-$50 each!)

There has to be an inexpensive source for them. They don't need to be machined aluminum (which the ones on Digi-Key actually are), plastic would be fine... I just don't get it.
Any sufficiently advanced technology is indistinguishable from magic; e.g., Cheez Whiz, Hot Dogs and RF.
 

Offline Nusa

  • Super Contributor
  • ***
  • Posts: 2452
  • Country: us
Re: Progressive resolution for a rotary encoder
« Reply #21 on: April 15, 2017, 09:31:40 pm »
Don't forget about the physical aspect - a big knob is better than a small knob.  For a large range you want to be able to "jog dial", if you have to grab the knob between your fingers to manipulate it, it's too slow to get it up to where you want it.  30mm is barely adequate, 40mm much better.

+1 , I love knob like this when it comes to rotary encoder that has the finger hole, as swirling single finger at that hole is really effective at high speed turn.



I wish I could find a reasonably priced source of these. The only ones I can find on Digi-Key are apparently made out of an alloy of 24k gold, platinum and titanium (with a tellurium plating for low noise). At least I assume they are based on the price! (Were talking $20-$50 each!)

There has to be an inexpensive source for them. They don't need to be machined aluminum (which the ones on Digi-Key actually are), plastic would be fine... I just don't get it.

https://www.aliexpress.com/item/32-13mm-Audio-Multimedia-Speakers-Aluminum-Knob-Knob-Guitar-Knob/32744452805.html

https://www.aliexpress.com/item/High-Quality-Knob-Audio-Volume-Control-Knob-Potentiometer-Knob-40x17mm-Round-6MM-Silver/32748541803.html

There's probably more. I only spent a minute looking.
 

Offline prasimix

  • Supporter
  • ****
  • Posts: 2101
  • Country: hr
    • EEZ
Re: Progressive resolution for a rotary encoder
« Reply #22 on: April 15, 2017, 09:32:07 pm »
Maybe you can try TME (they are shipping worldwide) CLIFF CL71660A that looks similar to that on the picture. I still have one and can say that is pretty good.

Offline timb

  • Super Contributor
  • ***
  • Posts: 2536
  • Country: us
  • Pretentiously Posting Polysyllabic Prose
    • timb.us
Re: Progressive resolution for a rotary encoder
« Reply #23 on: April 15, 2017, 09:33:44 pm »
Don't forget about the physical aspect - a big knob is better than a small knob.  For a large range you want to be able to "jog dial", if you have to grab the knob between your fingers to manipulate it, it's too slow to get it up to where you want it.  30mm is barely adequate, 40mm much better.

+1 , I love knob like this when it comes to rotary encoder that has the finger hole, as swirling single finger at that hole is really effective at high speed turn.



I wish I could find a reasonably priced source of these. The only ones I can find on Digi-Key are apparently made out of an alloy of 24k gold, platinum and titanium (with a tellurium plating for low noise). At least I assume they are based on the price! (Were talking $20-$50 each!)

There has to be an inexpensive source for them. They don't need to be machined aluminum (which the ones on Digi-Key actually are), plastic would be fine... I just don't get it.

https://www.aliexpress.com/item/32-13mm-Audio-Multimedia-Speakers-Aluminum-Knob-Knob-Guitar-Knob/32744452805.html

https://www.aliexpress.com/item/High-Quality-Knob-Audio-Volume-Control-Knob-Potentiometer-Knob-40x17mm-Round-6MM-Silver/32748541803.html

There's probably more. I only spent a minute looking.

Those are still really expensive. $4 and $7! Where are the sub-$1 plastic ones?
Any sufficiently advanced technology is indistinguishable from magic; e.g., Cheez Whiz, Hot Dogs and RF.
 

Offline timb

  • Super Contributor
  • ***
  • Posts: 2536
  • Country: us
  • Pretentiously Posting Polysyllabic Prose
    • timb.us
Re: Progressive resolution for a rotary encoder
« Reply #24 on: April 15, 2017, 09:34:47 pm »
Maybe you can try TME (they are shipping worldwide) CLIFF CL71660A that looks similar to that on the picture. I still have one and can say that is pretty good.

Hey, that's something. Thanks!
Any sufficiently advanced technology is indistinguishable from magic; e.g., Cheez Whiz, Hot Dogs and RF.
 
The following users thanked this post: SimonD


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf

 

- - -
-->