The Digispark is an Attiny85 based microcontroller, and much less well known than Arduino. But considering their price, it seems interesting to learn how to program them.
Digispark microcontrollers features:
Attiny85 based microcontroller (Digispark):
- Support Arduino IDE 1.0+ (OSX/Win/Linux)
- Power via USB or External Source – 5v or 12v
- On-board 500ma 5V Regulator
- Built-in USB
- 6 I/O Pins (2 are used for USB only if your program actively communicates over USB, otherwise you can use all 6 even if you are programming via USB)
- 8k Flash Memory (about 6k after bootloader)
- 512B EEPROM, 512-Byte SRAM
- I2C and SPI (vis USI)
- PWM on 3 pins (more possible with Software PWM)
- ADC on 4 pins
- Power LED and Test/Status LEDLF, HF full band.
Attiny167 based microcontroller (Digispark pro):
- Compatible with Arduino IDE 1.5 (OSX/Win/Linux)
- USB programming, USB device emulation, USB-CDC virtual serial port emulation
- 16 Mhz AVR MCU – using a true 16Mhz precision crystal
- 16KB Flash Memory (14.5K+ after bootloader)
- 512B EEPROM, 512-Byte SRAM
- Serial over USB debugging and communication!
- 14 i/o Pins (2 shared with USB)
- I2C, true SPI, UART, LIN, and USI
- ADC on 10 pins
- 3 PWM Channels (which can be assigned to a selection of pins)
- Power via USB, or External Source – 5v or 6-16v (automatic selection)
- On-board button that can be used as a reset, program, or user button – or can be disabled to use that pin as general i/o – without changing the bootloader
- On-board 500ma 5V regulator
- Power LED and Test/Status LED (on Pin 1)
Breadboard compatible pin out/spacing (the three side header pins are only for legacy shield support).
1 – Attiny85 based microcontroller : Digispark
1.1 Bootloader programming
The bootloader is the little program that runs when you turn the digispark on. Its main function is to wait for the Digispark software on your computer to send it a new program for the Digispark, which it then writes to the memory on the Digispark. This is important, because normally you need a special device to program the Digispark. The bootloader is what enables you to program the Digispark using just the USB plug.
When you buy it, there may be no bootloader indide it. How to program it ?
This is a fork from https://github.com/micronucleus/micronucleus with add-on programs (F4goh_files)
– Install USBasp-win-driver-x86-x64-ia64-v1.2.4 drivers and Avrdude (setup-AVRDUDESS-2.6.exe)
– Plug USBASP (check drivers on Windows device managers )
- Select USBasp
- Port USB
- Load t85_default.hex
- Set fuses lock bits to L : 0xE1 , H : 0XDD
- Click Program!
1.3 Digispark IO and schematics
|2||(PCINT3/XTAL1/CLKI/OC1B/ADC3) PB3||PB3||3/A3||USB M|
|3||(PCINT4/XTAL2/CLKO/OC1B/ADC2) PB4||PB4||4/A2||USB P|
1.4 Digispark pro IO and schematics
2 – Arduino IDE configuration
2.1 Follow this setup :
Install micronucleous Drivers, if this hasn’t been done.
2.2 blink test
3 – Troubleshooting
Digispark alternative programming with an Arduino UNO :
I can’t use USBasp :
May be it is a fake programmer, so you must reload the firmware.
Remove wire programming on USBasp. It should work.
Useful links :
Keyboards layouts :
4 – Conclusion
I hope this tutorial will make it easier for you to use digispark cards. I tried to gather useful information to facilitate programming. Screenshoots should help you a lot. I will soon be proposing Hamradio applications using digispark modules.
Under linux :
Commands list on console:
sudo apt-get install libusb-dev
sudo cp 49-micronucleus.rules /etc/udev/rudes.d
Replace micronucleus exec file in .arduino15/pakages/digisump/tools/micronucleus/2.0a4/