Hello friends,hope you are fine and enjoying your lives. In today's tutorial, we will know How to Upload Bootloader in Atmega328 using Arduino UNO, which is quite simple and easy and a basic level tutorial. We all know that, Arduino UNO uses Atmega328 as a microcontroller and have you ever thought of using ATmega328 alone instead of using complete Arduino UNO. If you haven't thought yet then think now :) Yes we can use Atmega328 alone instead of using it as a whole with Arduino board. But that's not the topic of today's tutorial and I am gonna cover it soon that How can we use Atmega328 alone.
So now the questions arises that what we are gonna do with the rest of the Arduino board? As we have taken the Atmega328 out of it now there's no use of rest of the board. That's not quite right, we can buy another Atmega328 and can use it in this Arduino board. Now when you insert the new ATmega328 microcontroller in your Arduino UNO board then you will see that its not working? :( But no need to get sad because when it comes to technology then there's solution for everything. :)
Actually Arduino uses a bootloader installed on its Atmega328. It's kind of a driver for Atmega328 microcontroller, which makes it compatible with Arduino software. Normally in order to write code for Atmega328 we use AVR compiler but here because of this bootloader, we can quite easily upload the code into it simply from Arduino software. So, when you bought a new ATmega328 microcontroller then there's a need to upload bootloader in Atmega328. After installing the bootloader in Atmega328, now its ready to be plugged in Arduino UNO board and to be programmed. You should also have a look at How to get Hex File from Arduino. So, today we are gonna see How to upload Bootloader in ATmega328, let's start it.
How to Upload Bootloader in Atmega328 ???
- There are many ways to upload bootloader in ATmega328 and I am gonna share the easiest of them, which is using two Arduino UNO boards.
- So, now I suppose that you have two Arduino UNO boards and some jumper wires with you.
- If you haven't bought your Arduino UNO yet, then you can buy it from this reliable source:
- One of the Arduino board will be used as a programmer and it will upload the boatloader into second Arduino, while the second Arduino will be having the new ATmega328 microcontroller in which you wanna upload bootloader.
- So, first of all, what you need to do is to connect these two Arduino UNO boards as shown in the below figure:
- Now, in the above figure, Arduino B is acting as a programmer while Arduino A has the new ATmega328 Microcontroller in which we are gonna upload the bootloader.
- Now connect Arduino B with your computer via USB cable and both the Arduino boards will turn ON as we have connected their 5V and GND pins.
- Now open your Arduino software, and click on File menu and then Examples.
- In Examples, open ArduinoISP as shown in below figure:
- Now upload this ArduinoISP example in Arduino B board in first figure, which is acting as a programmer.
- Now Arduino B board is ready to upload the bootloader in Arduino A board.
- Now select the Arduino A board from Tools>Boards but I am not gonna do that as in our case we are using Arduino UNO for both programmer and the one getting programmed.
- Now click on Tools and then Programmer and select Arduino as ISP from the options as shown in below figure:
- Now we have done all the settings and finally we are ready to Upload Bootloader in ATmega328, so now click on Tools and then click on Burn Bootloader as shown in below figure:
- When you click on this Burn Bootloader, TX / RX leds on both the Arduino UNO boards are gonna blibk for around 30 seconds and when they are done then you will see a message on your Arduino software that Bootloader uploaded, which means you have successfully uploaded the bootloader in your ATmega328 microcontroller and now you can upload the code into it.
- After uploading the bootloader, go to Tools and the Programmer and change it back to AVRISP, otherwise you won't be able to upload the code in your Arduino UNO.
- You should also download this Arduino Library for Proteus, it will enable you to simulate your Arduino in Proteus software.