Page 1 of 1
Connecting a USB gamepad to the GPIO
Posted: Sat Oct 22, 2016 11:13 am
by powelly52
Hello forum,
Im somewhat new to this and need some help.
what i have is a Pi zero and an aftermarket USB Snes controller.
plugging the usb into the micro usb input works fine but i want to free up that micro usb.
i want to take the wires from the USB snes controller and wire them directly into the GPIO pins on the Pi Zero.
i guess before i ask advice i need to know if this is possible.... should i be wiring the usb wires of the controller to the gpio or should i manually wire each buttons positive to its own gpio and share a ground...
assuming it can be done withe the USB wires...
my first question is where each wire should go.
my second is how do i then make the Pi read these gpio inputs as buttons on a controller.
thanks for taking the time to read, i hope you can help!
Re: Connecting a USB gamepad to the GPIO
Posted: Sat Oct 22, 2016 1:55 pm
by mikronauts
NOT POSSIBLE
Get a hub.
powelly52 wrote:Hello forum,
Im somewhat new to this and need some help.
what i have is a Pi zero and an aftermarket USB Snes controller.
plugging the usb into the micro usb input works fine but i want to free up that micro usb.
i want to take the wires from the USB snes controller and wire them directly into the GPIO pins on the Pi Zero.
i guess before i ask advice i need to know if this is possible.... should i be wiring the usb wires of the controller to the gpio or should i manually wire each buttons positive to its own gpio and share a ground...
assuming it can be done withe the USB wires...
my first question is where each wire should go.
my second is how do i then make the Pi read these gpio inputs as buttons on a controller.
thanks for taking the time to read, i hope you can help!
Re: Connecting a USB gamepad to the GPIO
Posted: Sat Oct 22, 2016 6:00 pm
by powelly52
mikronauts wrote:NOT POSSIBLE
Get a hub.
Thanks Mikronauts for your reply however I'm certain it is possible (see links below)
i just can't figure it out
http://jamespoole.me/2016/02/29/pi-zero ... r-console/
https://www.youtube.com/watch?v=j5dXx0NhLxg
http://blug00.blogspot.co.uk/2016/03/ho ... ropie.html
Re: Connecting a USB gamepad to the GPIO
Posted: Sat Oct 22, 2016 6:17 pm
by rpdom
I think mikronauts misread your post.
powelly52 wrote:i guess before i ask advice i need to know if this is possible.... should i be wiring the usb wires of the controller to the gpio or should i manually wire each buttons positive to its own gpio and share a ground...
It can not be done with the USB wires. You will have to dismantle the controller and connect the buttons to the GPIO.
Re: Connecting a USB gamepad to the GPIO
Posted: Sat Oct 22, 2016 7:17 pm
by mikronauts
buttons to gpio? easy.
usb from gpio (which is what I thought you wanted) not possible (without adding a microcontroller that can do usb otg and supports usb hid)
Re: Connecting a USB gamepad to the GPIO
Posted: Sat Oct 22, 2016 8:25 pm
by powelly52
i have each button wired individually to a gpio pin.
i have one common ground from the board to the ground on the gpio.
i have retropie installed on the SD
what do i do now?
Re: Connecting a USB gamepad to the GPIO
Posted: Sat Oct 22, 2016 8:37 pm
by powelly52
rpdom wrote:I think mikronauts misread your post.
powelly52 wrote:i guess before i ask advice i need to know if this is possible.... should i be wiring the usb wires of the controller to the gpio or should i manually wire each buttons positive to its own gpio and share a ground...
It can not be done with the USB wires. You will have to dismantle the controller and connect the buttons to the GPIO.
i have done this... but what now?
im not sure where to go from here...
Re: Connecting a USB gamepad to the GPIO
Posted: Sun Oct 23, 2016 2:16 am
by mikronauts
viewtopic.php?f=44&t=46525
may help you
be careful, make sure other side of the button is not pulled up to 5v by the joystick, pi gpio is 3.3v only
if it is pulled up to 5v, google voltage divider, you will need two redisyors per button
Re: Connecting a USB gamepad to the GPIO
Posted: Sun Oct 23, 2016 9:37 am
by powelly52
Ok am I missing something here?
For example
I have a wire from from gpio pin6 to the positive side of the button, and a wire from a ground gpio pin to the negative side of the button.
Where does the 3.3v pin come in? Currently there are no 3.3v or 5v gpio pins on the pi being used... do I need to 'power the board?
And if so how do I do that? Do I connect a wire from 3.3v gpio pin to each positive wire? That seems very counter intuitive
Re: Connecting a USB gamepad to the GPIO
Posted: Sun Oct 23, 2016 12:40 pm
by rpdom
If you enable the internal Pull-Up on the GPIO inputs you don't need to worry about connecting to 3.3V. The input pins will read True/1/3.3V until you connect them to 0V by pressing the switch.
Re: Connecting a USB gamepad to the GPIO
Posted: Sun Oct 23, 2016 1:16 pm
by powelly52
Ok so how do I enable the pull-up?
I need an idiots guide to making it work