Spinner controller (Rotary encoder)

Topics regarding the Uzebox hardware/AVCore/BaseBoard (i.e: PCB, resistors, connectors, part list, schematics, hardware issues, etc.) should go here.
User avatar
uze6666
Site Admin
Posts: 4487
Joined: Tue Aug 12, 2008 9:13 pm
Location: Montreal, Canada
Contact:

Spinner controller (Rotary encoder)

Post by uze6666 » Mon Jun 22, 2015 8:14 pm

I'm opening this thread to discuss the spinner controller discussed in a few other topics.

After more reading, quadrature encoders are much simpler than it sounds. I've started to look for some with a decent resolution. Sees most cheap one are all mechanical with under 20 steps. I would think that something at least 200 would be required for smooth play. I've ordered some rotary encoders on AliExpress advertised at 400 pulses for 12$. Though I think I went overboard since they are actually quite big! Those are optical though, so better quality and longer life. I've also ordered a mechanical one at 36 steps from digikey.

User avatar
kivan117
Posts: 72
Joined: Sat Mar 14, 2015 5:43 am

Re: Spinner controller (Rotary encoder)

Post by kivan117 » Mon Jun 22, 2015 9:01 pm

Awesome. In addition to the rotary encoder taking the place of the d-pad, will the normal remaining buttons be used? Most games that would benefit from the encoder also use a limited number of buttons.

CunningFellow
Posts: 1196
Joined: Mon Feb 11, 2013 8:08 am
Location: Brisbane, Australia

Re: Spinner controller (Rotary encoder)

Post by CunningFellow » Mon Jun 22, 2015 10:10 pm

The big reason you NEED optical not mechanincal is because the mechanical ones have drag. You are meant to be able to SPIN a tempest control knob and it just keeps spinning.

Old mechano-optical mice are the easiest source for all the electronics you need on the cheap for it.

If you want the more "ready made" solution then yes optical encoders meant for the back of servo motors are your answer. That is probably what you got from Ali Express.

The ones I have/use for the back of motors are 500 slot discs which equates to 2000 transitions per revolution.

You can never have too much resolution. The ATTiny45 in the

UZE<->ATTiny<->Encoder_buttons

setup can just scale it back to what ever you want. If you want to experiment with different chip then the ATXmegae5 has hardware quadrature encoder built in (for $2.50 for the chip)

User avatar
uze6666
Site Admin
Posts: 4487
Joined: Tue Aug 12, 2008 9:13 pm
Location: Montreal, Canada
Contact:

Re: Spinner controller (Rotary encoder)

Post by uze6666 » Tue Jun 23, 2015 12:52 am

Seems the 400 steps will be the one then. The actual decoding seems simple enough for attiny and there's arduino code already out there to get started.

The actual design of the controller bugs me a bit since unless I make it bulky like a arcade style lap controller, you can't have many buttons. Is two buttons enough to play all spinner games?

CunningFellow
Posts: 1196
Joined: Mon Feb 11, 2013 8:08 am
Location: Brisbane, Australia

Re: Spinner controller (Rotary encoder)

Post by CunningFellow » Sun Jun 28, 2015 10:51 pm

The easiest way I think to decode quadrature is to have a timer interrupt happening FASTER than the fastest rate you expect the signals to change.

Then have the two A/B signals and the two LAST-A/B (<<2 or'd) together for 16 states. Have a 16 entry lookup that has -1,0 or 1 as the result. Add that to a counter.


two buttons should be OK.

The only variant I think is the push/pull controller used in the "discs of tron" game. Does anyone feel like porting that to the Uzebox?

CunningFellow
Posts: 1196
Joined: Mon Feb 11, 2013 8:08 am
Location: Brisbane, Australia

Re: Spinner controller (Rotary encoder)

Post by CunningFellow » Sun Nov 01, 2015 12:45 am

OK - now I have been feeling better again for a little while - I am trying to get as much done as possible.

What would be the prefered way to interface the spinner controller?

Should I just use the SNES mouse protocol ?

I will use an ATTiny2313 just because that is what I have around that is more than 4 pins. Code should be portable to the cheaper Tiny24.

User avatar
uze6666
Site Admin
Posts: 4487
Joined: Tue Aug 12, 2008 9:13 pm
Location: Montreal, Canada
Contact:

Re: Spinner controller (Rotary encoder)

Post by uze6666 » Sun Nov 01, 2015 1:29 am

I'd suggest to use the same base protocol I made for the keyboard. The only major thing I think that was missing was to return a device id when sending an initialization command to know what is plugged in. That would be important to have only one way of communicating with external devices.

I have received 2 encoders a while ago, but not managed to find enough motivation to work on that. :( But I could help finish the protocol.

CunningFellow
Posts: 1196
Joined: Mon Feb 11, 2013 8:08 am
Location: Brisbane, Australia

Re: Spinner controller (Rotary encoder)

Post by CunningFellow » Sun Nov 01, 2015 1:54 am

Your two encoders are just standard A/B[/X] quadrature things ?

User avatar
Harty123
Posts: 467
Joined: Wed Jan 12, 2011 9:30 pm
Location: PM, Germany
Contact:

Re: Spinner controller (Rotary encoder)

Post by Harty123 » Sun Nov 01, 2015 7:33 pm

We've made a rotary encoder for other purposes with magnetic sensor ICs from AMS:

http://ams.com/eng/Products/Position-Sensors

It works with an magnetic field (permanent magnet) and gives you the actual position (angel) of the wheel.

User avatar
uze6666
Site Admin
Posts: 4487
Joined: Tue Aug 12, 2008 9:13 pm
Location: Montreal, Canada
Contact:

Re: Spinner controller (Rotary encoder)

Post by uze6666 » Sun Nov 01, 2015 10:02 pm

CunningFellow wrote:Your two encoders are just standard A/B[/X] quadrature things ?
I think so, it's those: http://www.aliexpress.com/item/Free-Shi ... 73280.html

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests