ATtiny85 Pinout, Datesheet, and Programming
Update Time: 2023-12-08 10:47:59
Contents
While Arduino, especially the Arduino UNO, is a popular development board among many makers and hobbyists, the Digispark ATtiny85 provides a compact and cost-effective alternative. It has gained favor among professionals and developers due to its remarkable features packed into a small size. As its name implies, it is a miniature 8-pin (PDIP) microcontroller that encompasses essential features such as built-in FLASH, EEPROM, SRAM, SPI, IIC, ADC, PWM, timer, comparator, IO, etc. The PCB includes USB connectivity and seamlessly integrates with the Arduino IDE. At its core, this compact board is powered by the ATtiny85 microcontroller. This article will take a closer look at the ATtiny85 pinout, specifications, datasheet and programming. Also, we will explore all the pins along with their functions and how to use this microcontroller.
What is ATtiny85?
The ATtiny85 is an 8-bit AVR microcontroller employing the AVR-enhanced RISC architecture. With an 8-pin PDIP interface, it falls within the category of low-power microcontrollers and is developed by Microchip.
According to the datasheet, it boasts 8 KB of flash, an 8 MHz internal RC oscillator serving as the default clock, and 512 bytes of EEPROM and SRAM. Operating at 20 MHz, it achieves a throughput of 20 MIPS and functions within the voltage range of 2.7-5.5V.
Equipped with two 8-bit timers or counters, including one high-speed variant, it features four pulse-width modulation (PWM) outputs and a four-channel 10-bit ADC.
Adding a 10-bit ADC converter and a programmable watchdog timer enhances its suitability for resetting the device in case of an infinite loop or sensor interfacing challenges.
Despite its modest 8-pin configuration, the ATtiny85 can execute nearly all functions expected of a standard microcontroller. The pinout specification can give a more comprehensive understanding of its capabilities.
What does the Number 85 in ATtiny85 Represents?
Within the ATtiny series, the initial digit succeeding ATtiny indicates the flash memory size in kibibytes (KiB). Consequently, an ATtiny85 comprises 8KiB of flash memory. The second digit denotes the model type, with more robust and recent models having higher numbers. In this context, the ATtiny85 is identified as a model from the year 2005.
ATtiny85 Pinout
The arrangement of pins on any microcontroller is contingent on its packaging style. Therefore, to comprehend the ATtiny85 Pinout, it's imperative to examine all the available IC Packages for the ATtiny85 Microcontroller.
Like other contemporary microcontrollers, the ATtiny85 is offered in various IC packages. Its compact size makes it accessible in 8-pin PDIP, 8-pin SOIC, and 20-pad QFN packages.
Both 8-pin packages, namely 8-pin PDIP and 8-pin SOIC, share the same pinout. An exciting aspect of the 20-pad QFN package is that despite having 20 pads, 12 of them are designated as DNC (Do Not Connect). Consequently, this leaves us with the essential 8 functional pads.
The accompanying image presents the IC Packages and the ATtiny85 Pinout for these packages.
Observing the image above, it becomes evident that each pin of the ATtiny85 Microcontroller is extensively multiplexed, with certain pins supporting up to 9 distinct functionalities (of which only one can be utilized).
Pin Configuration
Having examined the ATtiny85 Pinout across all IC Packages, let's delve into the specifics of the Microcontroller's pins and their functions. We have compiled a detailed table encompassing all the pins, their alternative functions, and corresponding descriptions.
Pin No. Name Pin Description PDIP, SOIC QFN, MLF 1 1 PB5 Reset,
debugWIRE IO,
ADC Input Channel 0,
Pin Change Interrupt 5
2 2 PB3 Crystal Oscillator IN,
External Clock IN,
ADC Input Channel 3,
Complementary Timer/Counter 1 Compare Match B OUT,
Pin Change Interrupt 3
3 5 PB4 Crystal Oscillator OUT,
System Clock OUT
ADC Input Channel 2,
Timer/Counter 1 Compare Match B OUT,
Pin Change Interrupt 4
4 8 GND Ground 5 11 PB0 SPI Master OUT Slave IN,
Analog Comparator Positive IN,
Timer/Counter 0 Compare Match A OUT,
Complementary Timer/Counter 1 Compare Match A OUT,
USI Data IN (3-Wire Mode),
USI Data IN (2-Wire Mode – I2C), External Analog Reference
Pin Change Interrupt 0
6 12 PB1 SPI Master IN Slave OUT,
Analog Comparator Negative IN,
Timer/Counter 0 Compare Match B OUT,
Timer/Counter 1 Compare Match A OUT,
USI Data OUT (3-Wire Mode),
Pin Change Interrupt
7 14 PB2 SPI Serial Clock,
ADC Input Channel 1,
Timer/Counter 0 Clock Source,
USI Clock (3-Wire Mode),
USI Clock (2-Wire Mode – I2C),
External Interrupt 0 IN,
Pin Change Interrupt 2
8 15 Vcc Supply Voltage 3, 4, 6, 7, 9, 10, 13, 16 – 20 DNC (Do Not Connect)
Note: The provided pin description offers a concise summary of the potential functions associated with each pin. To gain a thorough understanding of the pin functions and the process of selecting an appropriate function via the multiplexer, it is recommended to refer to the datasheet of the ATtiny85.
Pin Description of ATtiny85 Microcontroller
Power
The ATtiny85 is equipped with two power pins. Pin 8, labeled Vcc, serves as the power supply, while Pin 4, labeled GND, is the ground connection. It is crucial to ensure that the power supply voltage adheres to the specified rating to prevent any issues with the ATtiny operation.
Oscillator/Clock
The ATtiny85 features an internal clock with an 8MHz default value, and its clock frequency can range from 0 to 8MHz. It can extend its oscillator frequency up to 20MHz. Connecting to the appropriate oscillator pins is necessary to adjust the oscillator value.
GPIO2: XTAL1/CLKI
GPIO3: XTAL2/CLKO
Digital Input/Output
In the ATtiny85, each pin can function as a digital input or output, contingent upon the program specifications. These pins are configured as bidirectional input/output interfaces. Except the power supply pin, any pin can be designated for input/output operations.
GPIO5: PB0
GPIO6: PB1
GPIO7: PB2
GPIO2: PB3
GPIO3: PB4
GPIO1: PB5
Interrupt
The ATtiny85 is furnished with a single interrupt pin, which can be manipulated by the output from any sensor or activated manually using a button.
GPIO7: INT0
SPI
The SPI pins on the ATtiny85 are as follows:
GPIO5: MOSI
GPIO6: MISO
GPIO7: SCK
GPIO1: Debugging wire (DW)
MOSI is employed for data transmission.
MISO is designated for data reception.
SCK manages the clock.
DW is utilized for programming.
I2C
The ATtiny85 supports the I2C communication protocol. In this protocol, data is transmitted and received over a single line, while another line sends clock pulses to synchronize the data. The I2C pins are:
GPIO5: SDA (Data)
GPIO7: SCL (Clock)
Timer
The ATtiny85 incorporates timers, Timer 0 and Timer 1, designed to count clock pulses. Both timers operate based on the internal clock, but Timer 0 can also be synchronized with an external clock pulse.
Both timers are 8-bit, and their respective pins are as follows:
GPIO7: Timer 0
Counter/Timer and PWM
PWM, or Pulse Width Modulation, is a feature of the ATtiny85 with four PWM channels.
Special pins in combination with internal PWM signal input can efficiently drive external power. These pins operate based on a specific time known as the Dead Time Generator. The timer counts and compares values until they reach zero.
For ATtiny85, Timer 0 and Timer 1 count two dead generator values, and the output signal is non-overlapping. The associated GPIO pins are:
GPIO-OC1B
GPIO-OC1B’
GPIO-OC0B
GPIO-OC0A
GPIO-OC1A
GPIO-OC1A’
Analog Comparator
The ATtiny85 features an internal analog comparator, enabling the comparison of analog signals in inverted and non-inverted forms. The comparison output is stored in a register for further use. Analog comparator pins on ATtiny85 are:
GPIO5: AIN0
GPIO6: AIN1
Analog to Digital Converter
ATtiny85 offers four analog input channels, converting analog input into a 10-bit digital output. The conversion speed ranges from 65 to 260 microseconds.
Analog pins are:
GPIO1: ADC0
GPIO7: ADC1
GPIO3: ADC2
GPIO2: ADC3
GPIO5: Vref
Reset
The ATtiny85 features both external and internal reset options. It can be reset based on specific program conditions or externally through a designated pin.
Features and Specifications
What is the Memory Layout of ATtiny85?
ATtiny85's memory utilizes Atmel's high-density technology, ensuring non-volatile storage.
Reprogramming of the Program Memory can be accomplished through the SPI serial interface, utilizing two methods:
On-chip boot code
Non-volatile memory programmer
The central processing unit (CPU) is pivotal in executing the main program and is responsible for memory access and calculations.
Categorized under AVR controllers, this module designates separate reserved locations for both data and program memory.
Program Memory (ROM)
The reprogrammable flash memory of the ATtiny85 is designed for flexibility. It offers 8k memory space with an endurance of approximately 10,000 write/erase cycles, allowing instructions to be erased and written 10,000 times.
The program counter for the flash memory is 12 bits wide, addressing 4096 program memory locations.
Data Memory (RAM)
The data memory provides a 512-byte memory space, allocating memory locations in three ways:
The first 32 locations are dedicated to accessing file registers.
The following 64 locations are reserved for standard I/O memory.
The remaining space is utilized for internal data - SRAM.
Five addressing modes characterize the data memory:
Direct
Indirect
Indirect with Displacement
Indirect with Pre-decrement
Indirect with Post-increment
The pointer registers, spanning R26 to R31 in the Register File, refer to registers with indirect addressing. Direct addressing covers the entire data space.
Indirect with Displacement involves 63 address locations using a base address accessible by the Y or Z register.
Indirect addressing modes, combined with both post-increment and pre-decrement, cause the address registers X, Y, and Z to increment and decrement at regular intervals.
What can ATtiny85 be Used for?
The ATtiny85 is versatile, performing various functions on a single chip, with some pins offering multiple functionalities. Key functions include:
Timers:
The chip features two timers that introduce delays in specific functions when operating in timer mode, extending the instruction cycle. In counter mode, these timers count intervals on a particular function within the controller, influencing the rising and falling edges of the involved pin.
Peripheral Interface (SPI) Communication:
Utilizing the Serial Peripheral Interface (SPI), the chip communicates with other peripherals like sensors and SD cards. This interface includes separate clock and data lines, along with a select line to designate the desired device for communication. This ensures a consistent communication path following a specific protocol.
I2C Communication:
The inclusion of the I2C protocol, a 2-wire system, facilitates connections with low-speed devices such as DAC converters, ADC, I/O interfaces, and microcontrollers. Serial Data (SDA) and Serial Clock (SCL) are essential wires in this communication protocol.
Brown Out Reset (BOD):
The BOD function resets the controller when Vdd (voltage supply) falls below a predefined brownout threshold voltage. Multiple voltage ranges are provided when the power drops below the voltage supply line.
Interrupt:
Operating on a priority basis, the Interrupt function temporarily halts the main function to execute necessary instructions. Once executed, the controller returns to the main program.
ADC:
The ADC module in this device is a valuable feature, enhancing sensor compatibility. It is a 10-bit module with four channels, a configuration different from other Microchip modules, which may offer 7 or 12 channels.
ATTINY85 Circuit
Assemble the circuit on the breadboard following the diagram. Position the LED cathode (-) legs to the left of the image, linking them to a common ground pin on the ATtiny85 via a 330 Ohm resistor. Use male-to-male jumper wires to connect the 330 Ohm resistors for two LEDs to the third one, establishing a unified ground connection connected to the ATtiny85. Connect the LED's anode (+) leg directly to Pins 0, 1, and 2 using male-to-female jumper wires.
ATtiny85 Block Diagram
To comprehend the primary functions present in the controllers, it is essential to examine block diagrams and understand the interconnection of each component. The illustration below depicts the block diagram of the ATtiny85.
ATTINY85 PCB Schematic
How to Use ATTINY85
Disconnect your ATtiny85 from your Uno, and hook it up to any power source, like some batteries.
Take the three 220 Ohm resistors and connect each separately to pins 0,1 and 2.
Connect each LED anode to separate resistors.
Connect all LED cathodes to GND.
How to Program ATTINY85 with Arduino IDE
A compiler is an essential requirement for programming Atmel microcontrollers.
Various options for compilers include:
Atmel Studio
Mikro C for AVR
AVR – GCCAVR – (toolchain for Linux & Windows)
The IDE programmer utilized for programming Arduino is also compatible with programming the ATtiny85.
The ATtiny85 functions similarly to other microcontrollers, executing the application program stored in its memory. Without programming, the controller remains inactive.
The ATTINY85 operates similarly to other microcontrollers. In essence, microcontrollers execute the application program stored in their memory. Therefore, the primary task for controllers is to develop the application program. In the absence of programming, the controller remains inactive.
Here is a step-by-step procedure for programming the ATTINY85:
Outline the tasks for the application design.
Specify the functions to be performed by the controller to accomplish the required tasks.
Develop the program code for these functions in the Integrated Development Environment (IDE) software.
After coding, compile the program to identify and eliminate errors.
Have the IDE generate a HEX file containing the machine code for the compiled program.
Save the HEX file in the flash memory of the microcontroller.
Choose a programming device, typically an SPI programmer designed for AVR microcontrollers, to establish communication between the PC and ATTINY85. Alternatively, programming can be done using UART Interface or ARDUINO boards.
Run the programmer software and select the appropriate HEX file.
Burn the HEX file into the flash memory of the ATTINY85 using the programming software.
After disconnecting the programmer, connect the necessary peripherals for the controller and start the system.
Once powered, the ATTINY85 executes the machine code stored in its memory to produce the programmed response.
Alternatives
ATTINY85 alternatives include ATTINY25, ATTINY45, ATTINY25V, ATTINY45V, and ATTINY85V.
Applications
This module finds primary applications in real-time scenarios within industrial automation.
Embedded Systems Projects utilize this module for automation purposes.
It is applicable and can be integrated into robotics.
AVR controllers, spanning Quad-copters and space Aeroplanes, play a significant role in aeronautical technology.
Power monitoring and management systems implement this module.
ATTINY85 Package
ATtiny85 is available in two package variants:
Surface Mounted Device (SMD)
Dual In-line Package (DIP)
2D Model and Dimensions
ATTINY85 Memory Map
ATTINY85 Datasheet
Download ATTINY85 Datasheet PDF.
Conclusion
The ATtiny85 microcontroller, crafted by Atmel (Microchip Technology), stands out as a budget-friendly and energy-efficient 8-pin solution. Widely employed in various embedded projects, its capabilities shine when seamlessly programmed through the Arduino IDE. Despite its modest pin count, it boasts economical pricing and minimal power consumption. The ATtiny85 proves to be a cost-effective and adept option, satisfying all your technical requirements.
When advancing to the next tier of microcontroller endeavors, the ATtiny85 presents heightened capability and flexibility. Its economical cost and low power demands make it an ideal choice for embedded projects. Although the ATtiny85's limited five (or six) I/O pins could pose constraints in specific scenarios, they might suffice for your upcoming application.
Read More
Previous: CD4017BE CMOS Counter: Circuit, Pinout and Datasheet
Next: Exploring TL072 OP-AMP IC Pinout, Datasheet, Where & How to Use It
FAQ
- Does ATtiny85 have I2C?
The ATtiny85 microcontroller is furnished with a Universal Serial Interface, commonly known as USI, which can be set up to function in I2C mode.
- What is the input voltage of ATtiny85?
2.7-5.5 volts.
- Does ATtiny85 have analog input?
ATtiny85 has no analog input.
- What language does attiny85 use for programming?
You have the option to utilize either assembly or C language for programming. For compilation, ATMEL AVR Studio in C is recommended. Beginners may find ICC AVR a suitable choice due to the abundance of available online resources.
- What is the difference between ATtiny85 and 13?
The ATtiny85 boasts greater flash, RAM, and EEPROM memory than the ATtiny13.
Ratings and Reviews
Related Products
-
PM40028B-F3EI
Microchip
PFX 28XG4, 28-LANE GEN4 FANOUT P > -
PIC16F1825T-I/SLVAO
Microchip
8-bit Microcontrollers - MCU > -
PD69208MILQ-TR
Microchip
Power Over Ethernet PSE Controller 32V 5 > -
LAN8671B1-E/U3B
Microchip
IC TXRX FULL/HALF 1/1 24VQFN > -
2280000-R
Microchip
ADAPTEC I-RA-HDMSAS-4SATA-SB-.8M > -
VSC3308YKU
Microchip
Solar Connectors / Photovoltaic Connecto > -
BM70BLE01FC2-0002AA
Microchip
Bluetooth v4.2 (BLE) SMART SOC IoT 3V 30 > -
SST25VF040B-50-4I-SAF-T
Microchip
Flash Memory, Serial NOR, 4 Mbit, 512K x > -
PIC16F18344-I/SS
Microchip
8 Bit MCU, PIC16 Family PIC16F18XX Serie > -
ATMXT640U-CCU023
Microchip
UFBGA-88 > -
RN42-I/RM477
Microchip
Bluetooth / 802.15.1 Modules > -
KSZ8567RTXI
Microchip
IC ETHERNET SWITCH 7PORT 128TQFP > -
ATSAMS70J21A-AN
Microchip
ARM MCU, SAM S70 Series, SAM32 Family SA > -
ATMEGA328PB-AU
Microchip
8 Bit MCU, AVR, AVR ATmega Family ATmega > -
ZL30142GGG2
Microchip
System Synchronizer -40C to 85C 64-Pin C >
Hot Stocks
More- SY89297UMH
- SST49LF008A-33-4C-WHE
- SST39VF1601-70-4I-B3KE
- SST39VF020-70-4I-NHE
- QT100-ISG
- PIC32MX675F512L-80I/PT
- PIC32MX130F064D-I/PT
- PIC24FJ256GA106-I/PT
- PIC24F32KA304-I/ML
- PIC18F85J10-I/PT
- PIC18F6680
- PIC18F4550-I/ML
- PIC18F2331
- PIC16F946-I/PT
- PIC16F87-I/SS
- PIC16F872T-I/SO
- PIC12F683T-I/SN
- PIC12F508-I-SN
- MIC4421YM
- MCP6H02-E/SN
- MCP23S18-E/MJ
- MCP23S08-E/SS
- MCP1702T-3002E/CB
- LAN8700C-AEZG-TR
- KSZ8863FLL
- ATSAM3X8EA-AU
- ATMEGA32U4RC-AU
- ATMEGA1284-PU
- ATMEGA1280-16AU
- ATF1504AS-10JU44
- AT91SAM9260B-CU
- AT90CAN32-15AZ
- AT89S8253-24JU
- AT49BV1614A-90TI
- AT45DB011B-SU
- AT30TSE752-SS8-B
- AT27C256R-70TU
- AT24C128BW-SH-T
- AT24C1024BW-SH25-B
- AT24C08BN-SH-B
- 93AA46BT-I/OT
- 28C16A-20/P
- 24AA08T-I/OT
- 18F26J50
- 12LC508A