FIX: Schematic should probably have a diode to prevent powering Vbus accidentally.

The source for usbdrv.h says, regarding the hardware:

USB lines D+ and D- MUST be wired to the same I/O port. We recommend that D+
triggers the interrupt (best achieved by using INT0 for D+), but it is also
possible to trigger the interrupt from D-. If D- is used, interrupts are also
triggered by SOF packets. D- requires a pullup of 1.5k to +3.5V (and the device
must be powered at 3.5V) to identify as low-speed USB device. A pullup of
1M SHOULD be connected from D+ to +3.5V to prevent interference when no USB
master is connected. We use D+ as interrupt source and not D- because it
does not trigger on keep-alive and RESET states.

I've now got the powerswitch usb echo demo working from an Arduino sketch as I'm flashing an LED every second. The Usbduino shield is in the house. :-)

BTW an error message of the form "error: invalid conversion from `void*' to ..." is because C++ requires that casts from void * are explicit not implicit.

BTW also, an error message of the form "error: expected initializer before int" or "error: expected initializer before int" may be because PROGMEM isn't recognised because you need to include the pgmspace.h file. Use gcc's -save-temps command to look in the .ii file to see if PROGMEM is replaced.

Discovered today that on Linux it's now working okay for HID, seemingly. (Although the first few key presses seem not to be recognised.)

( Site down for around a month )

( 9 July 2008 )

During the downtime I discovered that the Arduino did function as an USB HID keyboard (with one button!) under 10.4 on a PowerBook G4 so it would seem maybe the 10.2 and/or the iBook didn't like it for some reason.

I managed to send standard characters, modified keystrokes (e.g. Command-B), arrow keys and function keys—the latter of which I used to bring the Dashboard up on screen whenever I pushed the button attached to the Arduino.

So, the short answer does seem to be that at least at some level AVRUSB and Arduino can be compatible—I'm not sure if there is a point at which one or other of them will break as I haven't tried anything very sophisticated.

It would seem the "missing first keystroke" issue I noted is a known AVRUSB issue: First key is not sent (hid keyboard) Apparently you can send a dummy empty keystroke to work around it at least.

After much delay, here is the full top and bottom views of my USB mini-shield (on strip- or vero-board) for Arduino, it should be enough for you to reconstruct it:

Note that the traces are cut between the four pins on the USB connector and there are two traces that have drill bit induced breaks.

A couple of days ago I pulled the original PowerSwitch and HIDKeys source I had downloaded into SVN and re-applied the modifications I had made and documented compilation. I'm now working on tidying up the HID Keyboard sample with the aim of uploading "library" and sample sketch.

( 6 August 2008 )

Last week I got a reasonable API/library design implemented.

Added link to PCB pinout of USB socket to 7 March 2008 entry above.

( 12 August 2008 )

Have released a first alpha release 001, by request. See Code section above.

Realised I had planned to change UsbKeyboardDevice method named update to refresh but won't change it for this release.

It was produced more as an test of a KiCad Mac OS X nightly binary but here's an initial rough, untested and potentially inaccurate circuit for an Arduino-based USB "keyboard" device: arduino_usb_keyboard_circuit_001.pdf Note that the current code won't work on it due to moving some of the connections around.

Thanks to xSmurf the apparent cause of the instability has been identified. It appears the timer0 interrupt routine causes the USB side of things to barf. Interim work-around is to disable the timer in setup with:

xSmurf suggested modifying the pre-scaler value for the timer as a possible solution.

( 18 February 2009 )

Earlier in the month I managed to put together a PCB design and etch a PCB with it but haven't uploaded anything until now. The first version had a bunch of connections in reversed order (thanks to using generic connectors on the schematic) but the second revision seems to be functional. The second revision still needs a couple of modifications, mainly to provide support and isolation for the USB connector. The current board did work initially but now seems to have an issue which I need to verify—I think it's a construction issue rather than a design issue.

Here's an etchable image as produced by http://circuitpeople.com/ but keep in mind the socket support holes aren't great and I still have a small problem with my etched board which I haven't 100% confirmed.

@@ TODO : Add photographs.

( 23 February 2009 )

Until I upload the correct code in an archive, here's a library patch that should work:

Changing the demo to only send one character and reducing the delay from 200 to 20 doesn't cause the communication to stall, but then has repeated characters.

( 13 September 2009 )

As part of the Learning About Jog Wheel project I have just discovered something. On a MacBook Pro (which I've mostly been testing on) if I plug a AVRUSB device into the left USB port it fails to enumerate but if I plug it into the right USB port it works right away. This would seem to match what appeared to be inconsistent behaviour I've observed while working on the project... Looks like I need to re-test the things I thought weren't working. :-/

( 16 October 2009 )

Uploaded alpha release 002 of the code (see top of page). This incorporates all the patches to the original code mentioned above AFAICT. It is compatible with Arduino 0016 (not 0017) and the PCB design—either on a PCB or if you modify the protoboard design to work the same way.

Oh, also, I have confirmed that the PCB design is working for me (once you ensure the socket legs don't short out things) so the problem I seemed to witness earlier was presumably due to the USB port I was testing it on. (Which is convenient because I broke a solder joint on the "fixed" one. :) )

( 17 October 2009 )

Worked on upgrading the version of V-USB (formerly known as AVRUSB) used to vusb-20090822. I seem to have merged my changes okay and it appears to work as before. This should in theory incorporate some bug fixes although nothing noticable so far. Also should enable easier use of later examples. Still need to upload the changes.

( 19 October 2009 )

Have begun to port the hid-data example from the latest VUSB code to work on the Arduino to function as a generic UsbDevice capable of receiving and sending data. Have managed to get the device recognised but communication appears to fail.

Have for the hid-data example working on the Arduino—I moved the timer disable code out of the constructor and that seemed to fix things. Code not uploaded yet.

( 20 October 2009 )

As partially documented at Learning About Python and USB I've now got a Python + libusb-1.03 + pyusb-1.x script reading and writing over USB to the ported hid-data Arduino UsbDevice with no driver required on OS X. Code not uploaded yet.

( 22 October 2009 )

I've now got a generic "streaming" usb device implemented on the Arduino. Also a Python interface to it. A couple of demos including one for turning pins (and thus LEDs) on and off. The other implements a "decrypting" dongle. Code not uploaded yet. :)

Oh, I just realised I didn't mention that I actually uploaded the release 003 the other day—that's the one that upgraded to the latest V-USB.

Uploaded release 004 code (but forgot to update the release notes). Needs better documentation. Will be interested in hearing if it works okay for other people.

( 24 October 2009 )

Modified streaming device to have dynamic device descriptor stored in RAM. This enables, for example, vendor and product IDs to be changed on the device rather than at compile time. Tried a couple of known pairs and the vendor was recognised and listed. Note: This approach doesn't allow changing something that changes the size of the descriptor. To do that requires a fully dynamic descriptor created/returned at runtime (which should be possible).

( 27 October 2009 )

Awesome, I've just learned that assembler support in the Arduino IDE patch in Issue 110 has been applied to SVN. I just tested it and the code now compiles out of the box—I tested it with the library in the sketchbook directory. So, this should mean that once IDE version 0018 is released it's fully supported.