Jump to content

Using Teensy To Control Dual Joysticks


14 replies to this topic

#1 SaintApoc

    Member

  • Pip
  • Knight Errant
  • 19 posts
  • LocationNew York

Posted 11 April 2013 - 05:38 PM

I have a controller that is not functioning properly and would like to completely rewire it using Teensy++.
The board looks like this:
Posted Image

As you can see, there are a crap ton of solder points, and I cannot find a video or an instruct-able on which controller leads go where. I don't understand hardware as well as I need to in order to figure this out.

Before I order this thing, I want to know how to put it together. I think I'm going to use the version that has pins, so that I can just use a breadboard.

My controller circuit board looks like the following:
Posted Image
Posted Image
Posted Image
Posted Image
CIRCLE LEGEND:
Red: Right Stick wiring (There is a wiring point that I forgot to color in one picture, but is identified in another)
Blue: Left Stick wiring
Green: Digital/Analog switch
Black: Plug wires (Out to computer)
Purple: I'm assuming these are the analog axis control wiring
Brown: I'm assuming these are the button wiring in the sticks

I'm trying to figure out where all of it should end up if I remove the PCB completely (Loss of function of the 8 center buttons don't matter; I will find other controls to replace them). I don't quite understand what each of the colors of the wires mean, nor how to put them onto the letter/number points on the Teensy++ board.
Any insight is very much appreciated.
Answers as to why I want to do this have been discussed here (This is what my current resources allow me to do, and i don't want this to go to waste):
http://mwomercs.com/...94#entry2211294

Edited by SaintApoc, 11 April 2013 - 05:40 PM.


#2 Foust

    Member

  • PipPipPipPipPipPip
  • Legendary Founder
  • Legendary Founder
  • 394 posts
  • LocationKentucky

Posted 12 April 2013 - 11:11 AM

Well there really isnt a quick and easy way to do this, so I will try to lay out some basics and you can decide if you want to take the plunge.

The only thing you would use the stock board for in this instance is if you would want to attempt to wire up the stock center buttons. It would involve you either soldering at the via points or scrapping off the coating on the traces and soldering to that. If you are comfortable with a soldering iron it is annoying but doable.

As far as the wiring of the joysticks to the teensy++ well that depends on how you configure the teensy++. I am assuming that you are going to use GenericHID to build your joystick layout. If I remember from the other thread your looking at 4 axis and some number < 32 for switches.

The color of the wires are only there to aid you in their identification. I keep the medium sized black book of mechwarrior pod schematics and bad sketches (a note book) to keep track of what I have wired to what and why. Documentation is your friend.

It should not be a bad rewire job, just keep good notes and invest in some heat shrink to insulate your joints and have at it.

Oh and try not to let the magic smoke out, I still haven't figured out a way to get it back in. ;)

#3 Loc Nar

    Member

  • PipPipPipPipPipPipPipPip
  • 1,132 posts

Posted 12 April 2013 - 11:16 AM

Just popping in so you don't feel abandoned. I have no advice on Teensy, Foust and a few other guys around here got them down though. If you do go that route, definitely get the pin/breadboard one, if nothing else for the flexibility of repurposing it if the need ever arises. Sorry I can't be of more help with the diodes and such either, but rewiring that controller with a Teensy would likely be the easiest route to bring that controller to working status. However getting the controller working perfectly from a hardware standpoint unfortunately does not address the shortcomings that even current plug-n-play high end setups are plagued with I was ranting about in your other post.

I just wouldn't be me if I didn't mention it, but a T16000 isn't much more than a Teensy but would allow you to use it as is and you could then determine if any type of regular joystick configuration would work out for you before $pending weeks soldering with high hopes. The good news is that if you do like it, but still want to use the dual stick base, you can gut the T16000 (definitely harder than using a Teensy) and use it the way you would a Teensy, but with the advantage of being able to control it with TARGET which makes it flexible and programmable enough to use with MWO and anything else with no fuss. You would still have your electronics project, but would also have digital projects (TARGET) to go with it; good experience all. The alternative is a lot of work before you even get to conduct your first experiments that would let you know whether it's worth pursuing or not so is kinda a catch 22. If you really hated the T16000, they sell on ebay used for not much less than you can buy one for on amazon new.

#4 SaintApoc

    Member

  • Pip
  • Knight Errant
  • 19 posts
  • LocationNew York

Posted 12 April 2013 - 01:28 PM

Thank you both for your replies, and I do apologize for being a particularly needy individual; I've used my research skills to the max, and still can't seem to find what I'm looking for (mostly because people have the resources to take an easier route, haha).
To be honest, even if it's NOT a rewarding experience in the sense that I get this piece of hardware to do what I want it to, it's still a VERY effective way of hands-on learning.

To the topic:
So Foust, I am assuming then that the teensy gets programmed FIRST, and then I just start hooking up wires to see if they do the functions they're supposed to (and troubleshoot if they don't). While I think that's going to be a pain in the rear, it definitely sounds like a fool proof method (I purchased it literally under ten minutes ago; I'm taking the plunge).
I would have kept the PCB if I trusted that it was in proper operating condition (I don't think it is, hence I'm ripping the blasted thing out). Those 8 center buttons are going to scrap; I might cut up this relic and replace the center buttons with something else, like an old game pad. It won't be particularly pretty (considering my projects are never made with professional finishing touches), but I'm not too worried about that part of it. I just want the sticks to work.

Loc Nar, I purchased the pinned version at your suggestion. I forgot the breadboard, so I called them up to ask if they could add to the order. Paul is a very kind gentleman on the phone, I have to say. Their customer service is excellent as far as that call went in my eyes. Anyway, this thread won't be updated until I get the board. If I DO manage to get this working, I am thinking that I will do a "how-to" thread so that future players that somehow fall into this rare situation can have something to search for.

Also, I forgot; financial aid just came in. Now, while I know I should be spending it on school-needs.... And I DO sincerely apologize to you and the community if I'm that guy that's wasting all your tax-money, BUT I might drop some into that super stick you keep bringing up. I do not particularly want to spend a large amount of money, so I'm not going the 2/3 choices route that you suggested in the last thread, but I'm definitely looking into this option. Note that I have other game obligations other than MW, so my interest isn't on a competitive level [yet] with MW. So before I spend any money on this controller, I want to make the teensy into a learning experience (I wouldn't be me if I wasn't ripping things apart and trying to re-purpose them =]).

ALSO, a VERY important factor that I need to know (and this may sound like a dumb question because I cannot find the verbatim model you are describing), but are you referring to the T16000M? You keep referring to it as the T16000, and I don't want to buy the T16000M if that's the wrong controller and I'm just bad at searching. One last thing on the subject, I'm assuming (after reading through again) that this is an ABSOLUTE controller (does not have spring resistance, stays in position on screen as long as I do not move the stick)?

Thank you again for your input. I don't really feel "abandoned" if I don't get responses, I feel two things: Either the community has no answer for my question (which is understandable and acceptable), or the community feels it necessary that I figure it out on my own (which at times can be understandable and acceptable). I would be LOST if you guys weren't here; thank you for everything!

Edited by SaintApoc, 12 April 2013 - 01:35 PM.


#5 Foust

    Member

  • PipPipPipPipPipPip
  • Legendary Founder
  • Legendary Founder
  • 394 posts
  • LocationKentucky

Posted 12 April 2013 - 01:40 PM

View PostSaintApoc, on 12 April 2013 - 01:28 PM, said:

To the topic:
So Foust, I am assuming then that the teensy gets programmed FIRST, and then I just start hooking up wires to see if they do the functions they're supposed to (and troubleshoot if they don't). While I think that's going to be a pain in the rear, it definitely sounds like a fool proof method (I purchased it literally under ten minutes ago; I'm taking the plunge).


Yes. I started with a single switch. I did not wire anything to the teensy "hot" but I fully support a step by step approach. GenericHID makes the software part super simple and then its really just hookup the wires to the right spots.

#6 Loc Nar

    Member

  • PipPipPipPipPipPipPipPip
  • 1,132 posts

Posted 12 April 2013 - 01:49 PM

Again, your quite welcome. Glad to hear you are as interested in the process as the results. I take pleasure in both, but sometimes it seems like only process... I'm looking forward to seeing your projects unfold, and no need to apologize for asking questions around here!

As to the T16000, yes it's actually the T16000M. I wouldn't call it a superstick, but rather the shortest bridge across a deep valley. It's flexible enough to be tortured into all kinds of things, but on it's own is useful enough to leave it's screws. Wish I knew about them sooner, cause it would have launched me other other hurdles from other underdeveloped sims that I either ignored or huge workarounds were involved. The one I currently have was destined to be the heart of a sailplane cockpit to run Condor, but it's proved more useful to just be able to easy in/out test things in MWO and other games.

gl,hf!

#7 SaintApoc

    Member

  • Pip
  • Knight Errant
  • 19 posts
  • LocationNew York

Posted 14 April 2013 - 04:46 PM

So I tried xPadder with my xbox 360 controller (still waiting on teensy to come in) and I've been keeping in mind all the things you've talked about. After feeling how "jumpy" the right stick is, I've come up with some ideas as to how to mod the SCPH-1110. Come to find out, my idea has been done before. People remove springs and put in dampeners so that the stick stays in place.
That was good news, until something dawned on me... What if even after removing the spring and replacing it with dampeners, the stick still acts RELATIVE?
Of course, I don't know this for sure, because I haven't tried it yet, and I haven't seen any forums discussing it. But if the spring acts ONLY to bring the stick back to center, then there must be a command that is telling the stick to "accelerate" instead of "stay put," right? Otherwise, the spring action would recenter the cursor. Because it's not re-centering the cursor as it is, there is either a hardware or software function telling the cursor to continue moving while the stick is in non-center position.

I'm going to look further into this. Hopefully it is a hardware function that I can just mod, or a software function that I can program. Otherwise, I'm just going to go the easy route. More updates as this comes along.

Edited by SaintApoc, 14 April 2013 - 04:48 PM.


#8 SaintApoc

    Member

  • Pip
  • Knight Errant
  • 19 posts
  • LocationNew York

Posted 15 April 2013 - 01:46 PM

View PostFoust, on 12 April 2013 - 01:40 PM, said:

GenericHID makes the software part super simple and then its really just hookup the wires to the right spots.

So, I ran into a problem within the first 5 minutes, haha.
I have been searching, and it seems my problem is yet again a rare one.
I intent to use your thread as a source of help (http://mwomercs.com/...371#entry633371), along with other pages that I searched and seem to have some detail.

But for now, I've run into some issues that just aren't clicking. For everything below, I am only requesting answers for the BOLD questions. The other questions or comments are really just me expressing my thought process; I do not want to over-stay my welcome as far as question asking goes.
The first and positively MOST important is that GenericHID is not recognizing my device.

I downloaded GenericHID from their site, then couldn't run it due to a .dll file missing. I found that particular file in another program (JungleFlasher) on the internet, and just put it into the directory, no biggie.
I downloaded teensy loader, and it works. I click reboot, my teensy flashes. TL asks me to press the button to activate, I do as requested, and it stops flashing. In GenericHID, I pull over the Teensy Loader, a simple switch and LED (Both of which I happened to have just laying around) and wire up to specific nodes in GHID.
No matter how many times I reboot the device, program reads red for all three (USB Device Located, HID Device Mode, Bootloader Mode).
In device manager, I'm ASSUMING it's the one that reads "HID-compliant consumer control device," which has no issues.
So my question is... how do I get GHID to recognize Teensy++ ? I do NOT want to use other software if it's going to program my Teensy in an irreversible manner. I really hope I'm not supposed to do anything with Arduino, C++, or hex.

Second, I am not too keen on the understanding of this hardware. My understanding of electricity is "all circuits must be closed," and "all circuits must be grounded." That's really it. The website for the Teensy isn't all that informative, and I don't want to fry this thing on "hunches." I'm assuming that if I don't touch the center chip, and if I don't put an external power source to this thing, it should be ok. But I don't know the function of the +5V node and the GND node. GND probably means ground, and +5V is probably external source. But how on earth do I complete the circuit? I get wire leads come out from the joystick and onto whatever I choose on the Teensy, but I don't see how that's supposed to work if they aren't completed. Buttons COMPLETE circuits; they don't shoot signals or electrons out of their own source.

So, taking a step back. My question is this: to which nodes should an LED and a switch be wired in order to get started testing?

Me? Based on this chip and my knowledge of electricity, I would think to wire one lead off of a switch to the GND, and the other to a random node (say, C7). I would then take each end of the LED and wire them to random nodes (say F6 and F7). Problem is, what's going on in Generic HID? The switch has one lead labelled "In" and the other, I can't tell. My knowledge of electricity dictates that that symbol is voltage source. This doesn't quite make sense to me; does the Teensy not supply it's own power (Maybe that's what the +5V means)? How is this circuit completed? I WOULD just jump the LED to the switch, and then each of those ends could go to the teensy (In whatever configuration that would work), BUT GHID does NOT appear to support wiring between devices; devices can only be wired to the board (which is ok). Thinking about it now, that +5V is probably the start lead and GND is the end lead, which would make sense. That means that GHID shows a switch and an LED. Switch has one lead on +5V (Vcc), and another on some node. Then LED can either be both on different nodes, or one on the same node as the non +5V node as the switch, and the other on some other node.

If I don't have enough squares (When everything comes together), I can just jump from the letter sections of the breadboard to the "+-" sections. I don't really have a question for this paragraph, considering I can just test this out once the controller can be recognized. I'm not asking for the work to be done for me; this is still a tinkering experiment.

I don't remember where, but I think I read something about Teensy supporting 8 analog controls. Is that what PA0-PA7 is for? And with respect to what Loc Nar was saying about ABSOLUTE and RELEVANT, would it then make more sense to NOT have analogue for this controller? PA0-PA7, PE4, PE5, ALE, and the three bottom ones (RST, GND, +5V) are not placed on the sides, so I don't know if they perform a specific function, or if they are "special." I suppose that will all come together on its own.
Thanks again for reading through this block hardship. That first question is really important; without recognition of my Teensy, I can't solve any other problems on my own =/

Edited by SaintApoc, 15 April 2013 - 01:54 PM.


#9 Foust

    Member

  • PipPipPipPipPipPip
  • Legendary Founder
  • Legendary Founder
  • 394 posts
  • LocationKentucky

Posted 15 April 2013 - 07:54 PM

View PostSaintApoc, on 15 April 2013 - 01:46 PM, said:

So my question is... how do I get GHID to recognize Teensy++ ?


Check the instructions on the GenericHID page regarding the libusb win32 library, you need to get that in place before it will recognize the Teensy. At least that is where I would start.

View PostSaintApoc, on 15 April 2013 - 01:46 PM, said:

So, taking a step back. My question is this: to which nodes should an LED and a switch be wired in order to get started testing?


Well that above question and the text below it. So start with a single switch, wire one leg to the input pin you assign a switch to in generichid, wire the other pin to ground. Assign the teensy board as a generic controller joystick. Assign the button as button 1. Write this to the Teensy. Restart the Teensy. Windows should now detect it as a joystick. You should be able to open the joystick config in windows press the button and see it register as button 1 on your one button "joystick".

That is as basic as you can start, and as you know it all depends on GHID seeing the device. You should note the location of the pin that controls the on board LED, I didn't use it because of what may have been a non issue but I wanted to remove the variable. You also want to wire your axis to a specific set of inputs that should be labeled on the card that came with the teensy. (I think so anyway, its late and I'm going from memory)

The +5 and GND pins provide those from those pins. Such that you can use those to for your power and ground for your pots, with the signal wire going to input assigned. You can also power LEDs and LCDs within current limits for the board, although that is a bit out of scope for a stick rebuild.

#10 SaintApoc

    Member

  • Pip
  • Knight Errant
  • 19 posts
  • LocationNew York

Posted 17 April 2013 - 04:20 PM

View PostFoust, on 15 April 2013 - 07:54 PM, said:


Check the instructions on the GenericHID page regarding the libusb win32 library, you need to get that in place before it will recognize the Teensy. At least that is where I would start.


This is driving me nuts. So, here's the update of everything I've done.
Downloaded libusb-win32-filter-bin-0.1.12.2.exe and Atmel FLIP.
The instructions say to "install" the libusb-win32-filter-bin-0.1.12.2.exe library, but there really isn't an executable related to installation. What is instead present is a wizard that creates .inf files. I'm not entirely sure what that does or how to use it, but I'm pretty sure I now have a .inf file related to the Teensy itself (after running the wizard).
I chose AT90USB1286 from the FLIP application, but when I choose "USB" from "Select a communication medium" I get an error that reads "AtLibUsbDfu.dll not found" followed by "Could not load dynamic library." I searched EVERYWHERE for a solution to this problem, and they all seem to be pointing towards installing libusb0.dll.
The issue is that I have libsub0.dll and libusb0_x86.dll with their respective .sys files in multiple folders. I have tried every single one of them (from both flip and the folder from libusb-win32 AS WELL AS the one used for GenericHID). My system refuses to install them, giving me a compatibility error (As I think they are 32-bit files)
I have also tried each of the hex files on Teensy Loader, and they don't seem to play a part either. The problem stands: GenericHID still reads red, and now FLIP (which I think may help that problem) is giving me an error that I cannot solve. I'm running Windows 7, 64-bit.
I am thinking about going to a more software oriented forum for this thing; would you be able to suggest any that might be particularly informative on this specific subject (Teensy/GenericHID)?

EDIT: I found the actual libusb-win32 executable; so I did that in compatibility mode for windows xp sp2. That helped flip move on a little; now it just tells me it could not open USB device.

Edited by SaintApoc, 17 April 2013 - 04:32 PM.


#11 Foust

    Member

  • PipPipPipPipPipPip
  • Legendary Founder
  • Legendary Founder
  • 394 posts
  • LocationKentucky

Posted 17 April 2013 - 06:27 PM

Do you have that libusb0.dll file in the system32 folder? If not copy it there then fire up GHID and see if your Teensy shows up. Try a different USB port as well.

#12 SaintApoc

    Member

  • Pip
  • Knight Errant
  • 19 posts
  • LocationNew York

Posted 17 April 2013 - 07:01 PM

I am able to "place" the file there. However, when I try to install it using the command prompt "regsvr32 libusb0.dll" it gives me an error that reads:

The module "libusb0.dll" may not compatible with the version with the version of Windows that you're running. Check if the module is compatible with an x86 (32-bit) or x64 (64-bit) version of regsvr32.exe

Also, didn't matter what port I used; nothing seems to change. I have joined PJRC forums and have put up the topic here: http://forum.pjrc.co...30802#post30802

#13 Foust

    Member

  • PipPipPipPipPipPip
  • Legendary Founder
  • Legendary Founder
  • 394 posts
  • LocationKentucky

Posted 18 April 2013 - 04:38 AM

I wasn't able to get it to "install" either, but it did let me detect the teensy after I did that.

#14 SaintApoc

    Member

  • Pip
  • Knight Errant
  • 19 posts
  • LocationNew York

Posted 18 April 2013 - 01:49 PM

View PostFoust, on 18 April 2013 - 04:38 AM, said:

I wasn't able to get it to "install" either, but it did let me detect the teensy after I did that.

Hmm... I'm going to keep hammering at it, and if that doesn't work, I may just put it off for now. Maybe it's my computer or something. Thanks for all the help and insight, I do appreciate it

#15 Grits N Gravy

    Member

  • PipPipPipPipPipPip
  • 287 posts

Posted 16 May 2013 - 12:03 PM

Quote

I go to Program, and the three dots are red instead of green (USB Device Located, HID Device Mode, Bootloader Mode). Basically, FLIP and GenericHID are having trouble recognizing my Teensy, but Teensy Loader interacts fine.
How do I get FLIP and GenericHID to recognize my Teensy++?


I may have the answer to this.

All the lights are red and the buttons are disabled. The AT90USBKey is running in Mouse/HID/Flash Drive mode and the Generic HID software cannot recognise it. For it to be recognised, it needs to either be programmed as a Generic HID, or be running in bootloader mode.

Normally bootloader mode can be entered just by pressing the "Start Bootloader" button. Because this is the first time we are going to program the device, we need to enter bootloader manually by using the buttons on the board

The device should now enter bootloader mode. This sequence can be used anytime the device appears unresponsive.

The program window should now detect the device...
Posted Image

Press the Program button. A progress bar will show the programmer in action.
When the programming is complete press the "Restart Device" button. Now the Generic HID device should be detected. The Program dialog box will now identify the device. If it doesn't, press the RST button on the board, or unplug the device and plug it in again.

source http://generichid.so...tingstarted.htm
You should then be able to to go through and do this

View PostFoust, on 15 April 2013 - 07:54 PM, said:


Well that above question and the text below it. So start with a single switch, wire one leg to the input pin you assign a switch to in generichid, wire the other pin to ground. Assign the teensy board as a generic controller joystick. Assign the button as button 1. Write this to the Teensy. Restart the Teensy. Windows should now detect it as a joystick. You should be able to open the joystick config in windows press the button and see it register as button 1 on your one button "joystick".

That is as basic as you can start, and as you know it all depends on GHID seeing the device.


EDIT:
So I was looking at this again, slow day. I don't think you will have an issue actually wiring the Joystick to the board once you get GHID up and running. It supports joysticks via analog inputs, ie potentiometers. There should be 4 potentiometers in that stick (l,r,u,d) they should hook up to F0-F3, those being half of the analog inputs, The other half is F4-F7, the 2,0 ++ has 8 analog pins. There should also be 4 hot leads into power the potentiometers, which will need to be connected to the 5v supply and 4 that connect to ground. Which wires are which on the joystick is something you're going to have to figure out through trial and error.
http://www.pjrc.com/teensy/adc.html

An issue i see is, You don't know the power requirements for the potentiometers in that stick. It is possible but unlikely that you can over power the stick and fry it, or under power and not get a full pull from the stick. You also won't know the draw and thus have an idea how much juice you have left to power your other stick, or anything else you decide to run on the same board. If you want to you can always pick up another stick on the cheap, just google mame sticks. http://www.ultimarc.com/controls.html

oh yeah there is some documentation on potentiometers via GHID http://generichid.so...rge.net/pot.htm

Edited by Grits N Gravy, 16 May 2013 - 07:12 PM.






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users