Wednesday, 22 May 2013 22:03

Digispark DIY: The smallest USB Arduino

Digispark
Digispark is an ATtiny85 based microcontroller development board come with USB interface. Digispark is very small and inexpensive but less powerful than Arduino. Coding is similar to Arduino, and it use the familiar Arduino IDE for development.
 
Digispark is copyrighted by Digistump LLC (digistump.com) and the full license is here
 
Here is an article on how to making a Digispark, however if you want to purchase a finished product, you can always get it from  Digispark's author homepage.


Specification
  • Support for the Arduino IDE 1.0 and later (OS X, Windows, and Linux)
  • Power via USB or external source - 5 V or 7-35 V (automatic selection)
  • On-board 500 mA 5 V 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)
  • 8 KB flash memory (about 6 KB after bootloader)
  • I²C and SPI (vis USI)
  • PWM on 3 pins (more possible with software PWM)
  • ADC on 4 pins
  • Power LED and test/status LED
Like Arduino, Digispark require a bootloader to be running on ATTINY85 which will occupied 2KB flash memory, so the total of 8KB flash memory will now become 6KB for programming.
 
 
Download bootloader The downloaded file containing firmwares with different version from V1.02 to V1.06, file name end with jumper (eg. micronucleus-1.06-jumper.hex) means booting without waiting (5 seconds timeout), therefore user must ground the D5/reset pin in order to program the ATTINY85. Here I'm using micronucleus-1.06.hex.
 
 
Burning bootloader to ATTINY85
It is very important to use the correct fuses bit when burning bootloader to ATTINY85, below list the fuses bit for burning bootloader:
  • Extended: 0xFE
  • High: 0xDD
  • Low: 0xE1
I'm using AVRISP MKII and AVR Studio software for burning bootloader, figure below shows the fuses bit for AVR Studio. Please note that these fuses setting will not enable reset pin (ATTINY85 pin 1) as I/O, so you only have 5 I/O instead of 6 I/O.
Fuses
 
 
AVRISP MKII pinout 
 
 
Installing Digispark USB driver

Digispark require USB driver to be install in computer since it use USB (not USB to serial) to communicate with computer.

  • Download Arduino for Digispark which come with USB driver
  • Extreat the file (DigisparkArduino-Win32-1.0.4-March29.zip)  to any folder
  • Execute DigisparkArduino-Win32\DigisparkWindowsDriver\InstallDriver.exe to start installing the USB driver
 
Digispark schematic
Picture below shows the official schematic for Digispark, and the next schematic is simpler & lesser components which is for testing purposes, the 5V is supply from the USB port of computer.
Digispark official schematic
 
Simplest Digispark schematic
 
 
 
Connecting Digispark and Upload sketch
  • Plug in the Digispark to the USB port of computer
  • USB device is detected for first time use and it will prompt for installing Digispark bootloader. Just click on Next button until finish as shown in figure below.
Installing driver for Digispark Bootloader
  • Run DigisparkArduino-Win32\Digispark-Arduino-1.0.4\arduino.exe to starting Arduino IDE
  • Click on Tools>Board>Digispark (Tiny Core) as shown in figure below
Arduino for Digispark Select Board
 
 
Click on Tools>Programmer>Digispark as shown in figure below
Arduino for Digispark Select Programmer
 
 
Upload an example. Click on File>Examples>Digispark_Example>Start
  1. // the setup routine runs once when you press reset:
  2. void setup() {
  3. // initialize the digital pin as an output.
  4. pinMode(0, OUTPUT); //LED on Model B
  5. pinMode(1, OUTPUT); //LED on Model A
  6. }
  7. // the loop routine runs over and over again forever:
  8. void loop() {
  9. digitalWrite(0, HIGH); // turn the LED on (HIGH is the voltage level)
  10. digitalWrite(1, HIGH);
  11. delay(1000); // wait for a second
  12. digitalWrite(0, LOW); // turn the LED off by making the voltage LOW
  13. digitalWrite(1, LOW);
  14. delay(1000); // wait for a second
  15. }
 
Follow procedures below to upload sketch to Digispark.
 
  • Unplug Digispark from computer before you click on the Upload button 
  • Click on Upload button now
  • Plug in Digispark to computer when it prompt for "Plug in device now..."
Arduino for Digispark Upload sketch
 
If you see "running: 100% complete". Congraturation! you have own a working Digispark. 
Upload sketch successful 
 
 
Test the Digispark
Connect a 330ohm resistor & LED to both pin5(Digital 0) and pin6(Digital 1) of ATTINY85. Plug the Digispark to computer,  both LED is start blinking now.
Digispark with 2 LED 
Read 45469 times Last modified on Saturday, 09 July 2016 17:54

3 comments

  • Comment Link admin Saturday, 09 July 2016 17:48 posted by admin

    Thank you for your very informative comment. Here is the latest Micronucleus bootloader:
    https://github.com/micronucleus/micronucleus

  • Comment Link rich Saturday, 09 July 2016 12:45 posted by rich

    Confusing tutorial!
    For example, when I Use the link: Download Micronucleus bootloader for ATTINY85
    micronucleus-t85-master\firmware\releases, First of all the .zip file is micronucleus-master. Not
    micronucleus-t85-master, secondly, in micronucleus-t85-master\firmware\releases, there isn't any version as stated The downloaded file containing firmwares with different version from V1.02 to V1.06, file name end with jumper.
    Please fix there errors

  • Comment Link Amirreza Monday, 08 February 2016 21:47 posted by Amirreza

    Nice tutorial, thank you.

Leave a comment

Back to Top