Support for rotary "scroll" trim wheels

er9x is the best known firmware. It has a superb range of features and is well supported by the community. Well worth trying out.
Post Reply
Iksbob
Posts: 121
Joined: Wed Dec 28, 2011 1:06 pm
Country: -

Support for rotary "scroll" trim wheels

Post by Iksbob »

Hey folks.
I would like to replace the clicky toggle trim switch assemblies with scroll/navigation wheels of the variety found on early blackberry handsets. The operation of these wheels is identical to that of a mouse scroll wheel - rotates infinitely in either direction with detents at regular intervals, clicks when pressed (though I don't intend to use the click function). The wheels can be found on digikey for about $5.50 each: link. I ordered 5 (1 to play with, 4 for the installation) which should be waiting for me when I get home from work. The wheels are smaller than a mouse scroll wheel, but I'll post pics when i can actually lay one on the 9X to get a better idea of what i'm getting myself into.
Electrically, the wheel's scroll function uses two contacts and outputs grey code: 00 01 11 10 00 as the wheel is turned. Since the 9X already has 2 uC inputs for each trim rocker switch, it should just be a matter physically installing the wheels and wiring them up in place of each trim switch PCB.

The software code on the other hand is where I'm hoping someone can help out. I could probably write some code to get the effect I'm after, but I know nothing about the existing er9X code and what it expects from any new trim adjusting code.
I expect the current system checks the trim switch inputs at regular intervals and takes action when one is pressed. To support the wheels, it would need to take action when the inputs change (store the previous state to compare with the present one at each input check). When a change is detected, determine which input pair the changed bit is associated with, and figure out which direction the wheel has moved based on the grey code sequence.
One of the more elegant ways I've seen the 'figuring' done is with a 4x4 array. One dimension is the two bits of the stored (old) input value, the other dimension is the two bits of the current value. Stored in each array element is a signed value representing how far the wheel has moved. Not to say this is the only, most efficient or fastest way of accomplishing the task, just one that I saw and appreciated.

So anyway, if someone could add a dozen or two lines of code to support grey code wheels, I think trim wheels will make an awesome hardware mod.

User avatar
MikeB
9x Developer
Posts: 17993
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Support for rotary "scroll" trim wheels

Post by MikeB »

We have a rotary encoder in ersky9x, so grey code is no problem:

Code: Select all

	x = Rotary_inputs ;    // Read new position, bits 0 and 1
	if ( ( Rotary_position & 0x01 ) ^ ( ( x & 0x02) >> 1 ) )
	{
		Rotary_count -= 1 ;
	}
	else
	{
		Rotary_count += 1 ;
	}
	Rotary_position = x ;    // Update current position
Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Support for rotary "scroll" trim wheels

Post by jhsa »

Does that mean we could have a rotary encoder on er9x?? :mrgreen: :mrgreen:
I don't miss one do I?? :mrgreen: :mrgreen: 8-)
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
User avatar
cre8tiveleo
Posts: 1434
Joined: Tue Dec 27, 2011 6:13 pm
Country: -
Location: Ontario,(GTA North)
Contact:

Re: Support for rotary "scroll" trim wheels

Post by cre8tiveleo »

Ooooo.rotary encoder and a grey wheel thingy ma jigger... nice... where the heck am I gonna put that.. along with the 7" daylight touch screen, raspberry pi, 2 rotary encoders... c**p... no room... :mrgrren:
Iksbob
Posts: 121
Joined: Wed Dec 28, 2011 1:06 pm
Country: -

Re: Support for rotary "scroll" trim wheels

Post by Iksbob »

MikeB wrote:

Code: Select all

	x = Rotary_inputs ;    // Read new position, bits 0 and 1
	if((Rotary_position & 0x01)^((x & 0x02) >>1 )) Rotary_count -= 1 ;
	else Rotary_count += 1;
	Rotary_position = x ;    // Update current position
Interesting. So it's [oldFirstBit] XOR [newSecondBit] = -1, assuming you already know the inputs have changed. Time to break out the K-maps. ^_^

[edit]
Yeah, that works if you treat the 0 and +/-2 values as "don't care"s, meaning they should be weeded out before hand. Since you can't tell which way the wheel was moved on increments of 2 steps or more, it would makes sense to me to just count them as 0. If an XOR of the old pair of bits against the new pair results in 0 (no change) or 3 (both changed), that should be a 0-increment case.
[/edit]

Iksbob
Posts: 121
Joined: Wed Dec 28, 2011 1:06 pm
Country: -

Re: Support for rotary "scroll" trim wheels

Post by Iksbob »

They're about the size I expected... If anything, maybe a little too small diameter-wise.
Image
The wheel is just a hair thinner than the stock trim tab.
Image
Iksbob
Posts: 121
Joined: Wed Dec 28, 2011 1:06 pm
Country: -

Re: Support for rotary "scroll" trim wheels

Post by Iksbob »

Ok, I got sidetracked by other projects, but remembered a related idea I had while rummaging through a bin of parts:
Image
4-way navigation buttons + wheel and center select. $6.42 on mouser.
It requires clipping out the plastic X and sanding the hole ever so slightly (~.2 mm). Letting it sit against the back of the '9X front panel makes it stand out slightly from the face. If the existing screw hole/standoff posts were used to brace a PCB, the raised lip of the directional switches would be almost flush with the panel, making the whole thing a slight bowl in the panel (good for using the wheel).

Is 5 wheels too much? ^_^;
User avatar
MikeB
9x Developer
Posts: 17993
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Support for rotary "scroll" trim wheels

Post by MikeB »

Now that look nice, for ersky9x as well. I think I might get 1 (or three!). 5 wheels may be a bit much, but since I'm looking at the TelemetrEZ board, this might support some rotary encoders. That will be a follow up to getting it's basic operation going though.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Support for rotary "scroll" trim wheels

Post by jhsa »

for er9x?? hhmmm, nice.. ;) :D
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
User avatar
Kilrah
Posts: 11109
Joined: Sat Feb 18, 2012 6:56 pm
Country: Switzerland

Re: Support for rotary "scroll" trim wheels

Post by Kilrah »

I like!
iwik
Posts: 115
Joined: Fri Feb 17, 2012 6:08 pm
Country: -
Location: NEW ZEALAND

Re: Support for rotary "scroll" trim wheels

Post by iwik »

Me too.
Clivew
Posts: 338
Joined: Tue Dec 27, 2011 8:08 pm
Country: -
Location: Stroud, Glos, England

Re: Support for rotary "scroll" trim wheels

Post by Clivew »

Looks good!
Farnell have them in the UK :P
http://uk.farnell.com/jsp/search/produc ... ku=1908271

Post Reply

Return to “er9x”