ATMEGA328PB-AN - 8-bit AVR MCU 20MHz 32KB Flash TQFP-32 | Microchip
MPN: ATMEGA328PB-AN ✓ Active| Qty | Unit Price | Extended |
|---|---|---|
| 1 | $2.55 | $2.55 |
| 10 | $2.29 | $22.90 |
| 100 | $2.04 | $204.00 |
| 500 | $1.83 | $915.00 |
| 1,000 | $1.66 | $1,660.00 |
ATMEGA328PB-AN Overview
An 8-bit AVR microcontroller is a single-chip computer that integrates a RISC processor core, program Flash memory, data SRAM, EEPROM, and a rich set of peripherals on one die. Within the embedded systems hierarchy, it sits in the microcontroller class below 32-bit MCUs but above simple 4-bit controllers, making it a mainstay of cost-sensitive embedded control, education platforms, and Arduino-compatible designs.
Key features include 1 KB of EEPROM for non-volatile data storage, 27 general purpose I/O lines, and five flexible Timer/Counters with compare modes - a significant peripheral increase over the ATmega328P. The device also integrates two serial programmable USARTs and two two-wire (I2C) interfaces, enabling simultaneous multi-bus designs that previously required external bridges.
Technical depth comes from the AVR architecture: 32 general purpose working registers are directly connected to the ALU, allowing one-cycle execution of register-to-register operations. The picoPower technology portfolio provides multiple sleep modes with low wake-up times, supporting battery-powered designs. In-System Programmable Flash with Read-While-Write capability allows firmware updates through the SPI interface without removing the device from the board.
Typical applications include Arduino-compatible development boards, industrial sensor nodes, consumer appliance control, and battery-powered data loggers. The added second USART and second SPI/I2C bus make it particularly attractive for designs that previously needed glue logic to connect multiple peripherals.
When designing with this device, note that while software is backward compatible with the ATmega328P, the device signature differs, and bootloader or fuse tooling such as MiniCore should be configured for the 328PB.
This page synthesizes distributor pricing, drop-in alternatives, and practical design notes not found in the manufacturer datasheet, giving engineers a single verified reference for selection and sourcing as of 2026-09-17.
Drop-in alternatives for ATMEGA328PB-AN — 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-AN (same form factor and footprint) — differing in Operating Temperature, Package, EEPROM, RoHS Status, SRAM.
Quick Comparison Tool — Select alternative parts for side-by-side comparison:
ATMEGA328P-AU
✅ Drop-In ⚠️ 参数待验证✓ In Stock
$1.85 / Unit
View Datasheet →ATMEGA168PB-AUR
✅ Drop-In✓ In Stock
$1.58 / Unit
View Datasheet →ATMEGA168PA-ANR
✅ Drop-In✓ In Stock
$1.44 / Unit
View Datasheet →ATMEGA168P-20AU
✅ Drop-In✓ In Stock
$2.91 / Unit
View Datasheet →ATMEGA168A-AU
✅ Drop-In✓ In Stock
$1.42 / Unit
View Datasheet →ATMEGA328PB-AN Maximum Ratings & Electrical Characteristics
| Core Processor | AVR |
| Core Size | 8-bit |
| Speed | 20 MHz |
| Flash Memory | 32 KB (16K x 16) |
| EEPROM | 1 KB |
| SRAM | 2 KB |
| General Purpose I/O | 27 |
| Timers/Counters | 5 (flexible, with compare modes) |
| USART | 2 |
| Package | 32-TQFP (7x7 mm) |
| Mounting Type | Surface Mount |
| Packaging | Tray |
| Architecture | AVR enhanced RISC, picoPower |
| Working Registers | 32 |
| Interrupt Sources | Internal and external interrupts |
| Programming Interface | ISP / ICSP (SPI) |
ATMEGA328PB-AN Pin Configuration
| Pin 1 | PD3 — Port D, bit 3 (GPIO / interrupt source) |
| Pin 2 | PD4 — Port D, bit 4 (GPIO) |
| Pin 3 | GND — Ground |
| Pin 4 | VCC — Digital supply voltage |
| Pin 5 | GND — Ground |
| Pin 6 | VCC — Digital supply voltage |
| Pin 7 | PB6/XTAL1 — Port B bit 6 / crystal oscillator input or TOSC1 |
| Pin 8 | PB7/XTAL2 — Port B bit 7 / crystal oscillator output or TOSC2 |
| Pin 9 | PD5 — Port D, bit 5 (GPIO) |
| Pin 10 | PD6 — Port D, bit 6 (GPIO) |
| Pin 11 | PD7 — Port D, bit 7 (GPIO) |
| Pin 12 | PB0 — Port B, bit 0 (GPIO / additional SPI function on PB variant) |
| Pin 13 | PB1 — Port B, bit 1 (GPIO) |
| Pin 14 | PB2 — Port B, bit 2 (GPIO / SS) |
| Pin 15 | PB3 — Port B, bit 3 (GPIO / MOSI) |
| Pin 16 | PB4 — Port B, bit 4 (GPIO / MISO) |
| Pin 17 | PB5 — Port B, bit 5 (GPIO / SCK) |
| Pin 18 | AVCC — Analog supply voltage for ADC |
| Pin 19 | PE1 — Port E, bit 1 (additional GPIO on PB variant) |
| Pin 20 | PE2 — Port E, bit 2 (additional GPIO on PB variant) |
| Pin 21 | GND — Ground |
| Pin 22 | PE0 — Port E, bit 0 (additional GPIO on PB variant) |
| 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 / two-wire data |
| Pin 28 | PC5/ADC5/SCL — Port C, bit 5 / ADC channel 5 / two-wire clock |
| Pin 29 | PC6/RESET — Port C, bit 6 / active-low reset |
| Pin 30 | PD0/RXD — Port D, bit 0 / USART receive |
| Pin 31 | PD1/TXD — Port D, bit 1 / USART transmit |
| Pin 32 | PD2 — Port D, bit 2 (GPIO / interrupt source) |
Typical Applications
ATMEGA328PB-AN is suitable for 6 applications: Arduino-Compatible Development Boards, Industrial Sensor Nodes, Battery-Powered Data Loggers, Consumer Appliance Control, Motor and Actuator Control Modules, Legacy ATmega328P Board Upgrades.
Arduino-Compatible Development Boards
The ATMEGA328PB-AN is the natural successor MCU for Arduino UNO R3 and Nano-class boards. Because the AVR core and register model are software backward compatible with the ATmega328P, existing sketches run unchanged, while the 27 GPIO lines (versus 23) and the second USART and second I2C bus let board designers expose additional shields and sensor buses without glue logic. Toolchains such as MiniCore provide bootloader and fuse support through the Arduino IDE, and the MPLAB SNAP or an Arduino-as-ISP handles in-circuit serial programming. The 20 MHz clock delivers roughly 20 MIPS, sufficient for typical hobby and education workloads, and the picoPower sleep modes keep idle boards battery-friendly.
Recommended
Industrial Sensor Nodes
In industrial sensing, the ATMEGA328PB-AN fits nodes that must talk to multiple buses: its two USARTs allow a Modbus RTU link and a debug console simultaneously, while the dual two-wire interfaces connect separate sensor clusters without an I2C multiplexer. The 32 KB Flash accommodates protocol stacks plus calibration routines, and the 1 KB EEPROM stores configuration and wear-leveled calibration constants through power cycles. Five timers support PWM actuator outputs and precise sampling intervals. Designs should budget GPIO carefully, as the 27 lines include crystal and reset pins; the added Port E pins of the PB variant often free exactly the pins a design would otherwise sacrifice.
Recommended
Battery-Powered Data Loggers
The picoPower AVR architecture makes the ATMEGA328PB-AN effective in battery loggers that sample periodically and sleep between events. Multiple sleep modes with short wake-up times allow the MCU to spend most of its life stopped, waking on watchdog or pin-change interrupts to read an ADC channel, timestamp with a timer, and buffer results into the 2 KB SRAM or commit them to the 1 KB EEPROM. The 32 KB Flash holds logging firmware plus compression and communication code. Engineers should size sleep-mode current and EEPROM write endurance into the power budget, as frequent EEPROM logging at short intervals dominates battery life in multi-year deployments.
Recommended
Consumer Appliance Control
Appliance control panels benefit from the ATMEGA328PB-AN's combination of low cost, 20 MHz performance, and peripheral density. Five timers generate PWM for motor or heater control, debounce multiple button inputs, and drive buzzer tones, while the dual USARTs let one port service a service/production programming header and another talk to a display or radio module. The 32 KB Flash leaves headroom for safety routines and firmware updates delivered in-system via the SPI ICSP interface, so appliances can be reprogrammed on the assembly line or in the field without socketing the device. Tray packaging suits pick-and-place high-volume SMT assembly.
Recommended
Motor and Actuator Control Modules
With five flexible Timer/Counters offering compare modes, the ATMEGA328PB-AN can generate several independent PWM channels for servo, brushed-DC, or stepper control while timers still handle tachometer capture and system tick. The two USARTs accept command streams from a host and report diagnostics on a second link, and the 27 GPIO lines drive gate or driver-enable signals directly. The single-cycle ALU closes control loops quickly enough for many embedded motion tasks at 20 MHz, delivering roughly 1 MIPS per MHz. Designers should verify thermal budget on external drivers and use the input-capture timer features for accurate encoder feedback.
Recommended
Legacy ATmega328P Board Upgrades
Engineers maintaining ATmega328P-based products use the ATMEGA328PB-AN as the recommended forward path, since Microchip positions the 328PB as the successor to the 328P in new designs. Existing firmware compiles unchanged because code and fuses remain compatible, but two cautions apply: the device signature differs, so bootloaders and programming tools must recognize the PB part, and pins 3 and 6 connection behavior must be reviewed because the PB routes extra peripheral functions there. Boards that reserve those pins can adopt the PB in the same 32-TQFP footprint, gaining a second USART, second SPI/I2C capability, and five timers with no PCB respin.
Recommended
Recommended Products Summary
Engineering reference data for ATMEGA328PB-AN — comparison, design guidance, and compliance information.
Selection Guide
Comparison with Alternatives
| Parameter | This Product | ATMEGA328P-AU | ATMEGA168PB-AUR | ATMEGA168PA-ANR | ATMEGA168A-AU |
|---|---|---|---|---|---|
| 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 | 16 KB | 16 KB | 16 KB |
| SRAM | 2 KB | 2 KB | 1 KB | 1 KB | 1 KB |
| Max Clock Speed | 20 MHz | 20 MHz | 20 MHz | 20 MHz | 20 MHz |
| Timers/Counters | 5 | 3 | 4 | 3 | 3 |
| USART | 2 | 1 | 2 | 1 | 1 |
| General Purpose I/O | 27 | 23 | 26 | 23 | 23 |
| Software Compatibility | Reference (AVR core) | Fully compatible code, different device signature | AVR compatible, reduced memory limits | AVR compatible, reduced memory limits | AVR compatible, reduced memory limits |
Key Differentiators
- Double the serial interfaces in the same footprint (vs ATMEGA328P-AU)
- More timers and GPIO than same-footprint predecessors (vs ATMEGA168PB-AUR)
- Designated successor to the Arduino-class 328P (vs ATMEGA168PA-ANR)
Design Notes
The ATmega328PB is software backward compatible with the ATmega328P but is officially not a drop-in replacement: the device signature differs, and the second I2C/SPI buses and Port E routing mean pins 3 and 6 of the legacy connection set require review. Community reports confirm that leaving pins 3 and 6 disconnected on new board revisions allows near-complete drop-in use. Always update bootloader and fuse tooling (for example, MiniCore) to a 328PB-aware configuration before first flash.
Decouple both VCC pins (pins 4 and 6) and AVCC (pin 18) individually with 100 nF ceramic capacitors placed within a few millimeters of each pin, plus one bulk 10 uF capacitor near the supply entry. Tie all GND pins (3, 5, 21) to a solid ground plane. Route the crystal on PB6/PB7 with short traces and 22 pF load capacitors close to the pins; keep the crystal ground return local to reduce jitter and improve oscillator start-up reliability at 20 MHz.
Estimated: picoPower sleep modes are the key to battery designs - place the MCU into power-down between events and wake on watchdog or pin-change interrupts rather than polling. The exact sleep-mode current figures should be taken from the electrical characteristics section of the Microchip ATmega328PB datasheet (document 40001906) rather than from this page, since the search data did not include current tables. Budget EEPROM write energy separately for data-logging products.
Keep the ICSP programming header (two I/O pins plus reset per the MPLAB SNAP 8-pin SIL interface) accessible even in production boards; in-system programmable Flash with Read-While-Write capability means firmware can be updated without desoldering. Reserve the second USART and second two-wire bus routing on new layouts even if unused initially - this is the primary benefit of migrating from the 328P to the 328PB and costs nothing if routed to a spare header.
Compliance Information
Distributor listings indicate a standard RoHS-era Microchip production part, but no explicit compliance certificate appeared in the retrieved data; verify on the official Microchip product page.