Introduction: Adding Digispark (with Bootloader) Support to Existing Arduino 1.6.x IDE

Digispark is small Arduino IDE compatible development board based on the Atmel attiny85 that directly connects to USB. It has very few pins, but still can do some neat things. Digispark is copyright by Digistump LLC (digistump.com) and the full license is here: Policy

There are some good tutorials out there on setting up a new Digispark environment, but the ones I found were all geared toward having a completely separate Arduino IDE. If you already have Arduino 1.6.x installed and working, and just want to add Digispark support to that environment without having to create a second Arduino IDE just for digispark, then this tutorial is for you.

Additionally I'll show you how to add support for burning the micronucleus bootloader, the one used by the Digispark, into a new attiny85 from the Arduino IDE, something that current Digispark IDE doesn't allow you to do.

In the notes below, [home] is used to indicate your Arduino directory (where you save sketches), usually in "My Documents/Arduino".

Step 1: Adding Digistump Support to Existing IDE 1.6.x

Download the digistumpIDE zip file from the digistump website (Digistump Software), do not download the installer version, you want the zip file version. At the time of this writing, the file name of the current version was digistumpide1.5.8c.zip. The downloaded file is a complete Arduino IDE, but we only need the parts for digistamp support since were assuming you already have a working 1.6.x Arduino IDE installation. From inside the zip, extract hardware/digistump directory into [home]/hardware directory (usually in My Documents/Arduino/hardware). The extracted directory tree is large at 67MB and since we are only looking to add digistamp, you can delete the [home]/hardware/digispark/avr/sam" tree which takes up 60MB and already exists with the base Arduino IDE installation.

Modify [home]/hardware/digistump/avr/platform.txt to point to the digistump version of avrdude by doing the following: Change this line:

tools.micronucleus.cmd.path={runtime.ide.path}/hardware/digistump/avr/tools/avrdude

To this:

tools.micronucleus.cmd.path={runtime.hardware.path}/avr/tools/avrdude

Step 2: Install Micronucleus USB Driver

This driver is used to talk to the micronucleus bootloader on the attiny85 to load sketches into the device. It can be installed either from the digistumpIDE download, or you can download it from the micronucleus git hub which is what I chose to do (Micronucleus site). The file is called micronucleus-t85_winDriver.zip. Unpack this to some location on the PC and run the "installer_x86.exe". If you want to use the one bundled with digistump, find DigisparkWindowsDriver\InstallDriver.exe that is part of the digistump download in step 1, extract that directory tree and run the installer. If you have issues with the driver, these can often be fixed with a program called Zadig.

Step 3: How to Add Support to Arduino IDE for Installing the Bootloader in a New Attiny85

By default, the Digistump/Arduino IDE does not support installing the bootloader on a new attiny85. It's fairly simple to add this support to your existing Arduino IDE. Building your own "digispark on a breadboard" isn't too difficult either and just requires a few components, but I won't be covering it here as it's covered in other people's tutorials. Support for the digispark pro using micronucleus v2 can also be added, but I don't have a Digispark Pro board to test it with so it's not included here. Instructions on how to manually install the bootloader on a digispark pro are located here Digispark Pro bootloader.

Download the bootloader hex file from the micronucleus git hub site, use either the micronucleus-1.06.hex or micronucleus-1.11.hex. The 1.06 version has had more extensive testing with digispark, however I'm using 1.11 which has worked fine so far. Under [home]/hardware/digistump/avr create a directory called "bootloaders" and place the micronucleus-1.11.hex (or micronucleus-1.06.hex or both) file in it. If you choose to use the 1.06 version, be sure to modify the digispark-tiny.bootloader.file parameter below as appropriate.

Add the following lines to the [home]/hardware/digistump/avr/boards.txt file underneath the digispark-tiny.upload lines.

digispark-tiny.bootloader.tool=arduino:avrdude

digispark-tiny.bootloader.high_fuses=0xDD

digispark-tiny.bootloader.extended_fuses=0xFE

digispark-tiny.bootloader.low_fuses=0xE1

digispark-tiny.bootloader.file={runtime.hardware.path}/avr/bootloaders/micronucleus-1.11.hex

Add the following lines to [home]/hardware/digistump/avr/platform.txt underneath the tools.micronucleus.upload lines.

tools.avrdude.erase.params.verbose=-v -v

tools.avrdude.erase.params.quiet=-q -q

tools.avrdude.erase.pattern="{cmd.path}" "-C{config.path}" {erase.verbose} -p{build.mcu} -c{protocol} {program.extra_params} -e -Uefuse:w:{bootloader.extended_fuses}:m -Uhfuse:w:{bootloader.high_fuses}:m -Ulfuse:w:{bootloader.low_fuses}:m

tools.avrdude.bootloader.params.verbose=-v -v

tools.avrdude.bootloader.params.quiet=-q -q

tools.avrdude.bootloader.pattern="{cmd.path}" "-C{config.path}" {bootloader.verbose} -p{build.mcu} -c{protocol} {program.extra_params} "-Uflash:w:{bootloader.file}:i"

Note: Unlike with a purchased Digistamp, the fuse settings above do not make the reset pin available for I/O. If you wish to use PB5 of the chip for I/O, change the High fuse to 0x5D, but understand you will no longer be able to use an ISP to program the chip such as an Arduino as ISP or USBasp, you will need high voltage serial programmer (HVSP), significantly reducing your options if you brick the chip.

To actually burn the bootloader, you will need an ISP programmer. Most people use an Arduino UNO or similar, load the ArduinoISP sketch, and wire up a simple breadboard to do the programming. There are many tutorials that do a great job describing how to do this so I'm not going to cover those details here. Other AVR ISP programmers can also be used that the Arduino IDE supports.

Step 4: Uploading Software to Device

Assuming you have a working Digispark, either one you purchased or one you built on a breadboard, it's now time to upload a sketch. One thing that is different from other Arduino development boards is that the digispark must be disconnected from the USB port until the upload process requests it be plugged in. If you leave it plugged in and try to upload, it will fail with an error message.

In the Arduino IDE select your board as "Digispark (Default - 16.5mhz)" in the tools menu and your programmer as "micronucleus". Compile and upload in the Arduino IDE as usual, wait for the instruction to plug in device then plug in in the bottom of the IDE window (black background portion). If all went well, programming will complete without error. It's also possible to upload outside the IDE using micronucleus.exe passing the file name of your compiled program in intel hex format.

Comments

author
diy_bloke (author)2016-02-19

Tnx for explaining.
Till now I have been less than happy with the Digispark. I got everything working about 1-2 mo ago which wasnt easy on windows 10 coz it is fussy in installing drivers and then when today i wanted to do something serious with it, I couldnt fin the entire board anymore in my Boards list.
OK try again to install, and oddly no more windows drivers. Installed those with Zadig (coz windows 10) .
Now in the programmers list I only find the 'micronucleus programmer' not the Digispark programmer and it still isnt working. get the message:

Arduino: 1.6.7 Hourly Build 2015/11/27 03:44 (Windows 10), Board: "Digispark (Default - 16.5mhz)"

Board digispark-tiny (platform avr, package digistump) is unknown

I foresee several hours digging on th einternet again to get this solved unl;ess u could point me in the right direction :-)



author
tomatoskins (author)2015-05-23

Great info! Thanks for sharing and welcome to the community!

About This Instructable

27,847views

40favorites

License:

More by Zeric1:Adding Digispark (with bootloader) support to existing Arduino 1.6.x IDE
Add instructable to: