ATMEGA164P-20PQ - 16KB AVR MCU 20MHz PDIP-40 | Microchip
MPN: ATMEGA164P-20PQ β Active| Qty | Unit Price | Extended |
|---|---|---|
| 1 | $4.32 | $4.32 |
| 10 | $3.89 | $38.90 |
| 100 | $3.45 | $345.00 |
| 500 | $3.1 | $1,550.00 |
| 1,000 | $2.81 | $2,810.00 |
ATMEGA164P-20PQ Overview
A microcontroller (MCU) is a single-chip computer that integrates a processor core, memory, and programmable peripherals on one die. The ATmega164P belongs to the AVR family of 8-bit MCUs, positioned within the broader hierarchy of embedded processors used in countless electronic products. AVR cores execute most of their 131 powerful instructions in a single clock cycle, delivering up to 20 MIPS throughput at 20 MHz.
Key features include 16 KB of in-system self-programmable flash with read-while-write support, 32 general purpose I/O lines, 32 general purpose working registers, a real-time counter, three flexible timer/counters with compare modes and PWM, and two USARTs for dual serial communication channels. The picoPower technology platform enables low-power design with multiple sleep modes.
Technical depth: the enhanced AVR RISC architecture couples a fully static core with byte-oriented Two-Wire Interface (TWI/I2C), SPI, an 8-channel 10-bit ADC, and a programmable watchdog timer with on-chip oscillator. In-system programming via SPI removes the need for external programming voltage, and bootloader flash sections support field firmware updates over UART.
Typical applications include industrial control panels, sensor and data-logging systems, hobby and education platforms (the DIP package is breadboard-friendly), and small appliances requiring two independent UART channels for RS-485 plus debug connectivity.
Design consideration: run the ATMEGA164P-20PQ at 4.5 V to 5.5 V; the P suffix denotes picoPower, so configure brown-out detection and sleep modes properly to realize the datasheet power figures. The extended-temperature PQ grade suits -40C environments.
This page synthesizes distributor pricing, drop-in alternatives, pinout data, and practical design notes not found in the manufacturer datasheet.
Drop-in alternatives for ATMEGA164P-20PQ β same package, pin-to-pin compatible. Different-package parts requiring PCB rework are excluded.
Variants in this series
Same-series models that are drop-in compatible with ATMEGA164P-20PQ (same form factor and footprint) β differing in Package, Maximum Clock Frequency, Timers/Counters, Mounting Type, Core Architecture.
Quick Comparison Tool β Select alternative parts for side-by-side comparison:
ATMEGA164P-20PI
β Drop-In β οΈ εζ°εΎ ιͺθ―π Reference alternative (not in catalog)
ATMEGA164P-20PN
β Drop-Inπ Reference alternative (not in catalog)
ATMEGA164PA-PU
β Drop-Inπ Reference alternative (not in catalog)
ATMEGA162-16PI
β Drop-Inβ In Stock
$3.55 / Unit
View Datasheet βATMEGA162V-1PC
β Drop-Inβ In Stock
$3.4 / Unit
View Datasheet βATMEGA16-16PI
β Drop-Inβ In Stock
$3.72 / Unit
View Datasheet βATMEGA164P-20PQ Maximum Ratings & Electrical Characteristics
| Core Architecture | 8-bit AVR RISC |
| Flash Memory | 16 KB (8K x 16) ISP |
| EEPROM | 512 B |
| SRAM | 1 KB |
| Maximum Clock Frequency | 20 MHz |
| MIPS Throughput | Up to 20 MIPS at 20 MHz |
| Supply Voltage | 4.5 V to 5.5 V |
| General Purpose I/O | 32 lines |
| Timers/Counters | 3 flexible timer/counters with compare modes and PWM |
| USART Channels | 2 |
| ADC | 8-channel, 10-bit |
| Serial Interfaces | 2x USART, SPI, TWI (I2C) |
| Package | 40-PDIP (0.600 in, 15.24 mm) |
| Mounting Type | Through Hole |
| Special Features | picoPower, read-while-write flash, real-time counter, watchdog timer, internal oscillator |
| RoHS Status | Green (per FindIC listing) |
ATMEGA164P-20PQ Pin Configuration
| Pin 1 | PB0 (XCK0/T0) β Port B bit 0 / USART0 external clock / Timer0 external clock |
| Pin 2 | PB1 (T1) β Port B bit 1 / Timer1 external clock |
| Pin 3 | PB2 (AIN0/INT2) β Port B bit 2 / analog comparator positive input / external interrupt 2 |
| Pin 4 | PB3 (AIN1/OC0) β Port B bit 3 / analog comparator negative input / Timer0 output compare |
| Pin 5 | PB4 (SS) β Port B bit 4 / SPI slave select |
| Pin 6 | PB5 (MOSI) β Port B bit 5 / SPI master output |
| Pin 7 | PB6 (MISO) β Port B bit 6 / SPI master input |
| Pin 8 | PB7 (SCK/OC2) β Port B bit 7 / SPI clock / Timer2 output compare |
| Pin 9 | RESET β Reset input, active low |
| Pin 10 | VCC β Digital supply voltage (4.5 V to 5.5 V) |
| Pin 11 | GND β Ground |
| Pin 12 | XTAL2 β Inverting oscillator amplifier output |
| Pin 13 | XTAL1 β Inverting oscillator amplifier input / external clock input |
| Pin 14 | PD0 (RXD0) β Port D bit 0 / USART0 receive |
| Pin 15 | PD1 (TXD0) β Port D bit 1 / USART0 transmit |
| Pin 16 | PD2 (RXD1/INT0) β Port D bit 2 / USART1 receive / external interrupt 0 |
| Pin 17 | PD3 (TXD1/INT1) β Port D bit 3 / USART1 transmit / external interrupt 1 |
| Pin 18 | PD4 (XCK1/OC1B) β Port D bit 4 / USART1 external clock / Timer1 output compare B |
| Pin 19 | PD5 (XCK1/OC1A) β Port D bit 5 / USART1 external clock / Timer1 output compare A |
| Pin 20 | PD6 (ICP1) β Port D bit 6 / Timer1 input capture |
| Pin 21 | PD7 (OC2A) β Port D bit 7 / Timer2 output compare A |
| Pin 22 | PC0 (SCL) β Port C bit 0 / TWI clock |
| Pin 23 | PC1 (SDA) β Port C bit 1 / TWI data |
| Pin 24 | PC2 (TCK) β Port C bit 2 / JTAG test clock |
| Pin 25 | PC3 (TMS) β Port C bit 3 / JTAG test mode select |
| Pin 26 | PC4 (TDO) β Port C bit 4 / JTAG test data output |
| Pin 27 | PC5 (TDI) β Port C bit 5 / JTAG test data input |
| Pin 28 | PC6 (TOSC1) β Port C bit 6 / Timer oscillator input (32.768 kHz) |
| Pin 29 | PC7 (TOSC2) β Port C bit 7 / Timer oscillator output (32.768 kHz) |
| Pin 30 | AVCC β ADC and port A supply voltage |
| Pin 31 | GND β Ground |
| Pin 32 | AREF β ADC reference voltage |
| Pin 33 | PA0 (ADC0) β Port A bit 0 / ADC channel 0 |
| Pin 34 | PA1 (ADC1) β Port A bit 1 / ADC channel 1 |
| Pin 35 | PA2 (ADC2) β Port A bit 2 / ADC channel 2 |
| Pin 36 | PA3 (ADC3) β Port A bit 3 / ADC channel 3 |
| Pin 37 | PA4 (ADC4) β Port A bit 4 / ADC channel 4 |
| Pin 38 | PA5 (ADC5) β Port A bit 5 / ADC channel 5 |
| Pin 39 | PA6 (ADC6) β Port A bit 6 / ADC channel 6 |
| Pin 40 | PA7 (ADC7) β Port A bit 7 / ADC channel 7 |
Typical Applications
ATMEGA164P-20PQ is suitable for 6 applications: Industrial Control Panels, Sensor and Data Logging Systems, Education and Hobby Prototyping, Dual-Channel Communication Gateways, Home Appliance and HVAC Control, Motor Control and PWM Actuation.
Industrial Control Panels
The ATMEGA164P-20PQ fits industrial control panel designs because its extended-temperature PQ grade, watchdog timer with independent on-chip oscillator, and 4.5 V to 5.5 V tolerance match typical 5 V panel electronics. Two hardware USARTs allow one channel to drive an RS-485 Modbus network while the second handles a local HMI or debug console, eliminating software UART bit-banging and its timing jitter. Three timer/counters with compare modes and PWM generate relay sequencing, buzzer tones, and backlight dimming directly in hardware. The 16 KB flash with read-while-write stores parameter tables in the remaining 512 B EEPROM across power cycles, and the through-hole PDIP-40 package simplifies field replacement on legacy-style boards.
Recommended
Sensor and Data Logging Systems
The 8-channel 10-bit ADC makes the ATMEGA164P-20PQ a natural fit for multi-sensor data loggers. Eight analog inputs accept thermistors, potentiometers, or 0-5 V transducer outputs directly, with the internal bandgap reference or the AREF pin setting full-scale. The 1 KB SRAM buffers samples between EEPROM write cycles, while the 512 B EEPROM archives calibration constants that survive power loss. PicoPower sleep modes let the MCU idle between acquisition intervals - in power-down mode the core current drops to microamp levels per Microchip picoPower data - extending battery life in remote installations. The dual USART design permits one UART for GPS or sensor modules and the other for a GSM modem, both at hardware-timed baud rates up to the 20 MHz clock limits.
Recommended
Education and Hobby Prototyping
The 0.600-inch 40-PDIP package of the ATMEGA164P-20PQ is breadboard-friendly and socket-mountable, which is why through-hole ATmega parts dominate university embedded-systems labs and hobby platforms. Students can program the chip in-system with a low-cost SPI ISP programmer using only six wires - VCC, GND, RESET, SCK, MOSI, MISO - with no special programming voltage. The 20 MHz clock gives snappy instruction execution for LED matrices, motor control experiments, and LCD projects, while 32 GPIO lines provide ample I/O for multi-peripheral lab exercises. The internal RC oscillator allows operation with zero external crystal for cost-sensitive coursework, and the extensive AVR documentation base (tutorials, Arduino-compatible cores, and toolchain support in avr-gcc) shortens the learning curve substantially.
Recommended
Dual-Channel Communication Gateways
Designs bridging two serial networks benefit directly from the ATMEGA164P-20PQ's two independent hardware USARTs. A typical gateway translates between an RS-485 field bus on USART0 and an RS-232 service port or radio modem on USART1, with the hardware framing and parity generators offloading the CPU. The 20 MHz clock supports baud rates comfortably above 115200 on both channels simultaneously, and the 16 KB flash leaves room for protocol stacks plus bootloader firmware updated in-field over either UART via the read-while-write flash capability. TWI (I2C) and SPI interfaces add expansion for EEPROMs, RTCs, and displays on the same chip. Brown-out detection and the watchdog timer provide the reset discipline gateways need for unattended operation.
Recommended
Home Appliance and HVAC Control
Appliance and HVAC controllers use the ATMEGA164P-20PQ for its combination of ADC-based temperature sensing, PWM actuator drive, and low standby power. The 8-channel 10-bit ADC reads NTC thermistors on multiple zones, while timer PWM outputs drive triac firing circuits or DC fan speeds without CPU intervention. PicoPower sleep modes cut consumption during thermostat idle periods, and the real-time counter with a 32.768 kHz crystal on the TOSC pins maintains accurate timekeeping while the main core sleeps - useful for scheduled setpoint changes. The 5 V through-hole package suits conventional appliance power supplies and serviceable board designs, and the watchdog timer resets frozen firmware to prevent heating-element faults.
Recommended
Motor Control and PWM Actuation
The three timer/counters of the ATMEGA164P-20PQ provide multiple PWM channels with compare-match interrupts, sufficient for small DC motor speed control, servo positioning, and stepper sequencing. At 20 MHz the 8-bit timers achieve approximately 78 kHz PWM at full resolution, which is above the audible range for fan and pump control. The ADC samples motor current via a shunt for stall detection and closed-loop speed regulation, and the input-capture unit timestamps encoder edges with clock-cycle precision. The watchdog provides fail-safe shutdown if firmware hangs while a motor is energized. Because the PQ grade tolerates elevated enclosure temperatures, it suits sealed gearboxes and pump housings where ventilation is limited.
Recommended
Recommended Products Summary
Engineering reference data for ATMEGA164P-20PQ β comparison, design guidance, and compliance information.
Selection Guide
Comparison with Alternatives
| Parameter | This Product | ATMEGA164P-20PI | ATMEGA164PA-PU | ATMEGA162-16PI | ATMEGA16-16PI |
|---|---|---|---|---|---|
| Package | 40-PDIP (0.600 in, 15.24 mm) | 40-PDIP (0.600 in) - same | 40-PDIP (0.600 in) - same | 40-PDIP (0.600 in) - same | 40-PDIP (0.600 in) - same |
| Brand | Microchip Technology | Microchip Technology | Microchip Technology | Microchip Technology | Microchip Technology |
| Max Clock Frequency | 20 MHz | 20 MHz | 20 MHz | 16 MHz | 16 MHz |
| Flash Memory | 16 KB | 16 KB | 16 KB | 16 KB | 16 KB |
| SRAM | 1 KB | 1 KB | 1 KB | 1 KB | 1 KB |
| ADC | 8-channel 10-bit | 8-channel 10-bit | 8-channel 10-bit | None | 8-channel 10-bit |
| USART Channels | 2 | 2 | 2 | 2 | 1 |
| Temperature Grade | Extended (PQ) / 5 V green | Industrial (I) | Industrial (U) | Industrial (I) | Industrial (I) |
| picoPower Technology | Yes | Yes | Yes | No | No |
| Lifecycle Recommendation | Active; newer PA device available | Active; newer PA device available | Active (recommended successor) | Legacy ATmega162 family | Legacy ATmega16 family |
Key Differentiators
- 20 MHz clock headroom over legacy ATmega16 (vs ATMEGA16-16PI)
- Integrated 10-bit ADC absent in ATMEGA162 (vs ATMEGA162-16PI)
- Extended temperature grade for harsher enclosures (vs ATMEGA164P-20PI)
- Trade-off: newer PA die offers lower power (vs ATMEGA164PA-PU)
Design Notes
Decouple VCC (pin 10) and AVCC (pin 30) with 0.1 uF ceramic capacitors placed within a few millimeters of each pin, and tie AVCC to VCC through a low-pass LC filter (e.g., 10 uH plus 0.1 uF) when ADC accuracy matters. Keep AREF (pin 32) decoupled with 0.1 uF to GND; never connect an external reference without a series resistor if the internal reference may also be selected. Estimated: at 5 V and 20 MHz, active current is on the order of 10-15 mA per typical AVR figures - budget regulator headroom accordingly.
The JTAG interface on PC2-PC5 is enabled by default in factory-fresh parts, so port C bits 2-5 will not function as GPIO until the JTAGEN fuse is cleared - a classic source of 'my LEDs do not work' bugs on ATmega164/324/644/1284 boards. Also confirm the CKDIV8 and CKOUT fuse states, and disable the debugWIRE/none-applicable interfaces per the fuse table. When substituting ATMEGA162 or ATMEGA16 parts, note their fuse maps and peripheral sets differ - re-run signature and fuse configuration in your programmer.
Use a crystal with two 12-22 pF load capacitors on XTAL1/XTAL2 (pins 13/12), routing the crystal and caps close to the DIP socket with short traces and a guard ground. For the real-time counter, connect a 32.768 kHz watch crystal between TOSC1/TOSC2 (pins 28/29) with appropriate 12.5 pF load caps. Keep RS-485/USART traces away from the oscillator net, and provide a solid ground plane on multilayer boards or a gridded ground on 2-layer through-hole designs.
The PDIP-40 package in a 5 V, 20 MHz application dissipates only tens of milliwatts (Estimated: ~50-75 mW at 10-15 mA active current), so no heatsink or thermal copper is required in ambient environments up to the extended temperature rating. Avoid continuous operation near maximum VCC with heavy I/O sourcing (40 mA absolute maximum per pin); group high-current loads onto separate drivers rather than driving them directly from multiple GPIO simultaneously.
Compliance Information
Distributor data (FindIC) lists ATMEGA164P-20PQ as a GREEN part, indicating Microchip's RoHS/halogen-free flow. Formal REACH and conflict-minerals declarations not found in provided data.