The MP3car.com Store The MP3car.com Store    

Sponsored links

Go Back   MP3Car.com > Mp3Car Technical > Input Devices

Reply
 
LinkBack Thread Tools Display Modes
Old 01-09-2007, 11:44 AM   #1
Variable Bitrate
 
cherrybomb's Avatar
 
Join Date: Apr 2005
Location: Southern Califorina
Posts: 228
My ALPS RKJXT Encoder Solution

Hey All,

I've had this finished for some time now, and been meaning to post my experience with it.

I had fallen in love with the idea of the ALPS RKJXT Rotary Encoder/Joystick as a solution for input on my CarPC. So, I started looking into it further.

I tried to build a board, that used various hardware means to decode the quadrature signal from the encoder, including the usdigital ls chips but eventually was unsuccessful.

My solution always depended upon a game controller interface called the GPWiz, which turned a low going switch input into an HID signal, and the Girder software to intercept that HID signal, and turn it into something useful for the front-end I was using.

Eventually, I gave up on decoding the Quadrature signal in hardware and built a LUA method to be used in Girder under the HID "OnRead" method, and shorted a couple pins on the board I'd built to hold the decoding chip.

Over all, it works quite well, and I'm happy with it. I haven't actually installed it in a car, since I'm still in the process of designing/building my setup, and haven't actually installed anything yet. However, the device seemed to work well, and felt good, and was VERY compact.

I've included below, the code for Girder, as well as a couple screenshots of the EaglePCB drawings of the two boards I used. I'll get some photos of the whole thing later today, and post those as well.

Code:
function HidRead( data ) -- This uses the bitwise shortcut method of decoding a quadrature signal found at; -- http://www.parallax.com/dl/docs/cols/nv/vol1/col/nv8.pdf -- Set some variables we'll use later envTable = _G envTable = getfenv(1) if envTable.prev == nil then envTable.prev = "" end if envTable.prevBits == nil then envTable.prevBits = 0 end local s="" local index=0 local curBits = envTable.prevBits if data then -- Check each byte in the string. This comes in the format XX XX XX XX XX XX for b in string.gfind(data, ".") do -- For the GPWiz 32, the first two bytes are always 77 77. The third byte contains info we're interested in -- namely 01 == Quadrature A and 02 == Quadrature B if index == 2 then curBits = math.band(string.byte(b),3) end -- Concatenate this bit back onto the data string s =s .. string.format("%02X ", string.byte(b)) index = index+1 end end -- Check to see if our current data string is the same as the last, we don't want to do anything if it is. if s ~= envTable.prev then -- Bitshift our current byte one to the right so we can compare previous B with current A shifted = math.bshiftr(curBits,1) result = math.bxor(envTable.prevBits, shifted) -- Now we need to filter our result to only the second bit andResult = math.band(result, 1) if andResult == 0 and curBits ~= envTable.prevBits then gir.TriggerEvent("Quadrature Increased", 18, 0) elseif andResult == 1 and curBits ~= envTable.prevBits then gir.TriggerEvent("Quadrature Decreased", 18, 0) end gir.TriggerEvent(s, 239) end envTable.prevBits = curBits envTable.prev = s end









__________________
'99 Ford Explorer Eddie Bauer
CarPC Progress ~= 97%. Everything is installed, and operational. Still need to tweak and tune, and do some "finish" fabrication.
CarPC Project Web Site

SpaceNavigatorDriver SourceForge Project

Check out my blog.

Last edited by cherrybomb; 01-09-2007 at 04:21 PM. Reason: Added pictures of actual unit(s)
cherrybomb is offline   Reply With Quote
Advertisement
 
Advertisement
Sponsored links

Old 01-09-2007, 12:57 PM   #2
Constant Bitrate
 
Join Date: Jul 2006
Posts: 133
*taps fingers together* Goood, goood.
LYHTSPD is offline   Reply With Quote
Old 01-09-2007, 01:39 PM   #3
Variable Bitrate
 
cherrybomb's Avatar
 
Join Date: Apr 2005
Location: Southern Califorina
Posts: 228
I should also note that in order for my code above to work, the A and B leads of the encoder need to trigger input 0 and 1 of the GPWiz, otherwise the code would be detecting the wrong inputs.
__________________
'99 Ford Explorer Eddie Bauer
CarPC Progress ~= 97%. Everything is installed, and operational. Still need to tweak and tune, and do some "finish" fabrication.
CarPC Project Web Site

SpaceNavigatorDriver SourceForge Project

Check out my blog.
cherrybomb is offline   Reply With Quote
Old 01-10-2007, 05:43 PM   #4
Constant Bitrate
 
Join Date: Jul 2006
Posts: 133
Do you have any of these boards left Ryan, or did you make them yourself?
LYHTSPD is offline   Reply With Quote
Old 01-10-2007, 07:41 PM   #5
Variable Bitrate
 
cherrybomb's Avatar
 
Join Date: Apr 2005
Location: Southern Califorina
Posts: 228
I do have one of each left, and could have more made.

I don't have the materials to make the boards, but I used a bulk PCB house to make them for a nominal fee. If I had enough people interested, I could have more made.
__________________
'99 Ford Explorer Eddie Bauer
CarPC Progress ~= 97%. Everything is installed, and operational. Still need to tweak and tune, and do some "finish" fabrication.
CarPC Project Web Site

SpaceNavigatorDriver SourceForge Project

Check out my blog.
cherrybomb is offline   Reply With Quote
Old 01-10-2007, 08:04 PM   #6
Constant Bitrate
 
Join Date: Jul 2006
Posts: 133
Ryan, PM me how much you want for those boards. What is the purpose of the controller board? Is it just an easier way to interface with the rest of the pins?
LYHTSPD is offline   Reply With Quote
Old 01-11-2007, 05:46 AM   #7
Variable Bitrate
 
Join Date: Mar 2004
Posts: 246
that's pretty great, way better than how I hacked up a 10 button mouse

can you use the center push as well as all the directions?
dyne is offline   Reply With Quote
Old 01-11-2007, 07:28 AM   #8
Constant Bitrate
 
Join Date: Jul 2006
Posts: 133
You should be able to, as long as you wire it up to the translator board.

cherrybomb: Did you have to write some scripting to handle the center push as well? I started writing my own code to do what the GPWiz does, and I have that much figured out. I have not used Girder before, but it looks like you can program some of the code in yourself.
LYHTSPD is offline   Reply With Quote
Old 01-11-2007, 11:37 AM   #9
Variable Bitrate
 
cherrybomb's Avatar
 
Join Date: Apr 2005
Location: Southern Califorina
Posts: 228
Quote: Originally Posted by LYHTSPD View Post
Ryan, PM me how much you want for those boards. What is the purpose of the controller board? Is it just an easier way to interface with the rest of the pins?

Well, I had originally created the controller board to decode the signal from the rotary encoder, and just turn it into pulses for UP or DOWN, but I couldn't quite get the chip to work the way I wanted it to.

The controller board does also route the signals to the pins of the GPWiz that my Girder code expects, and provides a place for as many as 10 other buttons and LED's (always on, not switched) to be attached.

Since the decoder chip is no longer part of the equation, it's just a matter of bridging some pins where it should go.
__________________
'99 Ford Explorer Eddie Bauer
CarPC Progress ~= 97%. Everything is installed, and operational. Still need to tweak and tune, and do some "finish" fabrication.
CarPC Project Web Site

SpaceNavigatorDriver SourceForge Project

Check out my blog.
cherrybomb is offline   Reply With Quote
Old 01-11-2007, 11:42 AM   #10
Variable Bitrate
 
cherrybomb's Avatar
 
Join Date: Apr 2005
Location: Southern Califorina
Posts: 228
Quote: Originally Posted by dyne View Post
that's pretty great, way better than how I hacked up a 10 button mouse

can you use the center push as well as all the directions?

Quote: Originally Posted by LYHTSPD
You should be able to, as long as you wire it up to the translator board.

cherrybomb: Did you have to write some scripting to handle the center push as well? I started writing my own code t

The rotary, center push, and all 8 directions are usable with this hardware and software configuration. The software piece I wrote only decodes the Quadrature signal from the encoder, the rest is much more straight forward in Girder.

The center push (button 11 on the GPWiz) is set any time any of the other directions are, so you'll use Girder to "learn" what each direction looks like (I.E. 11 and 3 for up) and then map it to some functionality.
__________________
'99 Ford Explorer Eddie Bauer
CarPC Progress ~= 97%. Everything is installed, and operational. Still need to tweak and tune, and do some "finish" fabrication.
CarPC Project Web Site

SpaceNavigatorDriver SourceForge Project

Check out my blog.
cherrybomb is offline   Reply With Quote
Old 01-11-2007, 12:46 PM   #11
Constant Bitrate
 
Join Date: Jul 2006
Posts: 133
I was not aware that Girder could do that. That is really nice! I am making a knob out of an old analog stick from a Playstation controller. I should have pics of it tomorrow.
LYHTSPD is offline   Reply With Quote
Old 01-12-2007, 02:23 AM   #12
Variable Bitrate
 
LiquidKernel's Avatar
 
Join Date: Feb 2005
Location: San Francisco, CA
Posts: 446
Very cool. I have an ALPS RKJXT... been wandering what to do with mine.
__________________
95 Volvo 850 T5 • Konis • ECU @ 17psi • 5+20% Tint • Orange Ambient-Light + LED Dash Lights • DigiMotive Dimmer • Custom LED Brake Lights • 2.5" BOSCH HID Projector Retrofit
Carpc: [▓▓▓▓▓▓▓] 99% Cleanup.
LiquidKernel is offline   Reply With Quote
Old 01-13-2007, 09:51 PM   #13
Variable Bitrate
 
Join Date: Mar 2004
Posts: 246
If you were to make another couple boards, how much would they cost?
dyne is offline   Reply With Quote
Old 01-13-2007, 10:40 PM   #14
Variable Bitrate
 
cherrybomb's Avatar
 
Join Date: Apr 2005
Location: Southern Califorina
Posts: 228
Quote: Originally Posted by dyne View Post
If you were to make another couple boards, how much would they cost?

Depends on how many I have made. I use BatchPCB to have them made, instead of trying to do it myself, so the more I have made at once the cheaper they are.

My last shipment of two pair of boards was just under $30
__________________
'99 Ford Explorer Eddie Bauer
CarPC Progress ~= 97%. Everything is installed, and operational. Still need to tweak and tune, and do some "finish" fabrication.
CarPC Project Web Site

SpaceNavigatorDriver SourceForge Project

Check out my blog.
cherrybomb is offline   Reply With Quote
Sponsored links
Advertisement
 
Advertisement
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Stealth OEM install in MR2 Spyder - Magazine coverage! silencery Show off your project 95 07-31-2008 04:15 PM
MMI style rotary encoder install - details Tony G Input Devices 59 06-01-2008 01:41 PM
Wanted Alps RKJXT Multi Control Switch marque Classified Archive 1 07-23-2006 04:34 PM
Mouse + Encoder Troubles (detent num. difference) aec merlin Input Devices 4 08-25-2005 11:56 AM
a serious solution sohaibma Power Supplies 1 04-06-2005 02:44 PM


All times are GMT -5. The time now is 11:10 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.2.0
Copyright © 1999 - 2008 Mp3Car.com Inc.Ad Management by RedTyger
Message Board Statistics