Phone

    00852-6915 1330

ATmega328P Microcontroller: Datasheet, Pinout, Circuit [FAQ]

  • Contents

Description

ATMEGA328P is a Microcontroller. This blog covers ATMEGA328P Microcontroller pinout, datasheet, equivalent, features and other information on how to use and where to use this device.

atmgea328p

ATMEGA328P

Catalog

Description

ATMEGA328P Pinout

ATMEGA328P Applications

ATMEGA328P Features

ATMEGA328P Advantage

ATMEGA328P Parameters

ATMEGA328P Arduino

ATMEGA328P Alternatives

ATMEGA328P Equivalents

Where to use ATMEGA328P

How to use ATMEGA328P

How to Safely Long Run Atmega328P

ATMEGA328P Manufacturer

Ordering & Quantity


ATMEGA328P Pinout

atmega328p pinout

ATMEGA328P is a 28-pin chip as shown in pin diagram above. Many pins of the chip here have more than one function. We will describe functions of each pin in below table.

Pin No.

Pin name

Description

Secondary Function

1

PC6 (RESET)

Pin6 of  PORTC

Pin by default is used as RESET pin. PC6 can only be used as I/O pin when RSTDISBL Fuse is programmed.

2

PD0 (RXD)

Pin0  of  PORTD

RXD (Data Input Pin for USART)

USART Serial Communication Interface

[Can be used for programming]

3

PD1 (TXD)

Pin1 of  PORTD

TXD (Data Output Pin for USART)

USART Serial Communication Interface

[Can be used for programming]

 

INT2( External Interrupt 2 Input)

4

PD2 (INT0)

Pin2  of  PORTD

External Interrupt source 0

 

5

PD3 (INT1/OC2B)

Pin3  of  PORTD

External Interrupt source1

 

OC2B(PWM - Timer/Counter2 Output Compare Match B Output)

6

PD4 (XCK/T0)

Pin4  of  PORTD

T0( Timer0 External Counter Input)

XCK ( USART External Clock I/O)

7

VCC

 

Connected to positive voltage

8

GND

 

Connected to ground

9

PB6 (XTAL1/TOSC1)

Pin6  of  PORTB

XTAL1 (Chip Clock Oscillator pin 1 or External clock input)

TOSC1 (Timer Oscillator pin 1)

10

PB7 (XTAL2/TOSC2)

Pin7  of  PORTB

XTAL2 (Chip Clock Oscillator pin 2)

TOSC2 (Timer Oscillator pin 2)

11

PD5

(T1/OC0B)

Pin5 of  PORTD

T1(Timer1 External Counter Input)

 

OC0B(PWM - Timer/Counter0 Output Compare Match B Output)

12

PD6 (AIN0/OC0A)

Pin6  of  PORTD

AIN0(Analog Comparator Positive I/P)

 

OC0A(PWM - Timer/Counter0 Output Compare Match A Output)

13

PD7 (AIN1)

Pin7  of  PORTD

AIN1(Analog Comparator Negative I/P)

 

14

PB0 (ICP1/CLKO)

Pin0  of  PORTB

ICP1(Timer/Counter1 Input Capture Pin)

 

CLKO (Divided System Clock. The divided system clock can be output on the PB0 pin)

15

PB1 (OC1A)

Pin1  of  PORTB

OC1A (Timer/Counter1 Output Compare Match A Output)

16

PB2 (SS/OC1B)

Pin2  of  PORTB

SS (SPI Slave Select Input).  This pin is low when controller acts as slave.

[Serial Peripheral Interface (SPI) for programming]

 

OC1B (Timer/Counter1 Output Compare Match B Output)

17

PB3 (MOSI/OC2A)

Pin3  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]

OC2 (Timer/Counter2 Output Compare Match Output)

18

PB4 (MISO)

Pin4  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]

19

PB5 (SCK)

Pin5  of  PORTB

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]

20

AVCC

 

Power for Internal ADC Converter

21

AREF

 

Analog Reference Pin for ADC

22

GND

 

GROUND

23

PC0 (ADC0)

Pin0  of  PORTC

 ADC0 (ADC Input Channel 0)

24

PC1 (ADC1)

Pin1  of  PORTC

ADC1 (ADC Input Channel 1)

25

PC2 (ADC2)

Pin2  of  PORTC

 ADC2 (ADC Input Channel 2)

26

PC3 (ADC3)

Pin3  of  PORTC

 ADC3 (ADC Input Channel 3)

27

PC4 (ADC4/SDA)

Pin4  of  PORTC

ADC4 (ADC Input Channel 4)

SDA (Two-wire Serial Bus Data Input/output Line)

28

PC5 (ADC5/SCL)

Pin5  of  PORTC

ADC5 (ADC Input Channel 5)

SCL (Two-wire Serial Bus Clock Line)


ATMEGA328P Applications

There are thousands of applications for Atmega328P also more to come in near future depends on how creative one can think. Every day we see a new application built using the this chip by electronic students, engineers, hobbyists, tinkerers. Some of the applications for the chip are as follow.

  • Industrial machinery controlling systems
  • Solar powered machinery and applications
  • IOT based applications
  • Power supply and charger based applications
  • Weather systems
  • Wireless communication applications
  • Security based applications
  • Medical & health related projects & systems
  • Automobile related applications

ATMEGA328P Features

  • High performance design
  • Low power consumption
  • Total number of Analog Input pins are 6
  • Contains 32 kilobytes of flash memory
  • Contains 2 kilobytes of SRAM
  • Contains 1 kilobytes of EEPROM
  • 16 megahertz clock speed
  • Minimum & maximum temperature -40 degree centigrade to 105 degree centigrade
  • Total number of Digital I/O pins are 14
  • Advance RISC
  • Lock program functionality for programming code security
  • Contains total three timers two 8-bit and one 16 bit
  • Total number of I/O pins are 23
  • Total number of PWM channels are 6
  • Minimum and maximum operating voltage from 1.8V DC to 5.5V DC

ATMEGA328P Advantage

atmega328p

ATMEG328P

The high-performance Microchip picoPower 8-bit AVR RISC-based microcontroller combines 32KB ISP flash memory with read-while-write capabilities, 1024B EEPROM, 2KB SRAM, 23 general purpose I/O lines, 32 general purpose working registers, three flexible timer/counters with compare modes, internal and external interrupts, serial programmable USART, a byte-oriented 2-wire serial interface, SPI serial port, a 6-channel 10-bit A/D converter (8-channels in TQFP and QFN/MLF packages), programmable watchdog timer with internal oscillator, and five software selectable power saving modes. The device operates between 1.8-5.5 volts.

By executing powerful instructions in a single clock cycle, the device achieves throughputs approaching 1 MIPS per MHz, balancing power consumption and processing speed.


ATMEGA328P Parameters

Additional Feature

IT ALSO OPERATES 2.7V AT 10 MHZ

Bit Size

8

Clock Frequency-Max

20 MHz

DAC Channels

NO

DMA Channels

NO

Has ADC

YES

HTS Code

8542.31.00.01

JESD-30 Code

R-PDIP-T28

Length

34.167 mm

Manufacturer

Microchip Technology Inc

Manufacturer Part Number

ATMEGA328P-20PU

Number of I/O Lines

23

Number of Terminals

28

Operating Temperature-Max

85 °C

Operating Temperature-Min

-40 °C

Package Body Material

PLASTIC/EPOXY

Package Code

DIP

Package Shape

RECTANGULAR

Package Style

IN-LINE

Part Life Cycle Code

Obsolete

PWM Channels

YES

Qualification Status

Not Qualified

Reach Compliance Code

Unknown

Risk Rank

5.68

ROM Programmability

FLASH

Seated Height-Max

4.5724 mm

Speed

20 MHz

Supply Voltage-Max

5.5 V

Supply Voltage-Min

4.5 V

Supply Voltage-Nom

5 V

Surface Mount

NO

Technology

CMOS

Temperature Grade

INDUSTRIAL

Terminal Form

THROUGH-HOLE

Terminal Pitch

2.54 mm

Terminal Position

DUAL

uPs/uCs/Peripheral ICs Type

MICROCONTROLLER, RISC

Width

7.62 mm


ATMEGA328P Arduino

atmega328p

ATMEG328P Model

ATMEGA328 is used similar to any other controller. All there to do is programming. Controller simply executes the program provided by us at any instant. Without programming controller simply stays put without doing anything.

Since ATmega328P is used in Arduino Uno and Arduino nano boards, you can directly replace the arduino board with ATmega328 chip. For that first you need to install the Arduino bootloader into the chip (Or you can also buy a chip with bootloader – ATMega328P-PU). This IC with bootloader can be placed on Arduino Uno board and burn the program into it. Once Arduino program is burnt into the IC, it can be removed and used in place of Arduino board, along with a Crystal oscillator and other components as required for the project.


ATMEGA328P Alternatives

ATMEGA16, ATMEGA32, ATMEGA8535


ATMEGA328P Equivalents

ATMEGA8


Where to use ATMEGA328P

Although we have many controllers ATMEGA328P is most popular of all because of its features and cost. ARDUINO boards are also developed on this controller because of its features.

  • With program memory of 32 Kbytes ATMEGA328P applications are many.
  • With various POWER SAVING modes it can work on MOBILE EMBEDDED SYSTEMS.
  • With Watchdog timer to reset under error it can be used on systems with minimal human interference.
  • With advanced RISC architecture, the controller executes programs quickly.
  • Also with in chip temperature sensor the controller can be used at extreme temperatures.

These all features add together promoting ATMEGA328P further.


How to use ATMEGA328P

ATMEGA328 is used similar to any other controller. All there to do is programming. Controller simply executes the program provided by us at any instant. Without programming controller simply stays put without doing anything.

As said, first we need to program the controller and that is done by writing the appropriate program file in the ATMEGA328P FLASH memory. After dumping this program code, the controller executes this code and provides appropriate response.

Entire process of using an ATMEGA328P goes like this:

  • List the functions to be executed by controller.
  • 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 ATMEL STUDIO is given below.

(Usually Atmel Studio 6.0 for Windows7 [ http://atmel-studio.software.informer.com/6.0/ ],

Atmel Studio 7 for Windows10 [ https://www.microchip.com/avr-support/atmel-studio-7 ])

  • ATMEGA328P programming can also be done in ARDUINO IDE.
  • After writing the program, compile it to eliminate errors.
  • Make the IDE generate HEX file for the written program after compiling.
  • This HEX file contains the machine code which should be written in controller flash memory.
  • Choose the programming device (usually SPI programmer made for AVR controllers) which establishes communication between PC and ATMEGA328P. You can also program ATMEGA328P using ARDUINO UNO board.
  • Run the programmer software and choose the appropriate hex file.
  • Burn the HEX file of written program in ATMEGA328P flash memory using this program.
  • Disconnect the programmer, connect the appropriate peripherals for the controller and get the system started.

How to Safely Long Run Atmega328P

To get long term performance or if you want to run the Atmega328P for years in your electronic gadget or project it should be known that Chips or ICs are very sensitive and care must be taken when using them. The supply voltage should not exceed from 5.5V. Always check the voltage source output before connecting to the IC. When experimenting on the breadboard or soldering in a circuit it is highly recommended to check all the pins for short circuit before giving power to the IC, it is better to use an IC socket for the IC, but also check the IC socket pins for short circuit before placing the IC in it. IC socket also saves the IC from the heat generated from the soldering iron while soldering. Do not store or operate the chip below -40 centigrade and above 105 centigrade.


ATMEGA328P Manufacturer

Microchip Technology Inc. is a leading provider of microcontroller and analog semiconductors, providing low-risk product development, lower total system cost and faster time to market for thousands of diverse customer applications worldwide. Headquartered in Chandler, Arizona, Microchip offers outstanding technical support along with dependable delivery and quality.


Component Datasheet

ATMEGA328P Datasheet


FAQ

  • What is meant by ATMEGA328P?

ATMEGA328P is high performance, low power controller from Microchip. ATMEGA328P is an 8-bit microcontroller based on AVR RISC architecture. It is the most popular of all AVR controllers as it is used in ARDUINO boards.

  • What is the difference between ATMEGA328 and ATMEGA328P?

ATMEGA328P and ATMEGA328 are the same every sense architecturally.
ATMEGA328P just consumes lower power than ATMEGA328, which means that the 328P is manufactured in a finer process than the 328.

  • Why ATMEGA328 is used in Arduino?

The ATMEGA328/P is a low-power CMOS 8-bit microcontroller based on the AVR® enhanced RISC (reduced instruction set computer) architecture. In Order to maximize performance and parallelism, the AVR uses Harvard architecture – with separate memories and buses for program and data.

  • How do you code ATMEGA328P?

  • Is ATMEGA328P a microcontroller?

The ATMEGA328 is a single-chip microcontroller created by Atmel in the megaAVR family (later Microchip Technology acquired Atmel in 2016). It has a modified Harvard architecture 8-bit RISC processor core.

  • Can the ATMEGA328P microcontroller be used without the Arduino board?

Yes. You can use ATMega328P without arduino board. ... You can use arduino board with the IC. Program the IC and then take it out and use it in your circuit. You will have to use 16MHZ Oscillator with capacitors.

  • How do I program Atmega328P without bootloader?

Programming AVR With Arduino As ISP Without Bootloader and External Crystal
Step 1: Things You Need. ...
Step 2: Upload ArduinoISP Code on Arduino Board. ...
Step 3: Open Command Prompt (in Windows OS) ...
Step 4: Required Downloads.. ...
Step 5: Installation of WinAVR (only Help for Windows OS Is Covered for Now)

Kynix

Kynix was founded in 2008, specializing in the electronic components distribution business. We adhere to honesty and ethics as our business philosophy and have gradually established an excellent reputation and credibility in our international business. With the accurate quotation, excellent credit, reasonable price, reliable quality, fast delivery, and authentic service, we have won the praise of the majority of customers.

Join our mailing list!

Be the first to know about new products, special offers, and more.

Leave a Reply

We'd love to hear from you! Feel free to share your thoughts and comments below. Rest assured, your email address will remain private.

Name *
Email *
Captcha *
Rating:

Kynix

  • How to purchase

  • Order
  • Search & Inquiry
  • Shipping & Tracking
  • Payment Methods
  • Contact Us

  • Tel: 00852-6915 1330
  • Email: info@kynix.com
  • Follow Us

authentication

Kynix

© 2008-2026 kynix.com all rights reserved.