Introduction: Digispark DIY: the Smallest USB Arduino

Picture of Digispark DIY: the Smallest USB Arduino

Digispark is an ATtiny85 based microcontroller development board come with USB interface. 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: http://digistump.com/wiki/digispark/policy

Specification:
Support for the Arduino IDE 1.0+ (OSX/Win/Linux)
Power via USB or External Source - 5v or 7-35v (automatic selection)
On-board 500ma 5V Regulator
Built-in USB (and serial debugging)
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)
I2C and SPI (vis USI)
PWM on 3 pins (more possible with Software PWM)
ADC on 4 pins
Power LED and Test/Status LED (on Pin0)

Step 1: Prerequisite

Picture of Prerequisite

AVRISP MKII In-System Programmer
ATTINY85 Microcontroller
2 x 3.6V zener diode
2 x 68 ohm resistor
1 x 1.5K resistor
USB cable (get from broken mouse or keyboard)
Some wires


Step 2: Burning Bootloader to ATTINY85

Picture of Burning Bootloader to ATTINY85

Like Arduino, Digispark require a bootloader to be running on ATTINY85. The bootloader will occupied 2KB flash memory.

Download bootloader
1. Download Micronucleus bootloader for ATTINY85
2. Extract the file (micronucleus-t85-master.zip) to any folder
3. You can find the bootloader file at micronucleus-t85-master\firmware\releases folder
4. Use micronucleus-1.06.hex for the bootloader

Burning bootloader to ATTINY85
You must use the correct fuses bit for the bootloader

Extended: 0xFE
High: 0xDD
Low: 0xE1

Note: The above fuse bit will not enable reset as I/O, so you can have only 5 I/O instead of 6 I/O. I'm still try to figure out on how to set it to 6 I/O

I'm using AVRISP MKII In System Programmer and AVR Studio software for burning bootloader.

Step 3: Installing Digispark USB Driver

Digispark use USB to communicate with computer, so your computer must install Digispark USB driver
1. Download Arduino for Digispark which come with USB driver
2. Extract the file (DigisparkArduino-Win32-1.0.4-March29.zip)  to any folder
3. Execute DigisparkArduino-Win32\DigisparkWindowsDriver\InstallDriver.exe to start installing the USB driver

Step 4: Digispark Schematic

Picture of Digispark Schematic

I provide two schematics, first one is the official schematic for Digispark, the other one is for testing purposes which the 5v is get from USB port and hence it is lesser components and much more simple.

Step 5: Plug in Digispark to Computer

Picture of Plug in Digispark to Computer

1. Plug in Digispark to the USB port of computer
2. USB device is detected for first time use and prompt you to installing Digispark bootloader.
3. Click on Next button until finish.

Step 6: Configure Digispark Software

Picture of Configure Digispark Software

1. Run DigisparkArduino-Win32\Digispark-Arduino-1.0.4\arduino.exe to starting Arduino IDE
2. Click on Tools>Board>Digispark (Tiny Core)
3. Click on Tools>Programmer>Digispark

Step 7: Upload Sketch to Digispark

Picture of Upload Sketch to Digispark

Upload an example. Click on File>Examples>Digispark_Example>Start
Coding is look like this:

// the setup routine runs once when you press reset:
void setup() {               
  // initialize the digital pin as an output.
  pinMode(0, OUTPUT); //LED on Model B
  pinMode(1, OUTPUT); //LED on Model A  
}
// the loop routine runs over and over again forever:
void loop() {
  digitalWrite(0, HIGH);   // turn the LED on (HIGH is the voltage level)
  digitalWrite(1, HIGH);
  delay(1000);               // wait for a second
  digitalWrite(0, LOW);    // turn the LED off by making the voltage LOW
  digitalWrite(1, LOW);
  delay(1000);               // wait for a second
}


Follow step below to upload sketch to Digispark.
1. Unplug Digispark from computer before click on the Upload button 
2. Click on Upload button now
3. Plug in Digispark to computer when it prompt for "Plug in device now..."
4. If you see "running: 100% complete". Congraturation! you have own a working Digispark. 

Step 8: Test the Digispark

Picture of 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.

Step 9: What Can Do With Digispark

Picture of What Can Do With Digispark

Comments

SasikumarP (author)2017-01-16

I want to interface ultrasonic sensor to ATtiny microcontroller is it possible?

beamzer (author)SasikumarP2017-03-18

have a look here:

http://www.14core.com/didispark-attiny85-with-ultrasonic-hc-sr04-sensor/

WajahatN (author)2017-02-10

this is also a nice method to burn bootloader using arduino UNO explained in the video.


Merlin04 (author)2016-10-16

I made a PCB for this:

https://oshpark.com/shared_projects/fTk97wV9

I added a reset button, and another button that should go on the bottom.

alexandera51 (author)2016-09-02

i have a question, how can i use serial with the attiny85 so i can see a sensor reading or so? please help me want to build a remote control bt i need to see some ir signals to program the chip. thanks

smching (author)alexandera512016-09-08

Digispark works with Software Serial

kbckiwi (author)smching2016-09-30

I have a cuestion. I'm currently working on a project that uses an Attiny85 as the uC rather than an Arduino UNO (using one would be completely overkill as it'll be used just to measure temperature and displaying it) The hardware is realy basic. It's an LM35 as a temperature sensor and a 16x2 LCD display with an I2C interface. Now, with this Attiny85 board is it really necesary to burn the bootloader? Or is it already installed (or burned) into the uC? Being that is an SMT chip. How can I burn the bootloader? Can it be done via usb? Or using the Arduino IDE? Thanks.

smching (author)alexandera512016-09-08

Digispark Infrared Receiver:
http://ediy.com.my/blog/item/74-digispark-infrared-receiver

FrankA25 made it! (author)2015-12-18

@dangerous dan

Under win10 the USB driver does not work with me.
I program it with the Arduino Uno.
Goes aut.

gizmologist (author)FrankA252016-09-10

Works fine for me on Win 10 64-bit.

jplaiss (author)gizmologist2016-09-14

I want to put mine in someones breakfast cereal.
I got "Start" to work one time, then my computer won't recognize anything is there.

gizmologist (author)jplaiss2016-09-19

According to the digispark website, unlike regular Arduinos, the computer won't recognise the digispark as a USB device. That's why you must only plug the digispark in when the Arduino software tells you to. (during the upload process.)

This is my experience also. The digispark uploads fine, but my computer still complains that it's not recognized.

pillola (author)2016-06-12

nothing to do with windows 10 !!! i must program with arduino and wire connections!

Windows 10 does not recognize the digispark !

gizmologist (author)pillola2016-09-10

It works fine with Windows 10.

I'm using Windows 10 64-bit and Arduino 1.6.11.

Once you download the drivers and follow the instructions here:

http://digistump.com/wiki/digispark/tutorials/connecting

Everything works fine.

jplaiss (author)gizmologist2016-09-14

One of the driver files wouldn't install, there is an address problem downloading and installing the Digispark version of the Arduino IDE, and now I'm discouraged.

Any suggestions?

alexandera51 (author)2016-09-02

one more question how can i program the attiny85 digispark usb with my tablet?

smching (author)alexandera512016-09-08

I can't help you on this matter because I do not own a tablet.

andysuth (author)2016-02-26

I'm having problems with the USB driver, it keeps saying board has been removed and timing out on the USB install.

It's not showing up in device manager.

Any Tips?

I remember someone once posted an alternative driver for Chinese origin ones.

smching (author)andysuth2016-02-28

Have you read this?
http://digistump.com/wiki/digispark/tutorials/connecting

If the computer will not recognize the Digispark try the following:
1. Try connecting it to another USB port or system.
2. Try connecting it to the rear ports (if a desktop)
3. Try connecting it to a USB hub.
4. Try a powered USB hub.
5. Try a different cable.

embedded-creations (author)2013-05-31

I like the intent behind this Instructable, but I have a couple issues with how it was presented. You're using "Digispark" as if it were your name, and there's no reference to to the actual Digispark product after reading through the whole writeup. You use the Digispark schematic, but removed the creative commons license, and didn't mention where it came from. It would be nice if you gave your project a unique name, e.g. "DIYspark - a Digispark clone", and at least put some links to Digispark in your writeup.

Yes, I was wondering that too.

I got the impression that I had to burn the Bootloader onto my Digisparks, but they worked right out of the box. On a windows 10 OS.

Ha Ha! This is my mistake. Thanks for reminding me. I had updated the license info to this instructable.

RenatoS14 (author)2015-11-04

I have a problem with my program. I uploaded an application and works great when the board is powered by USB, but when using external power with no usb it doesn't work. I mean the board turns on but it seems that is waiting for something to run de application. Can anyone help me?

bobbiy (author)2015-09-15

I flashed the bootloader but if i connect the device to my windows 10 computer I get this error:

A request for the USB device descriptor failed.

caulktel (author)bobbiy2015-09-30

I'm getting the same error on Windows 10, I've tried everything I can think of to get it working with no success. If you figure it out please let me know.

GetTutorializedK (author)2015-07-13

Sweet! :D

gsaxena made it! (author)2015-06-06

Never mind, got it working, 1.5k and 68R resistances were swapped.

gsaxena (author)2015-05-25

Tried building this, but device is not detecting, unknown usb error is shown, is schematic correct?, in micronucleus firmware folder in bootloaderconfig.h file, it says to connect D+ line to INT0. So we need to connect PB4 to PB2 also?

bobricius (author)2014-02-21

Hi, I think that I have much smaller arduino than you https://www.tindie.com/products/bobricius/picoduino/

diy_bloke (author)bobricius2015-05-12

I am all for self built, for the sheer joy and the sense of learning. But I am also cost conscious. You guys know this thing costs 2 euro's at Aliexpress right? Ready made, good to go: http://www.aliexpress.com/item/Free-shipping-Digis...

Also, a pro mini costs only 1.60 euro's there and has a lot more pins

dan3008 (author)bobricius2014-03-22

Only just... I'm working on an even smaller one, if it works, It'll litterally fit inside a usb plug lol

johnyradio (author)dan30082015-01-11

how's that goin?

dan3008 (author)johnyradio2015-01-12

Apart from accidentally shorting my data wires on the first attempt (lucky it wasnt power...)its worked like a dream :)

uses SMD components. The difficult bit is pulling out the reamaming IO pins without shorting stuff...

Once I've got it working, I'll share the instructable :)

se23 (author)dan30082015-04-27

Did you manage to get it working?

se23 (author)dan30082015-04-27

Hi mate, I know it's a long time ago but wondered how the project went. We have a real problem in my industry and I think your idea would solve it. I would like to present it to my seniors at head office.

lzu (author)bobricius2014-04-27




I'm the Ardulink creator. Ardulink is a java open source library that can control and coordinate several Arduino boards.If you are interested in have PicoDuino supported by Ardulink, please contact me and send to me a board. I've already made a test with a Digispark.
http://www.ardulink.org/digispark-supported/

MisterED.corp (author)2014-10-12

Hi,

just wanted to thank you and throw in a pic of my attempt :)

the upper one is a usbTinyISP and the lower one the Digispark. I added a capacitor (10uF i think, but just used the next one laying around) to get usb-connection to work.

smching (author)2014-07-26

Once you use Burn Bootloader, you can never program that chip again using an ISP programmer.

http://digistump.com/board/index.php/topic,1051.0....

nvillalba (author)smching2014-07-28

Well! No problem! Thanks for warning me

nvillalba (author)2014-07-24

Can you explain this process whit arduino as ISP instead AVRISP mkII

Jaywalker1981 (author)2014-07-20

Would it work, If I connect P3 and P4 directly to USB+ and USB- on my micro USB connector?

What are the potential downsides of not using the zenor diode and the pull-up resistors for Level converting? Would my communication still work without those two? Could it fry my processor or the usb port on my host device?

smching (author)Jaywalker19812014-07-22

It wouldn't work without the Zener didoe & the pull-up resistor.

The USB power uses 5V, but the dataline (USB+ & USB-) uses only 3.6V for high, attempt to fed 5V from ATTiny85 to computer will cause the communication failed.

jemamena (author)2014-07-17

Has anyone tried to use an ATtiny84 instead with usb capabilities? It would be very helpful

smching (author)jemamena2014-07-18

Please check with Digispark Pro

https://www.kickstarter.com/projects/digistump/digispark-pro-tiny-arduino-ready-mobile-and-usb-de

jemamena (author)smching2014-07-18

What chip uses the Digispark Pro? I am actually more interested in making the ATtiny84 usb like the first Digispark

smching (author)jemamena2014-07-18
smching (author)jemamena2014-07-18

At first I thought it is ATtiny84 because it is discussing in the post related to ATTiny84:

https://digistump.com/board/index.php?topic=997.10...

By comparison the pin configuration and specification, I think it must be ATTiny167.

jmpm4619 (author)2014-01-23

Hello what can i do with this board perform?

smching (author)jmpm46192014-01-24

Digispark has 6 digital outputs, you can control LED, relays. It has 3 PWM outputs, you can control motor and fade the LED. It has 4 Analog inputs and can be connect to sensors.

Please refer to Digispark project forum for more details:

https://digistump.com/board/index.php/board,2.0.html?PHPSESSID=rmkknm79gl308nsk4tmhr4g9i6

DraakUSA (author)smching2014-06-10

Select the fuse RSTDISBL. That disables the reset function of the pin, and enables it as I/O. Note, you will need an HVSP to reset the fuse (or reprogram the AVR) after you do that.

About This Instructable

384,028views

579favorites

License:

Bio: A place for DIY projects
More by smching:Store Messages From Mosquitto MQTT Broker Into SQL DatabaseHow to create webpages & setup website using Joomla CMSLearning, Experience and Review the Makeblock 3 in 1 MBot Ranger Robot Kit
Add instructable to: