ATMEGA328PB-ANR - 8-Bit AVR MCU 20MHz 32KB Flash TQFP-32 | Microchip
MPN: ATMEGA328PB-ANR ✓ Active| Qty | Unit Price | Extended |
|---|---|---|
| 1 | $1.99 | $1.99 |
| 10 | $1.85 | $18.50 |
| 100 | $1.62 | $162.00 |
| 500 | $1.45 | $725.00 |
| 1,000 | $1.3 | $1,300.00 |
ATMEGA328PB-ANR Overview
An 8-bit AVR microcontroller is a single-chip processor based on the AVR enhanced RISC architecture, in which most instructions execute in a single clock cycle to achieve throughput close to 1 MIPS per MHz. Within the power-management hierarchy, an MCU integrates the CPU, program memory, data memory, timers, communication peripherals, and analog blocks, replacing multi-chip logic solutions in embedded control systems.
Key features include 27 general-purpose I/O lines, 32 general-purpose working registers, and a richer peripheral set than the ATmega328P: the 328PB adds a second SPI interface, a second TWI (I2C) interface, an additional USART (three total), and two extra 16-bit timer/counters. The picoPower technology supports multiple sleep modes for ultra-low-power battery operation, and read-while-write Flash enables in-system programming without halting execution.
Architecturally, the device combines a Harvard-structure AVR core with a two-stage pipeline, hardware multiply, and flexible interrupt controller. Analog peripherals include a 10-bit ADC and analog comparators, while flexible timer/counter modules with PWM outputs drive motor, lighting, and power-conversion tasks. The extended -40C to +105C rating (the -AN suffix distinguishes it from the standard -40C to +85C -AU grade) suits deployments near heat sources such as power supplies and motors.
Typical applications include Arduino-compatible embedded controllers, industrial sensor nodes, HVAC and appliance control boards, and battery-powered IoT end nodes. Its backward software compatibility with the hugely popular ATmega328P protects existing code investments while providing more serial interfaces for expanding system connectivity.
A key design consideration: per Microchip and community migration notes, the 328PB is software-compatible with the 328P but exposes the added Port E and second buses on different pin locations; verify the 32-pin TQFP pinout against the datasheet when migrating legacy designs.
This page synthesizes verified distributor pricing, drop-in TQFP-32 alternatives, pinout data, and practical design notes not consolidated in the manufacturer datasheet.
Drop-in alternatives for ATMEGA328PB-ANR — 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 ATMEGA328PB-ANR (same form factor and footprint) — differing in Operating Temperature, Core Processor, Package, Communication Interfaces, Connectivity.
Quick Comparison Tool — Select alternative parts for side-by-side comparison:
ATMEGA328PB-AN
✅ Drop-In✓ In Stock
$1.66 / Unit
View Datasheet →ATMEGA328PB-AUR
✅ Drop-In ⚠️ 参数待验证✓ In Stock
$1.31 / Unit
View Datasheet →ATMEGA328PB-AU
✅ Drop-In ⚠️ 参数待验证✓ In Stock
$1.12 / Unit
View Datasheet →ATMEGA328P-AN
✅ Drop-In📋 Reference alternative (not in catalog)
ATMEGA328P-AUR
✅ Drop-In ⚠️ 参数待验证📋 Reference alternative (not in catalog)
ATMEGA168PB-AUR
✅ Drop-In ⚠️ 参数待验证✓ In Stock
$1.58 / Unit
View Datasheet →ATMEGA328PB-ANR Maximum Ratings & Electrical Characteristics
| Core Processor | AVR 8-bit RISC |
| Core Size | 8-bit |
| Speed | 20 MHz |
| Flash Memory | 32 KB (16K x 16) |
| EEPROM | 2 KB |
| SRAM | 4 KB |
| Operating Voltage Range | 1.8 V to 5.5 V |
| Number of I/O | 27 |
| General Purpose Working Registers | 32 |
| USART Peripherals | 3 |
| SPI Peripherals | 2 |
| I2C (TWI) Peripherals | 2 |
| ADC Resolution | 10-bit |
| Operating Temperature | -40C to +105C |
| Package | 32-TQFP (7 x 7 mm) |
| Mounting Type | Surface Mount |
| Connectivity | I2C, SPI, UART/USART |
| Programmability | In-System Programmable (ISP), read-while-write |
ATMEGA328PB-ANR Pin Configuration
| Pin 1 | PE0/AIN0 — Port E bit 0 / Analog Comparator negative input |
| Pin 2 | PE1/AIN1 — Port E bit 1 / Analog Comparator positive input |
| Pin 3 | GND — Ground |
| Pin 4 | VCC — Digital supply voltage |
| Pin 5 | GND — Ground |
| Pin 6 | VCC — Digital supply voltage |
| Pin 7 | PB6/XTAL1/TOSC1 — Port B bit 6 / crystal oscillator input |
| Pin 8 | PB7/XTAL2/TOSC2 — Port B bit 7 / crystal oscillator output |
| Pin 9 | PD5/XCK0/T0 — Port D bit 5 / USART0 external clock / Timer0 clock |
| Pin 10 | PD6/AIN0/OC0A — Port D bit 6 / analog comparator / Timer0 PWM output |
| Pin 11 | PD7/AIN1/OC1A — Port D bit 7 / analog comparator / Timer1 PWM output |
| Pin 12 | PB0/SS/PCINT0 — Port B bit 0 / SPI slave select |
| Pin 13 | PB1/OC1A/PCINT1 — Port B bit 1 / Timer1 PWM output |
| Pin 14 | PB2/SS/OC1B/PCINT2 — Port B bit 2 / SPI slave select / Timer1 PWM output |
| Pin 15 | PB3/MOSI/OC2A/PCINT3 — Port B bit 3 / SPI master output / Timer2 PWM output |
| Pin 16 | PB4/MISO/PCINT4 — Port B bit 4 / SPI master input |
| Pin 17 | PB5/SCK/PCINT5 — Port B bit 5 / SPI serial clock |
| Pin 18 | AVCC — ADC supply voltage |
| Pin 19 | PE2/OC1B — Port E bit 2 / Timer1 PWM output |
| Pin 20 | AREF — ADC analog reference |
| Pin 21 | GND — Ground |
| Pin 22 | PE3/OC3A — Port E bit 3 / Timer3 PWM output |
| Pin 23 | PC0/ADC0 — Port C bit 0 / ADC channel 0 |
| Pin 24 | PC1/ADC1 — Port C bit 1 / ADC channel 1 |
| Pin 25 | PC2/ADC2 — Port C bit 2 / ADC channel 2 |
| Pin 26 | PC3/ADC3 — Port C bit 3 / ADC channel 3 |
| Pin 27 | PC4/ADC4/SDA — Port C bit 4 / ADC channel 4 / TWI data |
| Pin 28 | PC5/ADC5/SCL — Port C bit 5 / ADC channel 5 / TWI clock |
| Pin 29 | PC6/RESET — Port C bit 6 / Reset input |
| Pin 30 | PD0/RXD0 — Port D bit 0 / USART0 receive |
| Pin 31 | PD1/TXD0 — Port D bit 1 / USART0 transmit |
| Pin 32 | PD2/RXD1/INT0 — Port D bit 2 / USART1 receive / external interrupt 0 |
Typical Applications
ATMEGA328PB-ANR is suitable for 6 applications: Arduino-Compatible Embedded Controllers, Industrial Sensor Nodes and Field Instrumentation, Battery-Powered IoT End Nodes, HVAC and Appliance Control Boards, Motor Control and PWM Power Conversion, Security and Access-Control Devices.
Arduino-Compatible Embedded Controllers
The ATMEGA328PB-ANR is the successor MCU used in Arduino UNO-compatible and Nano-compatible boards, and its 32 KB Flash / 2 KB EEPROM / 4 KB SRAM memory set plus bootloader-friendly ISP support make it a natural fit for the maker ecosystem. Software and fuse compatibility with the ATmega328P means existing sketches, cores, and toolchains (avr-gcc, Arduino IDE) run unchanged, while the added second SPI, second TWI, and third USART let shield-based designs add displays, sensors, and radios without bus arbitration hacks. The 20 MHz clock and 1 MIPS/MHz throughput deliver responsive real-time behavior for robotics and automation hobby projects.
Recommended
Industrial Sensor Nodes and Field Instrumentation
With a -40C to +105C operating range, the ATMEGA328PB-ANR survives enclosure-mounted deployments near motors, drives, and power supplies where standard +85C-graded -AU variants would be marginal. The 10-bit ADC with internal reference digitizes bridge and ratiometric sensors, while dual TWI and dual SPI interfaces let one MCU aggregate multiple sensor ICs on separate isolated buses. picoPower sleep modes cut average draw in duty-cycled monitoring nodes, and the 1.8 V low end supports 3.6 V LiSOCl2 primary cells common in metering. The 32-TQFP 7x7 mm footprint fits compact DIN-rail and PCB-mounted transmitter form factors.
Recommended
Battery-Powered IoT End Nodes
For multi-year battery designs, the ATMEGA328PB-ANR combines picoPower sleep modes, a 1.8-5.5 V supply range, and flexible clocking (internal 8 MHz RC or external crystals) so firmware can trade speed against current aggressively. A node can sleep in power-down between sensor reads on the dual TWI buses, wake on pin-change or watchdog interrupts, and push data over a USART-connected radio. The 4 KB SRAM hosts lightweight MQTT-style stacks or LoRaWAN-class MAC layers. Running from a single Li-ion cell eliminates an LDO dropout penalty at 3.3 V, and the -ANR temperature grade covers outdoor enclosures exposed to solar heating.
Recommended
HVAC and Appliance Control Boards
Appliance and HVAC controllers benefit from the ATMEGA328PB-ANR's multiple 16-bit timer/counters with complementary PWM outputs, which drive blower motors, valve actuators, and heater elements with hardware-generated waveforms independent of CPU load. The extended +105C rating tolerates control-box temperatures near heating elements, and the 10-bit ADC reads NTC thermistor ladders for multi-zone temperature sensing. Dual TWI interfaces separate a user-interface bus (display, keypad controller) from a sensor bus, improving robustness. Its Flash endures frequent field firmware updates via self-programming read-while-write support, and the 27 I/O lines handle relays, buttons, and indicators in one chip.
Recommended
Motor Control and PWM Power Conversion
The ATMEGA328PB-ANR provides multiple flexible 16-bit timer/counter modules with input capture, dead-time-capable PWM, and high-speed PWM modes suited to small BLDC fans, servo drivers, and LED dimming converters. Hardware capture inputs measure tachometer periods precisely for closed-loop fan speed control, while the analog comparator supports cycle-by-cycle current limiting in buck topologies. At 20 MHz the core executes FOC-lite or trapezoidal commutation loops for small motors with margin. The +105C grade suits motor-adjacent mounting, and dual SPI lets a resolver or encoder interface coexist with a debugging/telemetry port on the third USART.
Recommended
Security and Access-Control Devices
Access-control keypads, RFID readers, and small alarm panels use the ATMEGA328PB-ANR's 27 I/O lines to scan matrix keypads, drive indicators, and toggle door-strike relays from one MCU. The dual TWI buses isolate a secure-element or RTC bus from the peripheral bus, and EEPROM retains user codes and event logs through power loss. Watchdog timer and brown-out detection (per datasheet BOD options) deliver the self-recovery behavior security products require. Operating down to 1.8 V allows battery-backup operation during mains outage, and the -40C rating suits unheated outdoor reader enclosures.
Recommended
Recommended Products Summary
Engineering reference data for ATMEGA328PB-ANR — comparison, design guidance, and compliance information.
Selection Guide
Comparison with Alternatives
| Parameter | This Product | ATMEGA328PB-AN | ATMEGA328PB-AU | ATMEGA328P-AN | ATMEGA168PB-AUR |
|---|---|---|---|---|---|
| Package | 32-TQFP (7x7 mm) | 32-TQFP (7x7 mm) - same | 32-TQFP (7x7 mm) - same | 32-TQFP (7x7 mm) - same | 32-TQFP (7x7 mm) - same |
| Brand | Microchip Technology | Microchip Technology | Microchip Technology | Microchip Technology | Microchip Technology |
| Flash Memory | 32 KB | 32 KB | 32 KB | 32 KB | 16 KB |
| SRAM | 4 KB | 4 KB | 4 KB | 2 KB | 1 KB |
| SPI / TWI / USART Count | 2 / 2 / 3 | 2 / 2 / 3 | 2 / 2 / 3 | 1 / 1 / 2 | 2 / 2 / 2 |
| General Purpose I/O | 27 | 27 | 27 | 22 | 27 |
| Packaging | Tape & Reel | Cut Tape / Tray | Tray | Tape & Reel | Tape & Reel |
| Lifecycle Status | Active (recommended for new designs) | Active | Active | Active (not recommended for new designs) | Active |
Key Differentiators
- Richest peripheral set in the ATmega328 TQFP-32 family (vs ATMEGA328P-AN)
- Extended -40C to +105C industrial temperature rating (vs ATMEGA328PB-AU)
- Recommended successor with software backward compatibility (vs ATMEGA328P-AN)
Design Notes
Decouple both VCC pins (4, 6) and AVCC (pin 18) with 100 nF ceramic capacitors placed within 5 mm of each pin, plus one 4.7-10 uF bulk capacitor per supply rail. Tie AVCC to VCC through a low-pass LC filter when ADC accuracy matters, and keep the AREF node (pin 20) clean with a 100 nF cap to GND - never place a large capacitor directly on AREF when using the internal reference. Route the crystal (pins 7-8) with short traces and guard with ground pour per the Microchip AVR hardware design considerations app note.
When migrating from ATmega328P, remember the 328PB 'officially not a drop-in' status: PE0/PE1 (pins 1-2) and the added PE2/PE3 functions differ from 328P pin maps on some TQFP-32 footprints. Also update the toolchain device selection and signature bytes when burning bootloaders - Arduino cores need a 328PB-specific board definition, otherwise uploading fails at signature check. Do not exceed 20 MHz; overclocking voids the datasheet timing and flash reliability guarantees across the full -40C to +105C range.
Enable Brown-Out Detection (BOD) fuse at an appropriate threshold (e.g., 2.7 V for 5 V systems) so Flash writes are suppressed during supply sag - a corrupted EEPROM is the most common field failure in unattended MCU nodes. Estimate: at 5 V and 20 MHz, active current is in the ~10 mA class per datasheet typical curves; a duty-cycled sensor node sleeping at ~1 uA-class power-down current averages far less, letting a 2400 mAh Li-ion cell run for years with a 1% duty cycle.
Treat RESET (pin 29) with care: keep the trace short, add a 10 k pull-up, and expose a programming header with ISP signals (MOSI/MISO/SCK/RESET) on every production PCB. For long external interrupt or clock lines to INT0 or T0, add series termination (22-100 ohm) to control ringing. The dual TWI buses should each have their own pull-ups (4.7 k for 5 V, 2.2-4.7 k for 3.3 V) sized for bus capacitance rather than sharing one bus across isolated sensor groups.
Compliance Information
Distributor listings (DigiKey, LCSC) indicate RoHS-compliant lead-free finish; detailed REACH and halogen status should be confirmed via the Microchip product page for this ordering code.