Automatic USB switching

I posted this on the Raspberry Pi forums, figured I should ask here as well.

I’ve been wanting to make a fightstick with a built in Raspberry Pi for a while. That itself isn’t much of a biggie, people have been doing that for as long as the Pi has been around, I would believe. But I want it to function as a regular fightstick as well, and that’s where I run into a problem I can’t solve on my own. The components inside the stick’s case would be connected at all times, obviously, but if you would connect the stick to a console or computer, that connection would take precedence over the connection to the Pi, making it act like a regular fightstick.

How could I achieve this? If it’s even possible to do, that is.

I made a rough visual of the (currently hypothetical) idea:

I would have the joystick and buttons connected to a Brooks UFB which would then be connected to the pi and an external outgoing USB port. The square with the question mark is the issue at hand. One method I’ve contemplated is simply adding a toggle switch, but it’s a less elegant solution and another hole must be made in the case to accommodate it, so it’s not as preferable.

I’ve never tried something like that, but from my knowledge of how these things work, your only option is to have a 4PDT switch to completely disconnected the RPi from the setup when you’re not using it.

  1. As an extension of the golden rule to dual-mods: all PCBs need to be powered if they are connected. You can’t have “floating” signal lines, so if you want this all connected, your UFB and RPi will both need to be powered all the time. So in console-mode, you’ll have to have your RPi fully powered. BUT…

  2. … You shouldn’t have two power sources to your setup. Which means that you’ll need the console (PS3/PS4/X360/XBO) to power your RPi, even when you’re not using the RPi in console-mode. As far as I know, the RPi is rather finicky in terms of power consumption. On the other hand, the PS4 (for example) really doesn’t supply much power via its USB ports. You may have trouble supplying power to all your PCBs if they’re all connected at once, depending on your console. AND…

  3. … You shouldn’t be connecting any controller PCB (especially something like the UFB) to multiple consoles/platforms at the same time. The UFB isn’t just a set of switches in open/closed positions, there’s constant handshakes and communication between it and the platform it’s connected to. If you split the signal into 2 different consoles, something is bound to not behave normally.

So, to sum up: Your “? Block” would have to be either:

  • a 4PDT switch that will disconnect your RPi from the UFB completely (all 4 of the Vcc/GND/D+/D- lines) when you plug it into a console; or
  • a DPDT switch (physical or electronic) that will disconnect the D+/D- lines between the UFB and the RPi, BUT you’ll need to power your RPi by your console, AND ensure that the power provided by your console won’t damage the RPi, AND you’ll have to make sure that your RPi’s external power supply is not plugged in. Otherwise, you risk for something to go wrong.

I say make your stick into a easy open top lid latch like the TE2 ore Razer sticks, and have to physically unplug and plug in connectors to make the swap from Raspberry Pi mode and “controller” mode.

Which could probability be done with some hacked up USB extension cables.

If you want it to be Automatic? Maybe something like this

It not be truly automatic, but you can set it to a button press.

I would not try to power a Raspberry Pi directly off a game console.
Maybe a powered USB Hub with it’s own Wall adapter, but thats it.