Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: My ALPS RKJXT Encoder Solution

  1. #1
    Variable Bitrate cherrybomb's Avatar
    Join Date
    Apr 2005
    Location
    Southern Califorina
    Posts
    233

    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

    rkjxt-cad by qwikrex, on Flickr


    controller-cad by qwikrex, on Flickr


    all-boards by qwikrex, on Flickr


    encoder-side by qwikrex, on Flickr


    encoder-bottom by qwikrex, on Flickr
    Last edited by cherrybomb; 02-15-2011 at 08:09 PM.
    '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.

  2. #2
    Constant Bitrate
    Join Date
    Jul 2006
    Posts
    159
    *taps fingers together* Goood, goood.

  3. #3
    Variable Bitrate cherrybomb's Avatar
    Join Date
    Apr 2005
    Location
    Southern Califorina
    Posts
    233
    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.

  4. #4
    Constant Bitrate
    Join Date
    Jul 2006
    Posts
    159
    Do you have any of these boards left Ryan, or did you make them yourself?

  5. #5
    Variable Bitrate cherrybomb's Avatar
    Join Date
    Apr 2005
    Location
    Southern Califorina
    Posts
    233
    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.

  6. #6
    Constant Bitrate
    Join Date
    Jul 2006
    Posts
    159
    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?

  7. #7
    Variable Bitrate
    Join Date
    Mar 2004
    Posts
    283
    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?

  8. #8
    Constant Bitrate
    Join Date
    Jul 2006
    Posts
    159
    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.

  9. #9
    Variable Bitrate cherrybomb's Avatar
    Join Date
    Apr 2005
    Location
    Southern Califorina
    Posts
    233
    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.

  10. #10
    Variable Bitrate cherrybomb's Avatar
    Join Date
    Apr 2005
    Location
    Southern Califorina
    Posts
    233
    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.

Page 1 of 2 12 LastLast

Similar Threads

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

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •