This is another short example of a demo application that makes use of the V-USB library together with an Arduino. I show, how an USB keyboard functionality can be implemented.
The motivation: The V-USB library provides a quite simple possibility to realize USB devices with arbitrary USB descriptors. This is useful, for example, if the device that you want to connect to can only handle certain types of USB devices. The V-USB library allows you to implement exactly the device descriptor that can be understood by the other device.
This exemplary project is a summary from various sources. I do not want to repeat all the detailed explanations from these sources in the following, but rather show how to build a working example. For a deeper understanding I give a list of usefull links that should help for an understanding at the end of this post.
- 1 Arduino board. I have a Duemilanove, but I assume that any other board (even any other ATMEGA controller?) would also do.
- For the USB interface:
- 1x USB “B” female socket
- 1x 2K2 (i.e., “2.2 kilo Ohms”) resistor, 1/4W
- 2x 68R (i.e., “68 Ohms”) resistor, 1/4W
- 2x 3.6V Zener diode, 1/4W
For the button:
- 1x switch/push button etc.
- 1x 10K resistor
For the assembling, we need a breadboard and some jumper wires. I used these schematic for setting up the button circuit:
To give you an idea about how everything could look after assembling, here is my circuit:
More details about this small USB keyboard project can be found in the book “Practical Arduino“. If you feel that you lack some more basic understanding of the Arduino and microelectronics, the short book “Getting started with Arduino” provides a really nice introduction to these topics. Detailed tutorials about the V-USB library can also be found in the blog of Joonas Pihlajamaa.