Search code examples
androidkeyboardusbarduinoadk

Android ADK - Working on a gamepad


I am working on a new idea and the code is going very well, but I am facing some issues and need your help.

I have recently bought an old and broken gaming station at a ridicoulous price (I don't know the exact English word), and, as it is very old and broken, I had the idea to replace it with an Android OS (I have seen many Android USB sticks or Raspberry Pi) and a TFT screen.

Enter image description here

The Arduino and buttons wiring is working fine, and I can read the output when I press a button.

Enter image description here

So, my next step will be to buy a USB Host shield similar to this one: http://www.circuitsathome.com/products-page/arduino-shields/usb-host-shield-2-0-for-arduino.

But now, I really would like to know how I can tell Android that this future device will act like a keyboard.

I will need to bind some buttons to the up/down/left/right arrow...

I also would like to bind some buttons to "home" or "back".

So, what are the practice to achieve that?

Will I need to create a custom keyboard?

All I can find is in USB Accessory, but there is not much information.


Solution

  • Will answer myself, Q&A style, after a whole night of search!

    The only solution I have found is to turn my Arduino into a USB keyboard and that seems rather simple: http://hunt.net.nz/users/darran/weblog/b3029/

    You have to flash an alternative firmware that will turn your arduuino into a USB keyboard.

    hex file to flash and demo project on the link.

    That means that I can programmatically send keystrokes to an Android via USB.

    The only problem I am facing is the debounche that I need write myself and seems quite complicated.