Monday, May 16, 2011

USB prototyping board part 1: Design and Schematic

The USB connector has become the lingua franca of electronics. Whether you need to receive data, send data or just get quick access to DC power, the little USB plugs are now the preferred way to interface with gadgets large and small. Unfortunately, getting USB to work with hobbyist electronics is still a bit of a black art. In order to facilitate experimentation with USB-connected devices, in a series of blog posts we are going to develop a basic, cheap, low part count USB prototyping board.

This project will also double as my first-ever PCB design

Design Outline
There are AVRs that include a USB controller on the microcontroller die, but they are only available in hobbyist-hostile TFQP packages. Instead we are going to base the design on a small 8-bit AVR micro-controller using the VUSB firmware-only USB stack. We want to keep the part cost down, as well as the PCB real estate footprint so that we have more room left over for prototyping. To that end we select an ATTiny micro-controller in DIP8 format. Our micro-controller needs to have at least 4kB of flash memory. The VUSB stack needs 2kB, and we need enough flash left over for the application we are going to prototype. Our micro-controller will be the ATTiny45.

Our main challenge is micro-controller pin allocation: of the eight in the package, two are used up by power and ground, and another one is used up by reset to enable in-system programming. Another two are used by the differential USB transmission lines D+ and D-. Since we'd rather not sacrifice two of our three remaining pins to connect an external clock source (crystal), we will need to use the internal clock at 16.5 MHz. This means that we need to run the micro-controller at 5V. 

According to the VUSB documentation, the reference project for running VUSB ousign the microcontroller's internal oscilaltor is EasyLogger. We will be using this design as a starting point.

Schematic

As I mentioned before, the schematic is derived from the Easylogger.

Because we are running the micro-controller at 5V, we need to adjust the pull up resistor (R3) upward from 1K5 as mandated by the USB standard so that the proper voltages are seen on the bus on the host side. We also need two zener diodes to limit the voltage on the USB bus. Tip: if you can find LEDs with a forward drop between 3.3V and 3.6V (usually blue), you can use them instead of the zeners to get instant activity indicators. Remember that in this case you need to forward-bias them by connecting the cathode to ground.

We have added two additional connectors. The connector labelled ISP is a standard 6-pin in-system programming connector. This will allow us to program the micro-controller without having to remove it from the circuit. The pull-up resistors on the NRES (R4) and MOSI (R3) pins have been dimensioned not to interfere with ISP. If ISP is not required, this connector can be left unpopulated.

The connector labelled PROTO is a female six-pin connector that enables us to quickly wire any micro-controller pin (with the exception of the ones used for USB communication) to a breadboard using jumper wires. If this functionality is not desired, the header can be left unpopulated. The pads can be connected the prototyping area using components of the circuit being prototyped, wiring or zero-ohm resistors. Note that adding strong pull-up or pull-down resistors to the pins used for ISP can interfere with programming.



No comments:

Post a Comment