RoboThings

ATTiny85 USB

Learn how to set up and use the ATTiny85 USB with Arduino IDE for the first time. This beginner’s guide includes a step-by-step tutorial, wiring instructions, and example code for your first project.

Introduction

The ATTiny85 USB is a powerful yet compact microcontroller, perfect for small electronics projects that require minimal power. In this guide, we’ll show you how to program the ATTiny85 USB using Arduino IDE for the first time. Whether you’re a beginner or an experienced maker, this tutorial will help you get started with your first ATTiny85 project.

What You’ll Need

  • ATTiny85 USB (Digispark or compatible)
  • USB Cable (for connecting to your computer)
  • Arduino IDE (latest version)
  • LED and Resistor (optional for testing)
  • Breadboard and jumper wires (optional)

Step 1: Install the Arduino IDE

If you haven’t already, download and install the Arduino IDE from the official Arduino website.

Step 2: Setting Up Arduino IDE for ATTiny85

1. Add ATTiny85 Board to Arduino IDE:

  • Open Arduino IDE and go to File > Preferences.
  • In the Additional Boards Manager URLs field, paste the following URL:
				
					http://digistump.com/package_digistump_index.json

				
			
  • Click OK to save your settings.

2. Install Digistump AVR Boards:

  • Go to Tools > Board > Boards Manager.
  • In the search bar, type Digistump.
  • Install the Digistump AVR Boards package.

Step 3: Connecting the ATTiny85 USB to Your Computer

Now that Arduino IDE is ready, it’s time to connect your ATTiny85 USB to your computer.

  1. Plug the ATTiny85 USB directly into your computer’s USB port.

    Tip: If you’re using a raw ATTiny85 chip (without a USB), you’ll need a USBasp programmer.

  2. No external power source is required—the USB connection will power the device.

Step 4: Writing and Uploading Your First Program (Blink)

To test the setup, we’ll use a simple Blink program that turns an LED on and off at regular intervals.

  1. Open Arduino IDE and go to Tools > Board. Select Digispark (Default – 16.5mhz).

  2. Write the Blink Code:

				
					void setup() {
  pinMode(1, OUTPUT);  // Set pin 1 as output (Pin 1 on ATTiny85)
}

void loop() {
  digitalWrite(1, HIGH);   // Turn the LED on
  delay(1000);             // Wait for a second
  digitalWrite(1, LOW);    // Turn the LED off
  delay(1000);             // Wait for a second
}

				
			

3. Upload the Code:

  • Click Upload in the Arduino IDE. A message will prompt you to connect your ATTiny85 USB.
  • If the ATTiny85 USB is already connected, it will begin uploading automatically.
  • After a few seconds, the upload will complete, and the program will run.

Step 5: Connecting an External LED for Testing

    1. To make things more visual, let’s connect an external LED to the ATTiny85.

      1. Connecting the LED:

        • Attach a 220-ohm resistor to the long leg (anode) of the LED.
        • Connect the other end of the resistor to pin 1 of the ATTiny85.
        • Connect the shorter leg (cathode) of the LED to GND.
      2. Test the Blink Program:

        • Once uploaded, your LED will blink every second, confirming that your ATTiny85 is running the program.

Conclusion: Get Started with ATTiny85 USB

You’ve now successfully programmed the ATTiny85 USB using Arduino IDE! Whether you’re working on sensor-based projects or controlling simple outputs like LEDs, the ATTiny85 is a versatile and cost-effective option. From here, you can experiment with other sensors and devices to take full advantage of the ATTiny85’s capabilities.

FAQs

1. Can I use ATTiny85 without a USB interface?
Yes, if you’re using a raw ATTiny85 chip, you will need a USBasp or similar programmer to upload code.

2. How much memory does the ATTiny85 have?
The ATTiny85 has 8KB of flash memory, 512 bytes of SRAM, and 512 bytes of EEPROM.

3. What is the clock speed of the ATTiny85?
By default, it runs at 16.5 MHz when using the Digispark bootloader.

2.9 7 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
Open chat
1
Hi, how can I help you?
Powered by