1

I have a gamepad which I want to treat as a sensor for my Arduino board. I want Arduino to trigger a certain action based on button pushes from the gamepad. Different buttons, different actions.

The gamepad comes with a USB connector. I cut the the USB cable open, solder it with pluggable pins which are then connected to a breadboard. I supply the gamepad with 5V power from Arduino and connect the USB's Data+ to Arduino's analog input pin (A0). Please check the images below.

I thought by observing the voltage coming from the gamepad's Data+ pin, I can probably determine if a button is being pushed. However, the observable input voltage in Arduino's A0 do not produce any meaningful difference between button push and release.

My question: Is it possible to detect Gamepad's button pushes with this arrangement? If it's possible, where do you think I'm doing wrong?

USB Gamepad and Arduino

schematic

simulate this circuit – Schematic created using CircuitLab

7
  • You arduino doesn't have USB host controller, so you can't. You have broken the gamepad for nothing..
    – Eugene Sh.
    Commented Dec 30, 2015 at 16:08
  • 1
    Ok thanks for mentioning USB host controller, that's the lead that I need!
    – Andree
    Commented Dec 30, 2015 at 16:16
  • 1
    Adding a USB host controller to an Arduino is technically and economically silly. You'd be better off with something like a kl25z which is cheaper, more capable, and has that built in. Or you can gut the gamepad and replace the electronics. Commented Dec 30, 2015 at 16:37
  • 1
    ... or buy a real SNES gamepad, which just uses a simple shift register if I'm not mistaken.
    – pipe
    Commented Dec 30, 2015 at 16:38
  • 1
    Yes, the real SNES or Megadrive gamepads are much easier to read.
    – pjc50
    Commented Dec 30, 2015 at 18:04

2 Answers 2

2

As mentioned, the problem is the gamepad you have uses communicates over USB, which requires a USB Host chip to communicate with. However, USB Host shields can be found on eBay (under "arduino USB Host shield") from US$10, and they come with a USB socket, so you could use it easily with another gamepad that hadn't had the connector snipped. This also would allow use with HID devices such as mice and keyboards if you wished, so a worthwhile shield to own.

0

USB devices make a serial communication, a series of packets of bits are sent and received, which is not beyond your power to learn and talk with. Using a USB Host shield or a chip would be easier (and more costly), but doing it yourself will be much more fun and educational.

Surprisingly, for some USB devices (like a keyboard) you need to poll the data. Nothing will be sent to the host automatically. To find out the protocol they speak, you need to connect the game-pad to a PC and monitor the signals.

Also you need to monitor both D+ and D- signals, they are both used.

Here is a wonderful video by Ben Eater about the USB Keyboards where he goes deep into monitoring the signals and the protocol, can be a good start for your project: https://www.youtube.com/watch?v=wdgULBpRoXk

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.