Project tutorial
Use an ATtiny85 with Arduino IDE

Use an ATtiny85 with Arduino IDE © GPL3+

How to use an ATtiny85 with the Arduino IDE and upload instructions.

  • 29,632 views
  • 1 comment
  • 6 respects

Components and supplies

Apps and online services

About this project

I bought a new Digispark's ATtiny85 Board.

But was unable to use it for two days just because of the driver packages. And finally after searching a lot I found the answer. I referred various tutorials for this and tried. I was getting an error for COM port in Arduino. Here I solved for it.

Pinouts: All pins can be used as Digital I/O

Pin 0 → I2C SDA, PWM (LED on Model B)

Pin 1 → PWM (LED on Model A)

Pin 2 → I2C SCK, Analog In

Pin 3 → Analog In (also used for USB+ when USB is in use)

Pin 4 → PWM, Analog (also used for USB- when USB is in use)

Pin 5 → Analog In

For a handy pin reference flip over the Digispark - pin capabilities are listed on the back

Step 1: Install Windows Driver for ATtiny85

If using Arduino 1.6.6 or higher and windows - you will need to download and install the drivers manually. Download, unzip and run “Install Drivers” (on 32bit systems) or “DPInst64” (on 64bit systems).

The driver files are located here:

Link

After Downloading the.zip file > extract it.

and run the

Install drivers.exe (For 64 bit OS)

DPinst64.exe (for 32 bit OS)

Step 2: Install Board Packages for Arduino

Copy this url and paste in the File>preference> additional board manager url

http://digistump.com/package_digistump_index.json
  • Go to the “Tools” menu and then the “Board” submenu - select “Boards Manager” and then from the type drop down select “Contributed”:
  • Select the “Digistump AVR Boards” package and click the “Install” button.
  • You'll see the download progress on the bottom bar of the “Boards Manager” window when complete it will show “Installed” next to that item on the list.
  • WINDOWS USERS: When complete the install with pop up a Driver Install Wizard window, please click “Next” on this Window to install the drivers for Digistump Boards (If you already have them installed, this installer will update them and install any that are missing)
  • With the install complete, close the “Boards Manager” window and select the Digispark from the Tools→Boards menu. “Digispark (Default - 16.5mhz)” is the board that should be selected by all new users.
  • The install is now complete! (Linux users see note below)

Linux Install If you haven't before - Install the udev rules found here: Troubleshooting section

ATTENTION LINUX USERS: PLEASE CHECKOUT THE LINUX TROUBLESHOOTING PAGE**

Step 3: How to Upload the Program

The Digispark works a bit differently than some Arduino compatible products. The Digispark programs with a different procedure.

From the Tools menu select Board→Digispark (Default - 16.5Mhz)

Write some code, open your code.

You do not need to plug in your Digispark before invoking upload Hit the upload button.

The bottom status box will now ask you to plug in your Digispark - at this point, you need to plug it in - or unplug and replug it.

You'll see the upload progress and then it will immediately run your code on the Digispark. If you unplug the Digispark and plug it back in or attach it to another power source there will be a delay of 5 seconds before the code you programmed will run. This 5-second delay is the Digispark Pro checking to see if you are trying to program it.

Step 4: Troubleshooting

This to keep in mind

Digisparks do not create serial ports. The digispark arduino software communicates directly to the digispark over a combination of raw low speed USB protocols and HID protocols in order to save space and be more compliant with the USB specification.When using the Digispark Arduino software it doesn't matter what is selected in the serial ports list - none is used. Just make sure Digispark is selected in the Programmer menu and Digispark (tiny core) is selected in the Board menu and you should be up and running.When using the Digispark Arduino software it doesn't matter what is selected in the serial ports list - none is used. Just make sure Digispark is selected in the Programmer menu and Digispark (tiny core) is selected in the Board menu and you should be up and running.
  • For the example programs if you are getting “Device not found” even after installing the DigiUSB driver in the examples folder then try this: http://digistump.com/board/index.php/topic, 257.0.html
  • If Windows does not recognize a “DigiUSB” but a generic “HID-compliant device”/“USB Input Device” pair, go to the Device Manager, find in the “Human Interface Devices” category the USB Input Device with a vendor ID of 0x16C0 and select “update driver” / “browse my computer” / “let me pick from a list” and the DigiUSB should show up there.

Code

Demo Code For RGB using Attiny85C/C++
#include <DigisparkRGB.h>
/*
 Digispark RGB
 
 This example shows how to use soft PWM to fade 3 colors.
 Note: This is only necessary for PB2 (pin 2) - Blue, as Red (pin 0) and Green (pin 1) as well as pin 4 support the standard Arduino analogWrite() function.
 
 This example code is in the public domain.
 */
byte RED = 0;
byte BLUE = 2;
byte GREEN = 1;
byte COLORS[] = {RED, BLUE, GREEN};

// the setup routine runs once when you press reset:
void setup()  { 
  DigisparkRGBBegin();
} 


void loop ()
{
//direction: up = true, down = false
boolean dir = true;
int i = 0;

while(1)
{
fade(COLORS[i%3], dir);
i++;
dir = !dir;
}
}
void fade(byte Led, boolean dir)
{
int i;

//if fading up
if (dir)
{
for (i = 0; i < 256; i++) 
{
DigisparkRGB(Led, i);
DigisparkRGBDelay(25);//1);
}
}
else
{
for (i = 255; i >= 0; i--) 
{
DigisparkRGB(Led, i);
DigisparkRGBDelay(25);//1);
}
}
}

Schematics

Pinouts
Attiny85 dev board pinout bid 53ycpxwf7p

Comments

Similar projects you might like

Hacking Qualcomm (Quick Charge) QC 2.0/3.0 With ATtiny85

Project tutorial by Shahariar

  • 15,389 views
  • 15 comments
  • 47 respects

Tri-Mode Digital Clock with ATtiny85 and RTC

Project tutorial by LAGSILVA

  • 8,833 views
  • 4 comments
  • 25 respects

3D-Printed Nanoleaf ATtiny85

Project tutorial by Arnov Sharma

  • 3,743 views
  • 0 comments
  • 15 respects

Programming the ATtiny85 (Using an Arduino Uno)

Project tutorial by Ian Cumming

  • 3,686 views
  • 3 comments
  • 7 respects

ATtiny85 EMF Detector

Project tutorial by Giovanni Gentile

  • 8,979 views
  • 1 comment
  • 21 respects
Add projectSign up / Login