Just wanted to report on completing a quick electronics prototyping project – making a very tiny ATTiny45-based simple USB dongle.
I used the blueprints from here: http://macetech.com/blog/?q=node/46
Printed the thing on the Roland Modela in the Media Lab shop, stuffed it with components obtained from DigiKey (links) there are only 5…, and programmed with a combination of the code from macetech and this instructables tutorial, and voilla – it works.
The advantage of the ATTiny45-20 (as opposed to the 45 not ’20’, e.g. ’10’) is that it works at 5V, which is what you get from USB, and also has an internal oscillator and PLL that can go over 20MHz (@ 4.5V-5.5V), which surpasses the USB’s requirements of 16MHz. The ATTinyX5-10 will not do, as it doesn’t go over 10MHz. So basically this chip is all you need to create a USB device, how awesome is that?
This is the image I used for cutting out the board (it is to-scale at 500 DPI, meaning you can use it to mill your own board). The red marking can be used for cutting out the board:
To program it I used a SOIC-8 (the ATTiny25/45/85 package) “clip”, very useful thing!! You can program it after soldering it down to the board with all components. Sadly I couldn’t program when the USB was connected to anything, and had to use a 5V power supply.
For the actual programming I used the ubiquitous AVR mkII ISP with a makeshift 6-pin header for the ISP that connects to the 6 relevant pins on the SOIC-8 clip:
To prepare the connector I used this sheet I made:
Lessons I learned:
- Again, check everything about the ISP programmer wiring. After you’re done checking – check again and use a multimeter.
- pull-up resistor on RESET pin in unnecessary. Sometimes the mkII will say to check it, so then you should know the problem is elsewhere
- DO NOT CONNECT TO USB to power the chip – use external 5v power supply. This is the only way I got mine to work. Apparently something is still going on in the D+ and D- USB lines, and it interferes with programming since the pins are shared.
- fuses need to be: “-U lfuse:w:0xd1:m -U hfuse:w:0xdf:m -U efuse:w:0xff:m” (PLL clock high-speed – 16MHz, no DIV/8). Use fusecalc: http://www.engbedded.com/fusecalc/