

The ATtiny13 is a small, low-power 8-bit microcontroller developed by Microchip Technology as part of the AVR family. It is designed for simple embedded applications where size, power efficiency, and cost are critical. With 1 KB of flash memory, 64 bytes of SRAM, and 8 GPIO pins, the ATtiny13 is ideal for compact designs requiring basic processing capabilities.








The ATtiny13 is a versatile microcontroller with the following key specifications:
| Parameter | Value |
|---|---|
| Architecture | 8-bit AVR RISC |
| Operating Voltage | 2.7V to 5.5V |
| Flash Memory | 1 KB |
| SRAM | 64 bytes |
| EEPROM | 64 bytes |
| Clock Speed | Up to 20 MHz (with external clock) |
| GPIO Pins | 8 |
| ADC Resolution | 10-bit |
| Power Consumption (Active) | ~240 µA at 1 MHz, 1.8V |
| Package Types | 8-pin PDIP, SOIC, or MLF |
The ATtiny13 is available in an 8-pin package. Below is the pinout and description:
| Pin Number | Pin Name | Description |
|---|---|---|
| 1 | PB5 (RESET) | Reset pin (active low) / GPIO |
| 2 | PB3 (ADC3) | GPIO / Analog input channel 3 |
| 3 | PB4 (ADC2) | GPIO / Analog input channel 2 |
| 4 | GND | Ground |
| 5 | PB0 (ADC0) | GPIO / Analog input channel 0 |
| 6 | PB1 (ADC1) | GPIO / Analog input channel 1 |
| 7 | PB2 (ADC2) | GPIO / Analog input channel 2 / External clock |
| 8 | VCC | Power supply (2.7V to 5.5V) |
The ATtiny13 is straightforward to use in embedded systems. Below are the steps and considerations for integrating it into your project.
The ATtiny13 can be programmed using an ISP (In-System Programmer) such as the USBasp or Arduino as ISP. Below is an example of programming the ATtiny13 using an Arduino UNO.
Connect the ATtiny13 to the Arduino UNO as follows:
Upload the "ArduinoISP" sketch to the Arduino UNO from the Arduino IDE.
Use the following example code to blink an LED connected to PB0 (Pin 5 on the ATtiny13):
// Blink an LED on PB0 (Pin 5 of ATtiny13)
#define LED_PIN 0 // PB0 is pin 0 in ATtiny13's pin mapping
void setup() {
pinMode(LED_PIN, OUTPUT); // Set PB0 as an output pin
}
void loop() {
digitalWrite(LED_PIN, HIGH); // Turn the LED on
delay(500); // Wait for 500 milliseconds
digitalWrite(LED_PIN, LOW); // Turn the LED off
delay(500); // Wait for 500 milliseconds
}
The ATtiny13 is not responding to programming commands.
The LED does not blink as expected.
The microcontroller overheats.
Q: Can the ATtiny13 run on batteries?
A: Yes, the ATtiny13 is designed for low-power applications and can run on batteries. Use a voltage regulator if the battery voltage exceeds 5.5V.
Q: How do I use the ADC feature?
A: The ATtiny13 has a 10-bit ADC. Configure the ADC registers in your code to read analog signals from PB0–PB3.
Q: Can I use the ATtiny13 with an external crystal oscillator?
A: No, the ATtiny13 does not support external crystal oscillators. However, it can use an external clock signal on PB2.
By following this documentation, you can effectively integrate the ATtiny13 into your projects and troubleshoot common issues.