Skip to main content

ATtiny45 Microcontroller

ATTINY45 is high performance, low power controller from ATMEL. It is an 8 bit controller based on Advanced RISC architecture. It is one of members of ATTINYXX series, popular because of its small size and features.


Pin Configuration

ATTINY45 is an 8 pin iC as shown in the ATtiny45 pin diagram above. All I/O pins of the chip here have more than one function. We will describe functions of each pin in below table.

Pin No.

Pin name


Secondary Function



Pin5 of  PORTB

  • Pin by default is used as RESET pin. The pin active low. PB5 can only be used as I/O pin when RSTDISBL Fuse is programmed.
  • ADC0 (ADC Input Channel 0)



Pin3  of  PORTB

  • XTAL1 (Chip Clock Oscillator pin 1 )
  • CLKI(Clock Input from an External Clock Source )
  • ADC3 (ADC Input Channel 3)
  • OC1B (Inverted-Timer/Counter1 Output Compare Match B Output)



Pin4 of  PORTB

  • XTAL2 (Chip Clock Oscillator pin2 )
  • CLKO(The divided system clock can be output on this pin )
  • ADC2 (ADC Input Channel 2)
  • OC1B (Timer/Counter1 Output Compare Match B Output




Connected to ground



Pin0  of  PORTB

  • MOSI (Master Output Slave Input). When controller acts as slave, the data is received by this pin. [Serial Peripheral Interface (SPI) for programming]
  • DI(Data Input for USI three-wire mode)
  • SDA (Two-wire Serial Bus Data Input/output Line)
  • AIN0(Analog Comparator Positive I/P)
  • OC0A(PWM - Timer/Counter0 Output Compare Match A Output)
  • OC1A (Inverted PWM - Timer/Counter1 Output Compare Match A Output)
  • AREF(Analog Reference Pin for ADC)



Pin1  of  PORTB

  • MISO (Master Input Slave Output). When controller acts as slave, the data is sent to master by this controller through this pin. [Serial Peripheral Interface (SPI) for programming]
  • DO(Data Output for USI three-wire mode)
  • AIN1(Analog Comparator Negative I/P)
  • OC0B(PWM - Timer/Counter0 Output Compare Match B Output)
  • OC1A (Timer/Counter1 Output Compare Match A Output.



  • SCK (SPI Bus Serial Clock). This is the clock shared between this controller and other system for accurate data transfer.

[Serial Peripheral Interface (SPI) for programming]

  • SCL (Two-wire Serial Bus Clock Line)
  • T0( Timer0 External Counter Input)
  • INT0(External Interrupt source0)
  • ADC1 (ADC Input Channel 1)




Connected to positive voltage


ATTINY45 Microcontroller Features

ATTINY45 –Simplified Features


8-bit AVR

Number of Pins


Operating Voltage (V)

+1.8 V TO +5.5V (ATTINY45V)

+2.7 VTO+5.5V (ATTINY45)(+5.5V being absolute maximum)

Number of I/O pins


Communication Interface

Master/Slave SPI Serial Interface(5,6,7  PINS) [Can be used for programming this controller]

Two-wire Serial Interface(5,7  PINS)[Can be used to connect peripheral devices like sensors and LCDs]

Universal Serial Interface (5,6 PINS) [Can be used for communicating with other controllers]

JTAG Interface

Not available

UART Interface

Not available

ADC Module

4channels, 10-bit resolution ADC

Timer Module

Two8-bit counter

Analog Comparators


DAC Module


PWM outputs


External Oscillator

0-10MHz for ATTINY45V

0-20MHz for ATTINY45

Internal Oscillator

0-8MHz  Calibrated Internal Oscillator

Program Memory Type


Program Memory or Flash memory

4Kbytes[10000 write/erase cycles]

CPU Speed






Watchdog Timer

Programmable Watchdog Timer with Separate On-chipOscillator

Program Lock


Power Save Modes

Three Modes[Idle, ADC Noise Reduction, Power-down]

Operating Temperature

-55°C to +125°C(+125 being absolute maximum, -55 being absolute minimum)



Note: Complete technical information ca be found in the ATTINY45 Datasheet linked at the bottom of this page.


ATTINY45 Alternatives



Where to Use ATtiny45 Microcontroller?

  • ATTINY45is an 8 pin AVR controller and so application program can be developed in AVR IDE which has many references.
  • Although we have many controllers, ATTINY is popular because it is one of cheapest.
  • Also ATTINY provides many features in lesser pins.
  • With program memoryof 4Kbytes the controller can be used in many applications.
  • With variousPOWER SAVING modes it can work on MOBILE EMBEDDED SYSTEMS.
  • With its small and compact size it can be put in many small boards.
  • With Watchdog timer and other features the use on ATTINY45 is further promoted.


How to Use ATTINY45

Like any other controller ATTINY45 works based on application program, i.e. execute the application program saved in its memory. 

The procedure to program an ATTINY45 microcontroller is described below:

  1. First list the functions to be executed by controller.
  2. Write the functions in programming language in IDE programs.

You can download the IDE program for free in company websites. IDE program for AVR controllers is ‘ATMEL STUDIO’. Link for ATMELSTUDIO is given below.

(Usually Atmel Studio 6.0 for Windows7 [ ],

 Atmel Studio 7 for Windows10 [ ])

  1. After writing the program compile it to eliminate errors.
  2. Make the IDE generate HEX file for the written program after compiling.
  3. This HEX file contains the machine code which should be saved in controller flash memory.
  4. Choose the programming device (usually SPI programmer made for AVR controllers) which establishes communication between PC and ATTINY45.Programming ATTINY45can also be done by using ARDUINO boards.
  5. Run the programmer software and choose the appropriate hex file.
  6. Burn the HEX file of written program in ATTINY45 flash memory using this program.
  7. Disconnect the programmer, connect the appropriate peripherals for the controller and get the system started.



  • Used in development boards.
  • Hobby projects
  • Drivers
  • Industrial control systems.
  • SMPS and Power Regulation systems.
  • Analog signal measuring and manipulations.
  • Embedded systems like coffee machine, vending machine.
  • Display units.
  • Peripheral Interface system.


2D Model

All measurements are in millimeters.

attiny45 dimensions

Component Datasheet

Related Post

Join 20K+subscribers

We will never spam you.

* indicates required

Be a part of our ever growing community.