USB stick with attiny85

About a year ago, I made a sort of a DigiSpark, or LittleWire clone on a stripboard. I've come back to it now and made a couple of shields.

All the pins are brought out to female headers and it has a very small "breadboard" area, so that I can test small parts right away (see pictures below). It is also easy to make "shields" from a piece of a protoboard: I've made a "RGB LED with a button" and a "LittleWire/ICSP header" ones.

I've flashed it with micronucleus bootloader (the same as is used on a DigiSpark), which makes it very easy to switch firmware even with the reset disabled (through fuses).

LittleWire firmware makes it exceptionally easy to use it as an AVR ISP programmer (with the ISP shield), or for testing I2C or analog sensors (picture below with a photoresistor). Especially with Bluebie's littlewire.rb ruby bindings.

The piece of tape on top of the attiny is a trick I've learned from vusbtiny on a breadboard: you can flash firmware to attiny45/85 chips by just sticking them on top of the attiny in the stick --- letting them "ride" the programmer. The tape prevents the connection of the two pins that communicate with the computer.

How to make one yourself

Parts

Layout

Notes

Schematic

Note that it is compatible with DigiSpark and LittleWire (D- (the one with a pullup) is connected to pin 2/PB3 and D+ is connected to pin 3/PB4), but not with vusbmicro or vusbtiny on a breadboard: those have the signals reversed (D- to pin 3/PB4 and D+ to pin 2/PB3).

Firmware

Get some version of the micronucleus bootloader firmware from here (the standard one is fine) and flash it to your attiny85 --- you'll need an AVR ISP programmer for that. If you have a spare Arduino, you can use it as a programmer, see e.g. here.

Flash the bootloader with (adjust according to your setup, it should be on one line!)

avrdude -c arduino -p attiny85 -b 19200 -P /dev/tty.arduino_tty -U flash:w:micronucleus.hex

Set the fuses.

avrdude -c arduino -p attiny85 -b 19200 -P /dev/tty.arduino_tty -U lfuse:w:0xe1:m -U efuse:w:0xfe:m -U hfuse:w:0xdd:m

(Option: disable reset: this means that you can use PB5/pin 1 as a normal pin, but also that you can no longer program the attiny with an ISP, only through micronucleus. I think DigiSpark ships like this by default. If you screw up, you can try to reset the fuses with some High Voltage Serial Programmer (you can use an Arduino even for this: ScratchMonkey, but you'll need some extra parts). So, if you want to do this, use -U hfuse:w:5d:m instead of the hfuse part above.)

Now the attiny is programmable via micronucleus, so you'll need to get a micronucleus command line program for flashing from here, or build it manually, sources here.

So just pop the programmed attiny into the socket, and you're good to go! A good start for experimenting is the LittleWire firmware, so head over here, get a LittleWire firmware and flash it with

micronucleus --run LittleWire_v13.hex

Have fun!