Hello everyone! I hope you all will be absolutely fine and having fun. Today, I am going to share the most important and the most common topic i.e. Introduction to ATmega328. ATmega-328 is basically an Advanced Virtual RISC (AVR) micro-controller. It supports the data up to eight (8) bits. ATmega-328 has 32KB internal builtin memory. This micro-controller has a lot of other characteristics. You should also have a look at Introduction to PIC16F877a (it’s a PIC Microcontroller) and then compare functions of these two Microcontrollers.
ATmega 328 has 1KB Electrically Erasable Programmable Read Only Memory (EEPROM). This property shows if the electric supply supplied to the micro-controller is removed, even then it can store the data and can provide results after providing it with the electric supply. Moreover, ATmega-328 has 2KB Static Random Access Memory (SRAM). Other characteristics will be explained later. ATmega 328 has several different features which make it the most popular device in today’s market. These features consist of advanced RISC architecture, good performance, low power consumption, real timer counter having separate oscillator, 6 PWM pins, programmable Serial USART, programming lock for software security, throughput up to 20 MIPS etc. ATmega-328 is mostly used in Arduino. The further details about ATmega 328 will be given later in this section.
- Here’s the link to download Atmega328 datasheet, although after reading this article you won’t need it. 🙂
- Moreover, I have also given the link of a reliable online source from where you can buy it easily.
Introduction to ATmega328
- ATmega328 is an 8-bit and 28 Pins AVR Microcontroller, manufactured by Microchip, follows RISC Architecure and has a flash type program memory of 32KB.
- It has an EEPROM memory of 1KB and its SRAM memory is of 2KB.
- It has 8 Pin for ADC operations, which all combines to form PortA ( PA0 – PA7 ).
- It also has 3 builtin Timers, two of them are 8 Bit timers while the third one is 16-Bit Timer.
- You must have heard of Arduino UNO, UNO is based on atmega328 Microcontroller. It’s UNO’s heart. 🙂
- It operates ranging from 3.3V to 5.5V but normally we use 5V as a standard.
- Its excellent features include the cost efficiency, low power dissipation, programming lock for security purposes, real timer counter with separate oscillator.
- It’s normally used in Embedded Systems applications. You should have a look at these Real Life Examples of Embedded Systems, we can design all of them using this Microcontroller.
- The following table shows the complete features of ATmega328:
|No. of Pins||28|
|CPU||RISC 8-Bit AVR|
|Operating Voltage||1.8 to 5.5 V|
|Program Memory Type||Flash|
|Number of ADC Channels||8|
|Packages (4)||8-pin PDIP|
|Oscillator||up to 20 MHz|
|Timer (3)||8-Bit x 2 & 16-Bit x 1|
|Enhanced Power on Reset||Yes|
|Power Up Timer||Yes|
|Brown out detect (BOD)||Yes|
|USI (Universal Serial Interface)||Yes|
|Minimum Operating Temperature||-40 C to +85 C|
1. ATmega328 Pins
- ATmega-328 is an AVR Microcontroller having twenty eight (28) pins in total.
- All of the pins in chronological order, are listed in the table shown in the figure given below.
2. ATmega328 Pinout
- Through pinout diagram we can understand the configurations of the pins of any electronic device, so you are working on any Engineering Project then you must first read the components’ pinout.
- ATmega 328 pinout diagram is shown in the figure given below.
3. ATmega328 Pins Description
- Functions associated with the pins must be known in order to use the device appropriately.
- ATmega-328 pins are divided into different ports which are given in detail below.
VCC is a digital voltage supply.
AVCC is a supply voltage pin for analog to digital converter.
GND denotes Ground and it has a 0V.
Port A consists of the pins from PA0 to PA7. These pins serve as analog input to analog to digital converters. If analog to digital converter is not used, port A acts as an eight (8) bit bidirectional input/output port.
Port B consists of the pins from PB0 to PB7. This port is an 8 bit bidirectional port having an internal pull-up resistor.
Port C consists of the pins from PC0 to PC7. The output buffers of port C has symmetrical drive characteristics with source capability as well high sink.
Port D consists of the pins from PD0 to PD7. It is also an 8 bit input/output port having an internal pull-up resistor.
- All of the AVR ports are shown in the figure given below.
AREF is an analog reference pin for analog to digital converter.
- So this was the brief of all the pins in ATmega 328 AVR micro-controller.
4. ATmega328 Architecture
- An architecture of a device presents each information about the particular device.
- ATmega-328 architecture is shown in the figure given below.
5. ATmega328 Memory
- ATmega 328 has three types of memories e.g. EEPROM, SRAM etc.
- The capacity of each memory is explained in detail below.
Flash Memory has 32KB capacity. It has an address of 15 bits. It is a Programmable Read Only Memory (ROM). It is non volatile memory.
SRAM stands for Static Random Access Memory. It is a volatile memory i.e. data will be removed after removing the power supply.
EEPROM stands for Electrically Erasable Programmable Read Only Memory. It has a long term data.
- AVR memory spaces are shown in the figure given below.
6. ATmega328 Registers
- ATmega-328 has thirty two (32) General Purpose (GP) registers.
- These all of the registers are the part of Static Random Access Memory (SRAM).
- All the registers are given in the figure shown below.
7. ATmega328 Packages
- The different versions of the same device are denoted by the different packages of that device.
- Each package has different dimensions, in order to differentiate easily.
- ATmega 328 packages are given in the table shown in the figure given below.
8. ATmega328 Block Diagram
- Block diagram shows the internal circuitry and the flow of the program of any device.
- ATmega 328 block diagram is shown in the figure given below.
9. ATmega328 Features
- To perform any task we can select a device on the basis of its features. i.e whether its features match to obtain the desired results or not.
- Some of the main features of an AVR Microcontroller ATmega328 are shown in the table given in the figure below.
10. ATmega328 and Arduino
- ATmega-328 is the most micro-controller that is used while designing.
- ATmega 328 is the most important part of Arduino.
- The program is uploaded on the AVR micro-controller attached on Arduino.
- AVR attached on Arduino is shown in the figure given below.
11. ATmega328 and Arduino Pins
- ATmega328 pins are connected to the corresponding pins of Arduino.
- Their connectivity with each other is shown in the pinout diagram shown in the figure given below.
- The encircled section analog pins consists of the Arduino pins which are connected to the corresponding AVR micro-controller ATmega-328 pins.
- I have written both of the pins in front of each other, it will help to understand easily.
- If you want to work on this Arduino board then you must try these Arduino Projects for Beginners, they will help to get your hands on Arduino.
- A complete package including ATmega 328 and Arduino can be used in several different real life applications.
- It can be used in Embedded Systems Projects.
- It can also be used in robotics.
- Quad-copter and even small aero-plane can also be designed through it.
- Power monitoring and management systems can also be prepared using this device.
- i have designed this Home Security System using Arduino, you should have a look at it.
13. How to start working on Atmega328
- If you want to start working on this Microcontroller then I would suggest you to do it using Arduino.
- The benefit of using Arduino is that you get to use all of its built-in libraries, which will make the work a lot easier.
- After designing your project on Arduino, then design the basic circuit of Atmega-328 which is quite simply and I have discussed above.
- Now you must be careful while using its Pins, Atmega328 and Arduino Pins are discussed above.
- Another thing to mention here is that before working on hardware, you should first design its Proteus Simulation.
- Download Arduino Library for Proteus and then design your project on it.
- Once you are confirmed that everything’s correct then design its circuitry on Wero Board or PCB (Printed Circuit Board) and you have your project ready. 🙂
The tutorial Introduction to ATmega328 has the presented the detailed discussion on the basic use of ATmega 328. I have completely provided the entire necessary details about the use of an AVR micro-controller. If you have any problem, you can ask us in comments anytime. Our team is always here to help you guys. I will share other amazing topics with all of you in my upcoming tutorials. So, till then take care 🙂