# Complete a circuit for controller buttons

#### btspp

##### Active member
Can the Teensy complete a circuit programmatically if it’s wired to both wires of a controller button?

Sorry, not sure what you are asking.

Yes, the teensy can obviously complete circuits. For example, it can turn on LEDS, and the like.
But I don't think you are trying to ask for the trivial answer.

But you need to give more information to give you better answers. Note I am a programmer not an EE. so hopefully
if more complex issue, someone can give specific information.

For example, you mention a button. How is this button wired up?
Are we talking a simple push button? What are the two sides of the button. For example is one side simply tied to ground or some voltage
and the other side is used to sense the button being pressed (either going low or going high) and it is pulled up or down (either internally or externally)
Then you should be able to do it with just one IO pin. directly or indirectly. That is if the circuit is running at the same voltage as the teensy and/or on T3.5/T3.2 that is
<= 5v, then you could do directly. If voltage > what the pin can handle, then you need some way to convert the voltage or the like:

If the button is something like an on/off button and it is sourcing lots of current, then you probably don't want the teensy to source the current... So you may need something else, like transistor, relay...

But again, depends on the details

This would be for a button on an Xbox controller. I don’t know how it’s wired. By both sides, I mean the circuit wires going in and out that pressing the button would complete.

btgspp:
Here is a picture of an approximation of what teensy's can do:

Picture if you can 3.3 volts connected through a resistor to pin 1,
Ground through a resistor to pin 3,
Pin 2 is the output pin of the teensy which can be programmed to switch to high(pin 1 through a resistor to 3.3vdc), the center pin which is floating, or low(pin3 through a resistor to ground).
This is a very rough approximation of the functions of the digital pins, the analog pins is another post completely.
It sounds to me that what you would be trying to accomplish is the function of a relay, or a switching transistor, controlled by one of the Teensy's digital output pins.

It would be much easier for us EE's if you could give more detail about what you are trying to do, perhaps a schematic or picture.

Regards,
Ed

As Ed and I mentioned, you probably need to do some investigation on how the different buttons and/or other parts of the XBox One (or other) controller are wired,
if you wish for the Teens to stimulate the press.

There are several different ways that some of these buttons and controls might be wired.

Example:

simple buttons. Where one side of the buttons are tied to either GND or some voltage, lets say Vin. The other side is typically pulled to the opposite side through either a Pull UP or Pull down resistor, which could be built into an internal processor or through an external Resistor. Note: I am assuming Normally OPen type button here. (Only makes contact between the two sides when pressed). So, for example, if the button has GND on one side and a PU on the side the at connects up to the IO pin, then when the button is not pressed, it will logically read high. when pressed it will short out the signal, so it will read LOW... Probably easy to emulate, by adding Teensy IO pin to the signal side and pull it low when you wish to emulate a button press.
Obviously opposite if button has +vcc on the one side and a Pull-down resistor on the signal side.

But maybe they use a button matrix instead. Guessing not, but for that you would need to setup IO lines on both sets of the IO pins. and figure out what they are doing.
For example with a 4x4 matrix, you use 8 pins to be able to read in 16 buttons.

Or again maybe not likely, maybe they used some form of resistor divider type circuit, to read in through an analog pin, the state of multiple buttons. I have used this before, a long
time ago, on my own remote..

Then some of their buttons, are not just simple on/off, but are probably analog. This includes the actual joysticks as well as the RT and LT buttons.
These may be harder to emulate, without using something like an external DAC (Digital to Analog converter).

Then there are probably things like Gyros and ...

If you want to provide a relay function to connect two wires carrying AC or DC for a load, I recommend using a Teensy digital I/O line to control an opto-isolated solid state relay. As an example consider a part such as the LCA127 from Ixys available from Digikey in several packages. This is a SPST relay good for 200ma and 0-250V. It is a MOSFET relay contact so it can be used for both AC and DC contacting. The logic control drives the internal LED of the optocoupler and only requires about 5ma to activate the relay. You can sink current to GND through a resistor (~300 ohm ) in open collector mode from 3.3 V to activate the relay. Other ratings are available depending on the voltage and load current you need to handle.