Skip to content

Digispark ATtiny85 Pinout and Configuration

  • by
Digispark ATtiny85 pinout showing the physical pins, digital IO pins, ADC pins, PWM pins, I2C pins, SPI pins, USB pins, pin change interrupts, and hardware interrupt pin.

A Digispark ATtiny85 development board is a microcontroller board with an ATtiny85 MCU chip. It is a favorite board for projects that require a small number of GPIOs. The board is basically an ATtiny85 chip that is provided with a voltage regulator and a USB interface. We will take a look at the Digispark ATtiny85 pinout and the different configurations that it has to offer.

Types of Digispark Boards

A picture showing two (2) versions of Digispark ATtiny85 with the same pinout or configuration
Figure 1. USB Type-A Interface and Micro-USB Interface

Figure 1 shows the two (2) popular versions of the Digispark ATtiny85 development boards. The one on the left uses a type-A USB connector to connect directly to the USB port of a PC or a laptop. On the other hand, the board on the right has a micro-USB connector. As a result, we need a micro-USB cable to connect this to a computer for programming purposes.

It should be observed that both boards have the same pin layout. We can breadboard them as long as we do not connect a header pin to the VIN terminal.

A picture of another version of Digispark ATtiny85 development board
Figure 2. Another Type of Digispark ATtiny85

Figure 2 is a picture of another type of Digispark ATtiny85 board. As shown in the picture, the board does not have an ATtiny85 chip but instead only an 8-pin DIP socket. We must provide a DIP-type ATtiny85 chip in order to use this board. Also, the pin layout of this board is different. This board is not breadboard friendly. However, the pin layout is ICSP-programmer ready. That is, the pins are arranged so as to accept the female connector of an AVR ICSP-programmer.

It must be mentioned here that technically, this board is not (yet) a Digispark ATtiny85 board. A Digispark ATtiny85 board has an ATtiny85 chip that was burned with a Micronucleus bootloader. In order to make this board a Digispark board, it needs an ATtiny85 chip that was pre-programmed with a Micronucleus bootloader. Otherwise, an ATtiny85 without a bootloader can be inserted into the DIP socket and an ICSP programmer is used to burn a new Micronucleus bootloader into it.

Digispark ATtiny85 Specifications

  • Support for the Arduino IDE 1.0+ (OSX/Win/Linux)
  • Power via USB or External Source – 5v or 7-35v (12v or less recommended, automatic selection)
  • On-board 500ma 5V Regulator
  • Built-in USB
  • 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

Digispark ATtiny85 Pinout

A picture showing the Digispark ATtiny85 pinout and configuration of its physical pins, digital I/O, ADC ports, and other pertinent information
Figure 3. Digispark ATtiny85 Pinout

Digispark ATtiny85 Pinout Description

ATtiny85 Breakout

First of all, by referring to Figure 3, you will notice that the Digispark board serves as a breakout board for the ATtiny85 chip. All of the eight pins of the ATtiny85 chip are accessible. The physical pins of the ATtiny5 chip are designated by the gray-colored pinouts numbered 1 to 8.

Six (6) Digital I/O Pins

As per specification, the Digispark ATtiny85 board can be configured to use six (6) digital I/O ports. These ports are shown in Figure 3 as yellow pins, labeled PB0 to PB5. NOTE: Port B pin PB5 is by default configured as a RESET pin. In order to use PB5 as an I/O port, an ATtiny85 fuse (RSTDISBL) has to be reset (changed from 1 to 0). Please see How to Reset ATtiny85 Fuses.

Arduino IDE Programming Notes

In the Arduino IDE, pins PB0 to PB5, when used as digital I/O are referred to as 0 to 5. That is,

Four (4) Analog to Digital Converter (ADC) Ports

Port B ports PB2 to PB5 can be configured as analog inputs. These pins are shown in Figure 3 as orange pins. The pins are labeled ADC0 to ADC3. Be aware that the Port B numbers do not exactly match the ADC port numbers. In other words, PB2 does not correspond ADC2, PB3 does not correspond to ADC3, and so on. Instead,

  • ADC0 is PB5
  • ADC1 is PB2
  • ADC2 is PB4
  • ADC3 is PB3

Arduino IDE Programming Notes

When using the command analogRead(), Arduino IDE assumes you are using the ADC port numbers (0 for ADC0, 1 for ADC1, 2 for ADC2, and 3 for ADC3) and NOT the Port B numbers (0 for PB0, 1 for PB1, 2 for PB2, 3 for PB3, 4 for PB4, and 5 for PB5). However, the pinMode() command expects you to use the Port B numbers. This is one of ATtiny85’s peculiarities that is very confusing. The example code below should clear this up.

Three (3) Pulse Width Modulation (PWM) Outputs

Referring again to Figure 3, there are three (3) PWM outputs available on Digispark ATtiny85 boards. These are colored green in the pinout shown above and are labeled as PWM0, PWM1, and PWM4. There is no typo error here. The third PWM output is labeled as PWM4 because the PWM port numbers use the same Port B numbers. To clarify,

  • PWM0 is PB0
  • PWM1 is PB1
  • PWM4 is PB4

Arduino IDE Programming Notes

The PWM output signal is generated by the command analogWrite(). Although we are going to use the ports as analog outputs, we DO NOT use the ADC port numbers. Rather, we use the PWM port numbers which are the same as the Port B numbers. In other words, we are also using the Port B numbers in programming PWM in the Arduino IDE. Please take a look at the following sketch.

SPI (Serial Peripheral Interface) Communication

Ports PB0, PB1, and PB2 can be used for SPI communication:

  • MOSI – PB0
  • MISO – PB1
  • SCLK – PB2

I2C (Inter-Integrated Circuit) Communication

Ports PB0 and PB2 can be used for I2C communication:

  • SDA – PB0
  • SCK – PB2

USB (Universal Serial Bus) Communication

Ports PB3 and PB4 can be used for USB communication:

  • USB- is PB4
  • USB+ is PB3

Pin Change Interrupt and External Interrupt

Finally, ports PB0 to PB5 can all be used for pin change interrupt and PB2 as external interrupt pin.

Final Notes on Port B Pins

PB5 has limited current sourcing capacity. Also, when it is at output HIGH, it generates 3V instead of 5V on its output.

PB3 and PB4 are both used during programming (sketch upload). Therefore, it may be necessary to temporarily disconnect the circuits connected to them to avoid interfering with the uploading of sketches. Additionally, PB3 has a 1.5K pull-up resistor that is used for USB communication.

PB0 or PB1 has the built-in LED attached to it. Version A boards use PB1 while version B boards use PB0.

Digispark ATtiny85 Schematic Diagram

Schematic diagram of Digispark ATtiny85 whose pinout and configurations are described in this article
Figure 4. Digispark ATtiny85 Schematic Diagram

References on Digispark ATtiny85 Pinout and Configuration

http://digistump.com/wiki/digispark
ATtiny85 External and Pin Change Interrupt
How to Install Arduino IDE on Windows 10
How to Install ATTinyCore on Arduino IDE
How to Program ATtiny85 with Arduino IDE
How to Program Digispark ATtiny85 Board with Arduino IDE
Digispark USB Device Not Recognized
How to Use AT-09 BLE with Arduino and Smartphone

Leave a Reply

Your email address will not be published. Required fields are marked *