V-USB development board2017-07-05
Objective Development's V-USB is a firmware implementation of USB for AVR microcontrollers, which means that it doesn't require the chip you're using to have USB support. This can be useful if all you have is an Arduino (or even just a lone ATmega328) and you'd like to use it as a low-speed USB device.
V-USB requires several components between the USB connector and the microcontroller pins. When prototyping on a breadboard, the connections between these get in the way if you're using long jumper wires. It's also a hassle to set them up each time.
My solution is a simple board that contains all the required components and the USB connector itself:
There are a few designs out there for this sort of thing, such as the Metaboard and USnooBie.
However, these are too complicated for my needs, with voltage regulators and jumpers.
I just need something to do the bare minimum necessary to power an otherwise working AVR microcontroller (with its own auxiliary components) with 5 V and get it talking over USB.
Additionally, all the existing designs I've come across hard-wire the
D- pull-up resistor, but more on that later.
I also wanted to be able to use the USB connector on its own, so I made the board modular. Here it is in pieces:
There's not much to say about the connector module, except that the
GND pin is on the wrong side.
The USB pins have an order:
VBUS so that the connections could be as simple as possible:
In this photo, the pins are (from right to left):
The board itself has almost no surprises (except for a fifth pin labelled
PU, which will be explained shortly):
This is using the Zener diode design (see the wiki and git repo), because it's simple and allows the microcontroller to run at the higher clock speeds supported with 5 V.
The diodes I've got are the 1N5227 type (3.6 V, 500 mW).
The bypass capacitor is a 10 µF electrolytic capacitor, like in the Metaboard. According to the USB 2.0 spec (section 18.104.22.168), that's the maximum allowed in the absence of current limiting. I intended to use 4.7 µF capacitors like in the schematics supplied with V-USB, but I didn't have any on hand.
The 68 Ω resistors are termination resistors for impedance matching. Quite frankly, it's a mystery to me how this value was chosen, but it's present on all the schematics I've seen, so that's what I used. From what I've been able to glean, impedance considerations are largely irrelevant for low-speed devices anyway.
The other resistor is a 1.5 kΩ pull-up resistor, which signals that this is a low-speed USB device.
In my opinion, what other schematics get wrong is putting this resistor permanently between
This causes the host to see the device as soon as it is plugged in and powered on, even if the microcontroller isn't ready to talk to the host yet.
This will result in errors on the host as it tries to enumerate the device and fails to get a response.
I've intentionally left this resistor unconnected at the device end (instead going to pin
PU) to make use of V-USB's
If the pull-up resistor is connected to the pin specified in the configuration, the firmware will be able to toggle it at runtime, so the host won't see the USB device until the microcontroller is ready.
It turned out to be possible to place the components in a way that all connections could be made with solder bridges: This would never fly for a high-speed device (e.g. see Intel's guidelines, which specify PCB trace requirements down to sub-mm scales)!
Sadly, I neglected to take into account how stiff and heavy USB cables with standard type B connectors are. If the board is plugged into a breadboard, there's a lot of strain: One way around this is to use a female-female coupler (makeshift in this case), bypassing the breadboard entirely: Then the cable can lay where it wants and the board follows it. Since micro- and mini-USB cables tend to be more lightweight, it might be sufficient to use one of those connectors instead, but all the ones I found were surface-mount, which is not perfboard-friendly.