Go Down

Topic: turning arduino nano v3 into HID input controller (Read 21856 times) previous topic - next topic

Bfig

Hello, this is the first time i try my hands on DIY electronics and i thought (maybe incorrectly) Arduino nano was optimal for my purposes.

Since i was 15 or so i've wanted to get my hands on a real arcade controller to use with my computer... and now i have (sort of) the knowledge to assemble one myself :).

My idea is this: turn the nano v3 into an HID controller, that way i can share it with my brother's pc (windows) and get some experience with the standard if possible.

I've not found yet how to make the arduino act as an HID device but that's not really a problem now. The thing i'm most worried about right now is the electrical stuff. To be honest i don't know much about what might break the thing apart.

So far i've found a piece of plastic foam to protect the contacts and have tried connecting it and uploading some software to touch the lights... i've also have a general idea of how to capture the button presses from software.

Pressing questions i have right now:

1) what is the safe way to connect several (joystick plus 3-6 buttons) to the board? i understand i need to add some resistors and maybe some other electronic components to make the numbers add up.
2) what mechanical problems could occur in the buttons? somebody told me there are possible problems related to vibrating metal making and breaking contact quickly and i should use capacitors or some other component to make sure i don't capture this mechanical noise
3) are there examples of arduinos turned HID? i've tried looking around but no project specifically turned an arduino to an HID device.

Please let me know if you have some good advice you'd like to share. By the way, i also bought a proto shield and a small breadboard.

This things so far are awesome and i'd like to avoid burning it!

Thanks in advance,
Bruno Figares

MaxDamage

Have you looked at the Teensy 2.0 ?    It is a small MC that can do this nativly.   It also uses arduino dev enviroment.   I used it to create a hid key and mouse sender.    I also built a hardware key logger with it.  Brilient little MC and only $16.    www.prc.com   I think.

Max

FutureInventions

Hi!
I'm not sure what you mean by an HID controller, but I'll be happy to help.

What you were talking about with the buttons vibrating is called bouncing. This can be bad for a switch that toggles something, for example, because the the arduino will register multiple presses and releases. Fixing this problem is called debouncing. You can go about doing this in a sketch a number of different ways, but most of them are confusing, so I would recommend using an arduino library like this one. http://arduino.cc/playground/Code/Debounce

You actually don't need resistors for the buttons if you wire them a certain way. Normally, with a button, one lead would go to positive 5V and the other to whatever pin on the microcontroller. The lead connected to the microcontroller would also be attached to ground via a 10k ohm resistor. The resistor in this case pulls the pin to ground so that the arduino can tell it's not pushed. It is called a pull-down resistor.

An alternative to this is using the internal pull-up resistor in the arduino. It's a lot simpler than it sounds. Just connect one lead of the switch to ground, and the other to a pin on the arduino. Here's what you would do in the sketch though:

int buttonpin = 5; // The button is connected to pin 5. This variable is a placeholder for 5, basically.

void setup() {
pinMode(buttonpin, INPUT); //We are saying that pin 5 (that the button is connected to) is a digital input

digitalWrite(buttonpin, HIGH); //Now the pull-up resistor is on!
}

Hope this helps! :)

-Dylan

Brad Burleson

Bruno-

I really hate to say this but I'd have to agree with Max and suggest that $16 for a Teensy would probably be the easiest (and cheapest) solution.

Take a look at some of the examples on the PCJR site such as http://www.pjrc.com/teensy/usb_keyboard.html.

If you don't have one already, you should also get a solderless breadboard - is invaluable in creating prototypes.

FWIW,

Brad (KF7FER)

PS I did find a site that has a HID shield that would work with a nano, take a look at http://www.circuitsathome.com/arduino_usb_host_shield_projects for more ideas/info

Bfig

Hello everyone, thanks for the replies

I've checked the Teensy and it seems like a decent alternative. What i already got was this: http://www.dealextreme.com/p/arduino-nano-v3-0-81877 (if the link is inappropriate, remove it please!), so from the price point of view it's not a problem.

@FutureInventions

I probably named the thing inaccurately: i want to go from arduino nano => HID standard compatible joystick.

As soon as my joystick pieces come around i will build a schematic and share it with you (for the electrical side of the business)

On the software side, i'll have to learn how the arduino communicates through usb or how to make it communicate...

Thanks for the links and ideas, i'll be studying now. I'm gonna check the HID standard and the usb standard and see what i can put together.
Bruno Figares

VT91

I am new to the subject of HID USB. So why is Teensy better than Arduino Nano for USB HID interfaces?
What exactly keeps those FTDI USB chips from being accepted well by the (Windows) Operating System?
Thank you
Vladimir.

Bfig

On an interesting turn of events, I just got an email from your post, since I was following the thread.

My joystick parts never arrived, the company I ordered from went out of business and disappeared out of the face of earth (lizardlick.com, taking my 70+ bucks down with them).

Damn shame, I was pretty excited by the project. I still have my arduino around, but I've been working on software stuff and now I don't have time for this :(.

Hopefully at some other time I make something interesting out of it :).

Go Up