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 50449 times Last modified on Saturday, 09 July 2016 17:54

9 comments

  • Comment Link admin Monday, 02 October 2017 17:50 posted by admin

    You can't read time directly from your computer without any application running on your computer.

    You need to use a RTC module
    https://digistump.com/wiki/digispark/tutorials/rtc

  • Comment Link admin Monday, 02 October 2017 17:43 posted by admin

    Digispark can send keyboard event to computer, however it cannot receive keyboard event from computer.
    Therefore you must use serial port (software serial) to communicate with computer.

  • Comment Link EsiYas Friday, 29 September 2017 00:13 posted by EsiYas

    and something else
    can it be started in a specific time by computer like 10:12:30:03
    because when i plugin the ATtiny85 in USB it starts to blink and i can not control its start..
    thank you

  • Comment Link EsiYas Friday, 29 September 2017 00:02 posted by EsiYas

    hi
    help
    i want to start a pulse with computer keyboard..for example with S key
    you can consider a blink LED for example
    can i do it with ATtiny85 ? if yes ...what is the code?

  • Comment Link admin Monday, 28 August 2017 11:41 posted by admin

    USB tansmitted signal levels are 0.0–0.3 V for logical low, and 2.8–3.6 V for logical high level, 2.7V & 3.3V zener diode definitely not working, therefore you must get a 3.6V zener diode for this tiny project.

  • Comment Link Arjit Singh Saturday, 26 August 2017 18:44 posted by Arjit Singh

    Plz help me , I did everything including , a atting 85 bootlood , it's driver installation sussessfully when I connect it to usb it shows usb not recognized , and also not detected by Digi spark Ide , in attiny 85 test circuit I have used 2.7 volt zener , I asked saller to give me 3.3 volt but after buy I tested it with volt meter it showing 2.7 or 2.9 zener breakdown , does 2.7 volt zener not work ? I only need 3.6 volt zener ??? Or can I use two resistors voltege devinder on both data line for 3.6 volt instead Zener diode ?????? And plz tell me how and why this windows diglog box appeared - " Found new Hardware Wizard " that you above mentioned as 6 image on page

  • 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