Author Topic: How can I close an external circuit (button press/switch) with lowest latency?  (Read 856 times)

0 Members and 1 Guest are viewing this topic.

Offline sofakngTopic starter

  • Regular Contributor
  • *
  • Posts: 83
  • Country: us
I'm trying to trigger a button press on a joystick (ie. Xbox controller, Playstation, etc) using a microcontroller.

There are two contacts on the joystick PCB (ie. signal and ground) that simply need to be connected (just like any button) but I'd like to trigger this using the microcontroller.

What is the safest and fastest method?

For example, when the microcontroller triggers the signal, I want the button circuit to be closed as fast as possible (ie. no delay).

My concern is that most microcontrollers are 5V or 3.3V and some joysticks I am using are only 1.8V or might use different voltages.

I think my options are level shifter, relay, optocoupler, or transistor? I think relay will introduce latency (?) and the level shifter requires additional wires (ie. supply voltage) so can somebody explain the best approach?
 

Offline SuzyC

  • Frequent Contributor
  • **
  • Posts: 823
The best way to accomplish a simulated button press would be to use an Optocoupler with a phototransistor as the output pins and any MCU providing the small current to drive the photodiode input of the optocoupler.
An ordinary optocoupler would likely be fast enough, but a fast optocoupler can do this also in 100nS or so.
 

Offline MathWizard

  • Super Contributor
  • ***
  • Posts: 1884
  • Country: ca
So do you still want the mechanical push button switch ? But you also want an electrically controlled switch, attached to the mech SW pads on the PCB, like a BJT or FET, that can be controlled by an MCU ?

I'd want to know more about the signal and circuit, where they come from and where they go. But it should be pretty easy, and plenty fast, especially compared to pushing a button, that on it's own, usually bonces and vibrates for a while when the contacts collide.
 

Online John B

  • Frequent Contributor
  • **
  • Posts: 910
  • Country: au
A regular 817 (PC817, EL817 etc) type optooupler would be more than fast enough. The existing buttons would need some type of debouncing anyways, so the opto won't be the slowest element in the chain.

You can also get them in quad packages to help compact your design.
 

Offline David Hess

  • Super Contributor
  • ***
  • Posts: 17818
  • Country: us
  • DavidH
I have used bipolar transistor output optocouplers to do this.  Nothing special is required.

 

Offline PGPG

  • Frequent Contributor
  • **
  • Posts: 602
  • Country: pl
I think my options are level shifter, relay, optocoupler, or transistor?

If GND is common I see nothing wrong in just using NPN transistor.
 

Online jpanhalt

  • Super Contributor
  • ***
  • Posts: 4261
  • Country: us
If the MCU has open-drain pins, you might be able to use that without an additional device.  Many PICs have them. 
 

Offline BeBuLamar

  • Super Contributor
  • ***
  • Posts: 1592
  • Country: us
I think my options are level shifter, relay, optocoupler, or transistor?

If GND is common I see nothing wrong in just using NPN transistor.

Agree the switching speed of a transistor is very fast. I think the the microcontroller would be the thing that slows it down. Microcontroller has to run some kind of code between getting the input and the output.
 

Offline David Hess

  • Super Contributor
  • ***
  • Posts: 17818
  • Country: us
  • DavidH
I think my options are level shifter, relay, optocoupler, or transistor?

If GND is common I see nothing wrong in just using NPN transistor.

Even with a common ground, which seems unlikely, I would still use an optocoupler to prevent unintended disasters.
 

Offline sofakngTopic starter

  • Regular Contributor
  • *
  • Posts: 83
  • Country: us
Thanks so much for the help everybody!  It looks like I have a few options
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf