Fun with ATtiny and V-USB
2011/10/19 10 Comments
Sometime you have to do build just for the fun of it.
Recently, while I was about to order a set of PCBs from my favorite website, I told a friend about a really funny project based on the V-USB stack with ATtiny devices, and he was impressed by the size of the thing… So I decided to design my own ATtiny V-USB board!
This project is a really small USB gadget without any specific I/O, and it’s designed to fit into a USB connector with the exposed PCB as small as possible.
The original idea for this board was to use it for April-fool like jokes, but the project also uses a couple of interesting features of the V-USB stack.
To build such a small board, you have to use as few components as possible.
The microcontroller works at 3.3V, so that it does not need clamping diodes. It still needs two series .7V drop diodes to get the ~3.3V from the 5V input. In the PCB I placed two SMD diodes footprint, but later I modified the design to use a BAT54S I had laying around.
The microcontroller footprint can fit an ATtiny45 or any other SOIC8 AVR. As the board is really small, there is no programming connector. That means that the microcontroller have to be programmer offline or you have to solder a temporary connector to it.
For this reason, there is a solder-jumper on the PB3 pin, which was provided to activate an internal bootloader, such as a modified version of the AVRUSBBoot. Unfortunately, I only had some ATtiny25 available, so I never used the bootloader option as my microcontrollers barely have the memory for a simple USB application.
The USB contact pads are the one designed by SparkFun, and provided on their free library. It works great but the 1.6mm PCB is a little to thin, so you have to add a small spacer on the bottom of theboard.
The microcontroller runs at 16.5MHz, without any external oscillator. This means that the fuse have to be modified to the one indicated in the Makefile and that firmware have to implement the oscillator calibration function as demonstrated in the EasyLogger firmware.
The firmware I had in mind at the time was something similar to the “Haunted Cable’s” one, but here I’ll just provide an hid-mouse example firmware version, modified to run on the ATtiny25 without external oscillators.
Recently I used this board with a vendor-specific class USB firmware to add a tiny light sensor to one of my home systems… I think that’s a good platform for simple single-sensor-boards. Keep an eye for future posts about it!
The PCB and example firmware source files are available on GitHub.
The schematics in PDF version can be downloaded from here.