Jotrin Electronics
Wagen
arrow
Beschreibung Menge Insgesamt (USD) Betrieb
loading
Einkaufswagen Produkte
Einkaufswagen Produkte : 0
Startseite > Other > ATtiny85 Pinout, Datesheet, and Programming

ATtiny85 Pinout, Datesheet, and Programming

Updatezeit: 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.


ATtiny85-Microcontroller.jpg


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.


Family of ATtiny microcontrollers.png


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.


ATtiny85 Pinout.png


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.NamePin Description
PDIP, SOICQFN, MLF
11PB5

Reset,

debugWIRE IO,

ADC Input Channel 0,

Pin Change Interrupt 5

22PB3

Crystal Oscillator IN,

External Clock IN,

ADC Input Channel 3,

Complementary Timer/Counter 1 Compare Match B OUT,

Pin Change Interrupt 3

35PB4

Crystal Oscillator OUT,

System Clock OUT

ADC Input Channel 2,

Timer/Counter 1 Compare Match B OUT,

Pin Change Interrupt 4

48GNDGround
511PB0

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

612PB1

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 

714PB2

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

815VccSupply Voltage

3, 4, 6, 7, 9, 10, 13, 16 – 20DNC (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

ATtiny85 specifications.png


What is the Memory Layout of ATtiny85?


memory-layout.png


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:


  1. The first 32 locations are dedicated to accessing file registers.

  2. The following 64 locations are reserved for standard I/O memory.

  3. 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.


ATtiny85 Timers.jpeg


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.


SPI protocol.png


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.


ATtiny85 I2C Communication.png


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.


ATtiny85 Brown Out Reset (BOD).jpg


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.


ATtiny85 Interrupt.png


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 ADC.jpeg


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 Circuit.png


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.


Block diagram of ATtiny85.png


ATTINY85 PCB Schematic


ATTINY85 PCB Schematic.png


How to Use ATTINY85


  1. Disconnect your ATtiny85  from your Uno, and hook it up to any power source, like some batteries.

  2. Take the three 220 Ohm resistors and connect each separately to pins 0,1 and 2.

  3. Connect each LED anode to separate resistors.

  4. 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:


  1. Outline the tasks for the application design.

  2. Specify the functions to be performed by the controller to accomplish the required tasks.

  3. Develop the program code for these functions in the Integrated Development Environment (IDE) software.

  4. After coding, compile the program to identify and eliminate errors.

  5. Have the IDE generate a HEX file containing the machine code for the compiled program.

  6. Save the HEX file in the flash memory of the microcontroller.

  7. 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.

  8. Run the programmer software and select the appropriate HEX file.

  9. Burn the HEX file into the flash memory of the ATTINY85 using the programming software.

  10. 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)


ATtiny85 SMD (Surface mounted device).png


Dual In-line Package (DIP)


ATtiny85 DIP (Dual-in-line package).png


2D Model and Dimensions


2D Model and Dimensions.png


ATTINY85 Memory Map


ATTINY85 Memory Map.png


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


Vorherige: Understanding the 74HC00: Comprehensive Guide to Usage

Nächste: 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

Reviews
 

Wagen

Rechnung

jotrin03

Live-Chat

sales@jotrin.com