Programming USB interface with arduino, questions.

Hello, I am building a 8key mechanical keyboard, so I need at this point the usb interface to communicate with the computer, Vcc, GND, D+ and D- with USB protocols. So theorically I know how to do it, but I never did it before. I just programmed I2C protocols and tested, but never USB.

Has arduino something to do this? I mean a library, or something like I2C (well I programmed I2C but I know it has his libraries, etc...). The USB interface and protocols in order to communitace to a USB Host controller. I will need the interrup transfers (usb 1.0 should be enough for 4bit of information I might use).

Thanks.

Do a search on HID control (Human Interface Device). The 16U2 on the Uno for instance can be reprogrammed to do that.

Buy a Arduino Leonardo or Arduino Micro. They can do that.

Koepel:
Buy a Arduino Leonardo or Arduino Micro. They can do that.

Thanks for the information, I didn't know that. That means that they have a native D+ and D- and libraries to do it?

CrossRoads:
Do a search on HID control (Human Interface Device). The 16U2 on the Uno for instance can be reprogrammed to do that.

Thanks, I an investigating but seems hard to do that.

The ATmega16U2 on the Uno is just a helper chip and that is almost the same as the ATmega32U4 on the Leonardo, but that is the main microcontroller. They have native USB.
With Arduino version 1.6.6 they seem to have changed the way libraries use the USB to make it easier to make it all kind of USB devices.

You could read this : https://www.arduino.cc/en/Main/ArduinoBoardLeonardo
And this : https://www.arduino.cc/en/Reference/MouseKeyboard
With a simple sketch, the Arduino Leonardo acts as a keyboard and you can do everything with every button in the sketch.

There is a disadvantage, the Leonardo uses the USB cable to act as a keyboard, but also to upload a sketch and for the serial monitor. That is a whole lot of confusing things together, but it is possible to turn off what you don’t want.