Saturday, September 7, 2013

The Return of Teensy - Hardware

After asking some question on the Teensy forums (the creator is very responsive and helpful in getting hardware and software details), I decided to give the Teensy3s another go. They support all 16 endpoints, and also can use a USB Host Shield which would allow me to remove the middleman as it were, and have the physical controller hooked right to the teensy.

So right now I have 2 Teensy 3s. One is really just a glorified USB Serial adapter, so you could use a teensy2 or try to find an adapter which supports the 3.3v signaling levels on the Teensy UART. They are wired together on their 1st serial ports. The 2nd one is the brains of the operation, it is hooked up to the host shield and to the xbox, and is responsible for relaying all communication between the xbox and the controller as well as anything added over the serial port.

A word on power:
The controller requests the maximum possible (~500ma). The teensy internally runs on 3.3v, but normally converts this from the 5v it gets on the USB connector. You can power the host shield from that same 5v source as the teensy, or even off of the 3.3v the teensy provides. Byt many devices, especially HID ones won't work on that amount of power. So to play it safe I'm powering it via an external power source. As an added bonus this means the teensy can be up and running and lay all the needed groundwork before connecting to the xbox. Out of the box, the teensies are intended to get power over USB. To avoid damaging them there is a jumper which can be cut with an xacto knife, so it will no longer draw power from the USB connector, only your external source. Simlarly the host shield normally shares its own power source (3.3v) with the attached devices. There is another jumper which can be cut on here to separate the two, allowing 5v to be provided to the USB.

Teensy(Pinout): I cut the jumper in the second picture. You want to cut in between the two small solder pads to the left of the USB jack as you look from the bottom. Test with a multimeter. Once disconnected I was getting something like 20Mohm.
Host Shield(Pinout): I soldered on some pin headers to make my life easier but this is by no means required. I cut the VBUS jumper (closer to the middle) and ran a wire from the VBUS pad to the RAW pin. This pin is not in use, and is more convenient to access than using the pad directly.

Power: check your power jack and verify which pin is + and which is ground. On mine the center was + and edge was ground. I wired mine to a 3 pin fan extension cable (1 is not used), so i could disconnect it from the box easily and to make sure i didn't swap my polarity. The ground connect to the ground on each teensy and both grounds on the Host Shield. The + connects to Vin on each teensy, and to the RAW pin I wired earlier on the shield.
Teensy<->Teensy: We only need two wires here, TX1 connects to RX1, and RX1 to TX1. If you were connecting a usb serial adapter directly to the teensy (after making sure it was 3.3v) you would just connect it directly to RX1,TX1, and ground).
Teensy<->Shield: there are 6 pins that need to be connected here (other than the ground and 5v power already done).
  1. 3.3v Power: you can connect this to either 3.3v pin on the teensy, you won't be hitting 100ma with the separate power for the USB, and that one has a pin already there (assuming you got the Teensy3 with header pins already installed, which I did, because I'm lazy and it was $3 more).
  2. Reset: this is the reset signal, it needs to receive voltage to NOT reset. You can just connect this to the same 3.3v pin on the Teensy as you did for the power. I connected it to pin 2 on the Teensy, so that I could reset the host shield from the Teensy if needed.
  3. SS: this is the slave select signal for the SPI bus that the host shield uses for communication with the Teensy. Wire this to CS0(10) on the Teensy.
  4. MOSI: This is Master Out Slave In, this connects to DOUT(11) on the teensy.
  5. MISO: This is Master In Slave Out, this connects to DIN(12) on the teensy.
  6. SCK: This is the clock signal for SPI, and connects to SCK(13) on the teensy.

Other: the teensy has plenty of pins left, so you could wire up one or more LEDs, for status, identification, or whatever you want.

(2) Teensy3 $22
Project Box (5x2.5x2) $5.49
USB Host Shield $20.00
1ft 90 degree right hand USB Micro cable (to xbox) $4.99
6ft 90 degree left hand USB Micro cable (to computer)$6.98
1ft 90 degree USB cable (to controller) $6.49
5cmx7cm prototyping board $9.99 for 5
DC Power Jack $8.95
5v DC power supply $5.74
3 pin fan extension cable $3.64
Total $108-$116 depending on whether you need the other 4 prototype boards.

No comments:

Post a Comment