LEDstrip using a Digispark
I am using Chinese clones of the Digispark that have the reset pin enabled (thus making the P5 pin unusable). I have first uploaded a new version (2.3) of the Micronucleus bootloader and then disabled the RESET pin. This way, the bootloader is much smaller and more bug-free. It needs a new Micronucleus to upload the programs, though (and optionally modification of the boards.txt file).
By default, Micronucleus waits 6 seconds before it will conclude there is no
computer connected. This is (as far as I can see) far longer than actually
necessary. A single second is long enough. Therefore, I have built a special
version of Micronucleus (version 2.3) that reduces this delay. You can change
this by setting
AUTO_EXIT_MS to 1000 (in
firmware/configuration/t85_default/bootloaderconfig.h of the Micronucleus
Additionally, the version of Micronucleus that is shipped with the Digispark is very out of date. Newer versions are much smaller and in my experience also much more stable (it has less connection problems).
You need an AVR programmer for installing a new bootloader. Luckily, if you have another Arduino you can use the Arduino as ISP sketch to emulate a programmer (I think it's even possible doing this with another Digispark, but I haven't tested this).
Alternatively, you can run an in-place upgrade. I have added the file
bootloader_upgrade_t85_1sec.hex which can be installed using Micronucleus, as
usual. After Micronucleus is done, wait ~10sec, then unplug and replug, and wait
another ~10sec just to be sure it has run (note that it runs as user program, so
it will need 6 seconds to start and then some time to upgrade). The
contains some additional details. Note that there is a small chance it will
brick the chip, especially when you unplug it during the upgrade. You can also
add a LED or buzzer between
P1 for the signal it is ready.
To install the new bootloader (replace
$ARDUINO_DIR with the installation
directory of the Arduino IDE software):
$ avrdude -C$ARDUINO_DIR/hardware/tools/avr/etc/avrdude.conf -v -pattiny85 -cstk500v1 -P/dev/ttyACM0 -b19200 -Uflash:w:bootloader_t85_1sec.hex.hex:i
Now test the bootloader by installing a sketch using the
command. After you've disabled the reset pin, there's no going back (unless you
want to buy or build a high-voltage programmer to reset these fuses).
Command to disable the reset pin (WARNING: this effectively locks the bootloader):
$ avrdude -P /dev/ttyACM0 -p attiny85 -c stk500v1 -v -b 19200 -U lfuse:w:0xe1:m -U hfuse:w:0x5d:m -U efuse:w:0xfe:m
Now you should be able to run the sketch without reset.
|P0||button: change animation mode|
|P1||LED strip signal (configured for the WS2812 and 30 LEDs)|
|P2||LOW (for a button over P0-P2)|
|P3||LOW (for a button over P3-P5)|
|P5||button: change speed of animation (6 steps)|