Atmega328 IC is the brain of the Arduino board. Arduino board is popular for use in projects but is not suitable for industrial use. Instead, we can use Standalone Atmega328 IC which can be programmed with Arduino IDE without using the Arduino board. In this project, we will be replacing the Arduino board with Atmega328 IC and other components. First, we will have to burn the Arduino Bootloader and then program it using FTDI or Arduino board.
- Atmega328 IC
- 16 MHz Crystal
- 22pF ceramic capacitors (2)
- 10uF capacitor(2)
- 10 K resistor
- 1k resistor
- Jumper wires
Pin Diagram of Atmega328
Circuit and Components Description:
1: Power supply part:
We are using LM7805 to get 5V output as the Atmega328 IC runs of 5V power supply. This is to keep the voltage regulated, however, if you have a 5V supply, leave this step. A 10uF capacitor is used at input and output of LM7805 to bypass any AC component to ground. The 5V output will be shown by the LED used.
2: Microcontroller part:
The Atmega328 is the main component on our breadboard. Connect a 16MHz external crystal between pin 9 and pin 10 of the Atmega328. Connect a pushbutton between pin 1 and GND so you can reset the microcontroller. Connect a LED with pin 13.
Making your Own Arduino Running on Breadboard:
1: Building the Arduino Circuit on Breadboard:
Connect the power supply part and testis using external power supply to LM7805.
Next connect the microcontroller components. Make sure to test the connections carefully.
Now, connect the microcontroller part and power supply using jumpers. This is our Arduino on the breadboard.
Now move on to the next part of the project.
2: Burning the Bootloader into Atmega328 IC:
A bootloader is an executable code which is stored in the microcontroller’s memory. It will allow the IC to accept code form the PC and store it in the microcontroller’s memory. Bootloader also reduces complexity and allows for easier programming of the microcontroller. In other words, you can program it just by using a USB cable. The Atmega328 does not have a bootloader so first, we will upload the bootloader. We can either use USBasp programmer or the Arduino UNO board to upload the bootloader. Arduino UNO is easier to use so we will use this method.
Upload the Arduino Bootloader in Atmega328 Chip:
First, open Arduino IDE. Go to File>Examples>ArduinoISP. After selecting ArduinoISP, you have to upload the code to the Arduino board. Select the com port and board from the tool menu and upload. After you have completed uploading, remove your Arduino board from the computer and connect it with Atmega328.
Next, reconnect the Arduino with the computer and open Arduino IDE. Go to Tools>Programmer as “Arduino as ISP”> Arduino as ISP.
Next go to Tools again and select “Burn Bootloader” below the programmer option. The bootloader is now uploaded, check for errors in uploading.
How to Program Arduino Bootloader uploaded Atmega 328 IC:
There are several ways to program the Arduino Atmega328. We will show you two methods.
1: Programming Atmega328 Chip using Arduino board:
Take an Arduino board without the ATmega328 and make connections with the breadboard Arduino. Next, connect the Arduino board to the computer and open Arduino IDE. Go to ‘Tools’ and choose Arduino Uno from the Board menu, select programmer as USBasp and select the com port of the board. Next, choose the blink program from Examples and select Upload. You will observe that the LED on the breadboard will start blinking.
2: Programming Arduino Atmega328 Chip using USB to Serial converter:
This method is useful if you do not have an Arduino board. First, make the necessary connections. Connect the
RXD pin of FTDI to Tx pin (pin3) of Atmega328,
the TXD pin of FTDI to Rx pin (pin 2),
GND to GND (pin 8) and 5V to Vcc (pin 7).
If there is a Reset pin (DTR pin) connect it with the reset pin (pin 1) of Atmega328.Next, connect the FTDI with a computer and go to Device Manager in the control panel and expand your Port section. Go to Tools>Ports and select the com port number.
Next, we will upload the blink program to the Breadboard Arduino. Go to File>Examples>Basics>Blink. Go to Tools and select Arduino UNO from board menu, select programmer as USBasp and choose com port of the board then select Upload.
In case your FTDI module has no Reset (DTR) pin, press the reset button on the breadboard and select upload. If it says ‘Compiling Sketch’ then keep it pressed and release as soon as it says ‘Uploading’.