Instructables

Digispark DIY: The smallest USB Arduino

Featured
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)
 
Remove these adsRemove these ads by Signing Up

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
AVRISP_MKII_pinout.jpg
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

bobricius1 month ago

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

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

zhaoyu35172 months ago

极客工坊来顶帖

dan30082 months ago

Silly question. Whats the purpose of the 2 zener diodes?

I'm guessing its to stop a back flow from gnd to the data pins (or visa versa)?

thanks

Dan

smching (author)  dan30082 months ago

The host(computer) sends 0V(0.8V min.) for a low level and 3.3V(3.6V max.) for a high level.

The zener diode acts as the level convertor, the 3.6V zener diodes yield 3.3V in conjuction with an 1.5K resistor.

dan3008 smching2 months ago

Ah i see. Thanks for that :) my electronics knowledge is a bit rusty lol

Ploopy2 months ago

Cool!

Could you upload the fritzing file (.fzz)?

smching (author)  Ploopy2 months ago

http://code.google.com/p/fritzing/issues/detail?id=2753#c5

jmpm46192 months ago
Hello what can i do with this board perform?
smching (author)  jmpm46192 months ago

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

dan30082 months ago

Just ordered myself 10 ATtiny84's to make these :D (well, one for a usb programmer, the rest for this) I cant wait to be able to develop USB devices and similar without the hefty pricetag of the arduino...


one set of fuses that will let the rest pin be used for io is
Low: 0xe1
High: 0x5d
Extended: 0xff

But I've not tested it yet, so cant guarantee it

letnic3 months ago
I get a "USB device not recognized" message. I try with 1,8k and 1,2k on D- and on D+ and all on work. My 2 zener are two 1n4729.
letnic letnic3 months ago
i miss spell, "all not work". I have no idea why it don't work
smching (author)  letnic3 months ago
Reverse the D+ and D- may cause "USB device not recognized" too.

I'm also facing "USB device not recognzed" when using an ordinary USB mouse cable,

Please use a good quality USB cable. The USB cable must be as short as possible.
smching (author)  letnic3 months ago
Thank you for sharing
koogar8 months ago
FUSEOPT_t85_DISABLERESET = -U lfuse:w:0xe1:m -U efuse:w:0xfe:m -U hfuse:w:0x5d:m

Use High fuse 5D this was taken from the digispark bootloader make file

Cheers

Rupert
ziggalo9 months ago
I plugged in my digispark and instead of the wizard popping up, I get a "USB device not recognized" message. Any ideas?
smching (author)  ziggalo9 months ago
Did you reverse the USB signals (D+ and D-)? Get the lowest wattage zener diodes you can.

Read here for more details.
Dr B10 months ago
Thank you smching. I did as you suggested. The sketches uploaded onto the Digispark ONLY on ONE computer running OSX 10.7. It still did not work on two other computers running OSX 10.4 and 10.6 (both of these were Intel Core Duo's running at 1.83 GHz). The one running OSX 10.6 gave a different error message than the one that I listed, above:
java.io.IOException: Cannot run program "/Applications/DigisparkArduino-MacOSX-1.0.4-May19/DigisparkArduino-MacOSX-1.0.4-May19/DigisparkArduino.app/Contents/Resources/Java/hardware/tools/avr/bin/avrdude": error=86, Bad CPU type in executable
at java.lang.ProcessBuilder.start(ProcessBuilder.java:470)
at java.lang.Runtime.exec(Runtime.java:593)
at java.lang.Runtime.exec(Runtime.java:466)
at processing.app.debug.Uploader.executeUploadCommand(Uploader.java:125)
at processing.app.debug.AvrdudeUploader.avrdude(AvrdudeUploader.java:331)
at processing.app.debug.AvrdudeUploader.uploadUsingPreferences(AvrdudeUploader.java:64)
at processing.app.Sketch.upload(Sketch.java:1671)
at processing.app.Sketch.exportApplet(Sketch.java:1627)
at processing.app.Sketch.exportApplet(Sketch.java:1599)
at processing.app.Editor$DefaultExportHandler.run(Editor.java:2380)
at java.lang.Thread.run(Thread.java:680)
Caused by: java.io.IOException: error=86, Bad CPU type in executable
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.(UNIXProcess.java:53)
at java.lang.ProcessImpl.start(ProcessImpl.java:91)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:452)
... 10 more

Apparently the DIgispark IDE has a problem with the "Bad CPU type" (in two of the computers?).
Are these CPU chips too old to be compatible with the Digispark IDE?

FYI, the blog did not let me insert this message into the reply box because it asked for the two code words to be entered, but a brown box to do so did not appear under the reply box.
smching (author)  Dr B10 months ago
I only use MS Windows, I may not able to help you on this problem.
Anyway you can post your question to Disispark forum
http://digistump.com/board/index.php/board,4.0.html
Dr B10 months ago
Your website gives the most complete description and set of procedures for Digispark in one single location that I have yet seen. I am very new to Digispark and am confused by the bootloader part. I thought that Digispark came 1) with its own ATTiny85 hardwired on the board 2) pre-programmed, in that when inserted into USB port (Mac OSX 10.4) the LED flashed on and off @ 1Hz (if using the RGB LED shield, it flashes red, blue then green).
I cannot download either the Digispark "Start" or the "RGB" sketch because it will not compile (an therefore will not download). It gives the following error message:
dyld: unknown required load command 0x80000022
avr-gcc: Internal error: Trace/BCP trap program ld
Please assist me in correcting this situation. Thanks.
smching (author)  Dr B10 months ago
You must configure your Didispark software (Arduino IDE)
From the Tools menu select Board→Digispark (Tiny Core)

You need to your programmer to Digispark if you want to upload sketch
From the Tools menu select Programmer→Digispark

Refer to Digistump Wiki for more details:
http://digistump.com/wiki/digispark/tutorials/connecting
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.
smching (author)  embedded-creations10 months ago
Ha Ha! This is my mistake. Thanks for reminding me. I had updated the license info to this instructable.
Regarding how to add the 6th pin, the RSTDISBL fuse is what you need to change to disable reset and allow it to be used as a GPIO. This is a risky thing to do, you'd only want to change this fuse after you know the boot loader has been correctly loaded, as it requires a special programmer to change that fuse back to normal after it's been set.
smching (author)  embedded-creations10 months ago
Thank you. I will test it soon.
PD, is there a way to communicate between the uC and the computer via the integrated USB?
smching (author)  Emiliano Valencia10 months ago
Communicate between Digispark & computer is not easy via USB. You can refer to Debugging with the Digispark

I
 would suggest to sending the data as keyboard keystrokes using the digispark keyboard emulation, it is very simple and easy. Otherwise you can use Softserial


Awesome, do you sell the USB boards?
smching (author)  Emiliano Valencia10 months ago
I didn't sell USB boards. Orngrimm already answer your question

You can get it from http://digistump.com/category
Orngrimm10 months ago
I pledget (and already got them shipped to me) them over on Kickstarter.
They are very well made and i am looking forward to find some time to put them to a good use.

@emihackr97: See at http://digistump.com/category/1 to buy the digispark or even other versions of the digistumb-brands.
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!