Simple USB joystick

Status
Not open for further replies.

tietze

New member
Hi, I'm about to order a Teensy for making a simple usb joystick. I was thinking just to use the standard joystick-example with 6 axes and 32 buttons. In relation to that I have a few stupid questions, that I did not find answers to in the FAQ.

  1. Does the different versions of the Teensy (version 2/ 2++/ 3) deliver different options for axes and buttons or is this a result of the joystick-example code?
  2. I haven't found any diagrams on how the joystick example expects input on the different pins. Are analog inputs on pin A1-A6 and then button 1-32 on pin?
  3. Are there any examples of what kind of wiring is needed for 32 buttons/switches?
  4. What is the deal with 3.3v of version 3 and 5v of version 2? I would expect that it would be easier to get a 5V psu if external power is required, but is that correct?
  5. I would expect that 6 pots and 32 buttons could be run entirely on the power supplied by the usb bus?
 
[*]Does the different versions of the Teensy (version 2/ 2++/ 3) deliver different options for axes and buttons or is this a result of the joystick-example code?

They are the same.

[*]I haven't found any diagrams on how the joystick example expects input on the different pins. Are analog inputs on pin A1-A6 and then button 1-32 on pin?

It's documented by the comments in the example code. There are no graphical diagrams. Is something about the comment text unclear?

[*]Are there any examples of what kind of wiring is needed for 32 buttons/switches?

A momentary contact pushbutton, or something similar (like touching a paperclip between the pin and GND), is needed.

[*]What is the deal with 3.3v of version 3 and 5v of version 2? I would expect that it would be easier to get a 5V psu if external power is required, but is that correct?

Teensy 3.0 can be powered by 5 volts on the VIN pin. It creates the 3.3 volts.

[*]I would expect that 6 pots and 32 buttons could be run entirely on the power supplied by the usb bus?

Yes. They use very little power. The pot consume a tiny amount of power depending on their resistance. A 10K pot at 5 volts is 0.5 mA.
 
It's documented by the comments in the example code. There are no graphical diagrams. Is something about the comment text unclear?

Hmm I don't know what text you are referring to. I just cannot see how to connect 6 pots and 32 digital inputs.

When taking a look at the pinout the analog pins A0-A9 seems to be the same as digital pins 14-23.
 
Hmm I don't know what text you are referring to.
A test program can be found in File > Examples > Teensy > USB_Joystick > Complete.
You would need to install Arduino and Teensyduino to see that example in full. You can do that without having the actual Teensy.

I just cannot see how to connect 6 pots and 32 digital inputs.

When taking a look at the pinout the analog pins A0-A9 seems to be the same as digital pins 14-23.
On Teensy 3.0, yes. As the joystick page says
The test expects six voltages on analog inputs 0 to 5, and buttons on 0 to 15 (for Teensy) or 0 to 31 (for Teensy++)
if you scroll down on the pinouts page to Teensy++ 2.0 you will see that the pins are numbered 0 to 45, with the analog inputs shared with pins 38 to 45. So you have a total of 38 free digital inputs - the USB joystick can use up to 32 of them.
 
Does the different versions of the Teensy (version 2/ 2++/ 3) deliver different options for axes and buttons or is this a result of the joystick-example code?
They are the same.
Paul, I think you misunderstood the question here.
They are not the same. As the joystick page states, Teeensy 2.0 allows up to 16 buttons; Teensy++ 2.0 allows up to 32. And, as the page will doubtless say once it is updated, Teensy 3.0 allows up to 24 (if you use all the pins, including the interior ones; otherwise, up to 14).
So if someone plans to order a Teensy to make a joystick with 32 buttons, Teensy++ 2.0 is the correct choice.
 
Ah, yes, you're right. Hardware-wise, Teensy 2.0 and Teensy 3.0 do not have enough pins, if you wire up pots and buttons in the simplest way with one per pin. Software-wise, all 3 boards support the same joystick feature set.
 
And of course you are correct that any of them will support 32 buttons with additional support circuitry.
 
Thanks for the input! I've just ordered the 2.0 ++ to avoid dvelving into the additional support circuitry at first.

@Nantonos: Do you know of anyone who has made this additional circuitry?
 
The keypad library is the most commonly used way to connect lots of buttons.

http://www.pjrc.com/teensy/td_libs_Keypad.html

Most people use shift registers when they want to connect many LEDs cheaply, or chips like MAX7219 or TLC5940 for driving LEDs with fancy features. These are popular libraries to use:

http://www.pjrc.com/teensy/td_libs_ShiftPWM.html

http://www.pjrc.com/teensy/td_libs_Matrix.html

http://www.pjrc.com/teensy/td_libs_Tlc5940.html

http://www.pjrc.com/teensy/td_libs_LedControl.html
 
Status
Not open for further replies.
Back
Top