[Coco] Arduino as a Mouse/Keyboard interface?

Andrew keeper63 at cox.net
Wed Jul 4 13:58:06 EDT 2012


All,

I am not going to claim I am an Arduino expert, but I have been a very 
frequent contributor to the Arduino forums for a few years now, and I 
own a few Arduinos (take it for what it is worth).

First, the Arduino Uno is composed of a couple microcontrollers (uC), 
the prime one being the ATMega328P. Secondary to this uC, is another 
microcontroller which acts as the USB-to-serial interface, an Atmega16U2 
(or an Atmega8U2 up to version R2):

http://arduino.cc/en/Main/ArduinoBoardUno

This 16U2/8U2 took over the functionality of the FTDI USB-to-serial 
driver chip which was used on the earlier Arduino Duemilanove:

http://arduino.cc/en/Main/ArduinoBoardDuemilanove

I don't know what the "official" reason was for the change to the 
16U2/8U2 for USB-to-serial functionality, but I suspect it was two-fold:

1) An attempt to future-proof the device
2) Programmability for customization

Both are basically the same; by using a microcontroller to do the 
USB-to-serial conversion, particularly a uC in the same family as the 
base uC (328P, etc), going forward more functionality could be added as 
needed, or if the uC for the USB-to-serial was dropped by Atmel, another 
could be substituted.

For instance, there's no reason at all that you couldn't use an 
ATMega328 as the USB-to-serial chip; this doesn't make much sense in the 
case of an UNO, but it would certainly be doable.

Now - in the past (prior to the UNO), there were successful attempts 
using a custom shield to interface the 328P on the Arduino to USB as a 
host. I would be willing to imagine (not having seen the software in 
question, of course) that somebody out there has reprogrammed the 
16U2/8U2 uC on the Uno to act in a similar manner - becoming a host 
interface. All the pins for programming the controller are brought out 
on the Uno (but no header is installed); IIRC, you have to use an ISP 
programmer (which could be another Arduino or a standalone unit).

That would be my guess as to what Allen saw, or something similar (maybe 
something like the earlier homebrew shield, but maybe not in a shield 
form-factor, but wired with jumpers, or as a "standalone" project).

Whether one could do keyboard and mouse at the same time, though, would 
be a different thing; the main issue would be memory (both flash and 
SRAM, but SRAM mainly, I think). Even so, a Mega could solve that issue.

I am not very familiar with the Arduino Leonardo; it is still a very new 
beast, and not many people are using it. It is based around the 
ATMega32U4, which has built-in USB device capabilities - which is 
different than how the UNO operates:

http://arduino.cc/en/Main/ArduinoBoardLeonardo

The board is simplified; while you gain certain functionality, you 
likely lose the ability to repurpose the Arduino as a host device 
(outside of the "external shield" approach).

All of this will likely become a moot point if/when the Arduino Due 
comes on the scene...

Andrew L. Ayers
Glendale, Arizona



More information about the Coco mailing list