Project tutorial
ATtiny13/13a/25/45/85 Programming Shield

ATtiny13/13a/25/45/85 Programming Shield

Compact board to program an ATtiny using an Arduino UNO.

  • 1,991 views
  • 0 comments
  • 6 respects

Components and supplies

Necessary tools and machines

09507 01
Soldering iron (generic)
Dremel
Sandpaper

Apps and online services

About this project

ATtiny13/13a/25/45/85

This is a great beginner soldering and prototyping board project. The ATtiny is a very capable microcontroller. This shield allows us to program it quickly and conveniently.

Purpose

The ATtiny doesn't come in the modular package that the Arduino UNO does. As the microcontroller comes bare, there is no immediate means of programming it. A standard USB's data lines use a serial communication protocol that is not recognized by the ATtiny. Converting the serial communication to the UART protocol allows us to program the ATtiny via TX and RX pins. That is where the Arduino UNO comes into play. The UNO contains an ATmega16U2 (CH340 if it's a clone board) to act as a Serial to TTL chip. Tapping into the TX and RX pins allows us to program our ATtiny.

This isn't a full guide where I will walk you through every connection; instead, I show you my creation process as that part is often undocumented or left open to interpretation based on a user's skills/available tools. I assume you have basic electronics knowledge such as using a multimeter, checking for correct polarities on an electrolytic capacitor/LED, or how to follow pins on a schematic. You had to have some experience with microcontrollers to get here!

Features

  • Shield form
  • On board LED
  • Removable after programming
  • Additional female headers for breakout & testing

Preparation

This guide shows the physical connections quite well, and he used the same type of board that I did. I will effectively do the same as that guide with more detail in certain places. Use it as a reference whenever there's confusion. We'll be occupying only a few UNO pins, so we can get away with having a partial shield over a full shield. Here are the connections:

  • ATtiny pin 1 (PB5) <--> Arduino pin D10
  • ATtiny pin 2 (PB3) <--> x
  • ATtiny pin 3 (PB4) <--> x
  • ATtiny pin 4 (GND) <--> Arduino GND
  • ATtiny pin 5 (PB0) <--> Arduino pin D11
  • ATtiny pin 6 (PB1) <--> Arduino pin D12
  • ATtiny pin 7 (PB2) <--> Arduino pin D13
  • ATtiny pin 8 (Vcc) <--> Arduino +5V

Follow the pinout diagram below for additional reference. This is also useful to know later on when coding.

After determining the necessary pins, I marked the portion of the board I needed.

Some minutes later with the dremel and 100 grit sandpaper, and you get this:

Soldering

Start off by soldering the DIP8 socket. Adding the rows of female headers is optional, but it has proven to be tremendously convenient as I can keep the UNO as a power source and not remove the ATtiny from its socket.

This is where it got awkward. Since my board was not double sided, I couldn't push the male headers all the way through or I wouldn't have a pad to solder them to. Instead, I had to leave some space between the plastic and the pads underneath to solder the pins. Refer to the image below.

I also went ahead and cut the connections that I did not need. This is a necessary step for strip board users. The pads are connected in parallel "strips, " and it's left to the designer to break the connection wherever he/she chooses. Perf board users don't need to do this, but you may have some extra wires.

Add a 10uF electrolytic capacitor between the Arduino's Reset pin and Ground. I folded down the capacitor so it didn't stick out as much.

*OPTIONAL* If you want to add an LED to use for testing purposes (similar to LED13 on the UNO), connect it to any available pin that's not ground or Vcc. I hooked mine up to pin 2 aka PB3/D3. Don't forget your current limiting resistor in series with the LED and find a route to ground that works for you. I used my multimeter liberally during this step to make sure that I didn't have any unwanted connections.

Your fully soldered shield should look something similar to the one below. Refer to the connections made in case you're having trouble figuring out how to route the wires.

Uploading Code

I actually had some difficulty in figuring out how to flash code onto the ATtiny. Using the Arduino as an ISP is not the issue; it takes some extra effort to install the necessary hardware packages. This link helped me out. Follow the steps below to upload a Blink sketch to see if your board works.

1. Arduino as ISP

  • Plug in the UNO on it own, select the correct COM port and board.

Arduino IDE > File > Examples > ArduinoISP > ArduinoISP > Upload

2. ATtiny Hardware Package Installation

  • File > Preferences > Additional Boards Manager URL > Paste:
https://raw.githubusercontent.com/sleemanj/optiboot/master/dists/package_gogo_diy_attiny_index.json
  • OK
  • Tools > Board > Boards Manager > Find "DIY ATtiny" > Install

3. Configure Settings

  • Make sure your settings match the image below. I used an ATtiny13a instead of an ATtiny13.

4. Test Code

  • Download the "ATtiny Blink" sketch provided at the bottom of the guide and upload it.
  • Observe if LED toggles every second

Conclusion

Congratulations! The shield is complete. I may create a 3D-printable enclosure for the shield. If you wish to print the enclosure used on the UNO, you can find it here (Note that it was designed around genuine boards without multiple rows of header pins). You can now integrate your newly programmed ATtiny into various projects! Happy tinkering.

Code

ATtiny BlinkC/C++
/*
 * Viktor Silivanov
 * 9/4/2018
 * 
 * ATtiny13A Pinout
 * https://camo.githubusercontent.com/54658102e904b5d7efc931168f7f0afaa12a347f/687474703a2f2f692e696d6775722e636f6d2f71524564564d622e6a7067
 * 
 * Pin # | Assignment | PWM | Serial |
 *   1   |   D5/A0    |  x  |   x    |
 *   2   |   D3/A3    |  x  |   x    |
 *   3   |   D4/A2    |  x  |   x    |
 *   4   |    GND     |  x  |   x    |
 *   5   |     D0     |  Y  |  MOSI  |
 *   6   |     D1     |  Y  |  MISO  |
 *   7   |   D2/A1    |  x  |  SCK   |
 *   8   |    VCC     |  x  |   x    |
 * 
 */

#define LED       3        //D3 = Pin 2 in DIP8 package

void setup() {
  pinMode(LED, OUTPUT);
}

void loop() {
  digitalWrite(LED, HIGH);
  delay(1000);
  digitalWrite(LED, LOW);
  delay(1000);
}

Comments

Similar projects you might like

Programming the ATtiny85 (Using an Arduino Uno)

Project tutorial by Ian Cumming

  • 2,043 views
  • 1 comment
  • 2 respects

Programming ATtiny13 with Arduino Uno

by Tauno Erik

  • 12,342 views
  • 7 comments
  • 21 respects

Programming Atmel AT89 Series Via Arduino

Project tutorial by Patel Darshil

  • 4,178 views
  • 2 comments
  • 18 respects

Simple ATTiny13 Shield for Arduino UNO

Project showcase by Hugo Blanc

  • 748 views
  • 0 comments
  • 4 respects

Programming ATtiny85 with Arduino Uno

Project tutorial by Arjun Ganesan

  • 221,415 views
  • 74 comments
  • 189 respects

Attiny85/84 with Bluetooth

by Robin

  • 12,636 views
  • 0 comments
  • 54 respects
Add projectSign up / Login