Introduction: Program ATmega 328 Using Arduino (Arduino As ISP)

About: Maker, Electronics enthusiast. Studied Electronics and Communication Engineering. Studies Robotics And Intelligent systems.

Arduino is nowadays an easy tool for e-hobbyists .As an open platform and a "ready to use" circuit, everyone follows various arduino boards for realization of embedded designs. But sometimes it is difficult and unaesthetic to use such large board as the basic circuit of our project or product, such as making a home automation system using an arduino board'll not be professional . Any arduino board consists of two basic blocks namely the programmer and the microcontroller . The microcontroller is nothing but a standalone microcontroller (Atmega328 in arduino uno) and the programmer is the programming circuit which do the programming of our microcontroller.

When we are making an application level electronic product, we don't need the entire arduino in the design. Only we need the microcontroller programmed as per our application and we don't need the programming circuit of the arduino board. So, in this instructable we gonna program a 328 microcontroller for led flashing and using the microcontroller alone on a breadboard.

Step 1: Bill of Materials

1. Arduino Uno.

2. Breadboard.

3. USB A to B cable.

4. ATmega328 microcontroller.

5. LEDs.

6. 22 pF capacitors.

7. 16 Mhz crystal.

8. 9V battery.

9. Jumper wires.

Step 2: Bootloading the Microcontroller

In non technical words, bootloading is nothing but making a bridge of communication between the arduino board and the microcontroller. The microcontroller 328 that we buy in market may or may not be bootloaded. I it is already bootloaded, then we can directly use it with the arduino otherwise we have to bootload it first. Bootloading can be done with the same arduino uno.

1. Fix the 328 on a breadboard.

2. Connect the crystal to the 9th and 10th pins of the 328.

3. Connect two 22 pF capacitors to each of the two legs of crystal and ground them.

4. Connect pin no: 7 and 20 to a 5V pin of arduino.

5. Connect pin no: 8 and 22 to ground of arduino.

6.Connect pin no:10 of arduino to the pin no:1 (reset) of 328.

7. Connect pin no:11 of arduino to the pin no:17 of 328.

8. Connect pin no:12 of arduino to the pin no:18 of 328.

9. Connect pin no:13 of arduino to the pin no:19 of 328.

Now connect the arduino board to the computer

The arduino in powered up also the 328 on breadboard is powered up.

The circuit is ready and we have to bootload , open the arduino IDE for that.

From MENU select Tools>Programmer>arduino as ISP

Then select Tools>Burn bootloader

After a few seconds, the 328'll be bootloaded and we can easily program it with the arduino board.

Step 3: Programming

Remove all the connections from arduino board to the breadboard we've done for bootloading.

We need some new and a few connections for programming 328.

The new connection steps are as below,

1. Connect Vcc and Gnd from the arduino board to the breadboard microcontroller.

2. Connect the RESET pin of arduino board to the pin number 1 of ATmega 328.

3. Connect the Rx pin of arduino to the pin number 2 of 328.

3. Connect the Tx pin of arduino to the pin number 3 of 328.

Now we've to make some changes in the IDE also , as follows,

1. From MENU , select Tools >Board > "Arduino Duemilanove or Diecimila"

2. now select ,Tools > Processor > ATmega328

Now the entire programming setup is ready

write the program as usual, click "upload"

The program'll be uploaded to the microcontroller.

Remove all the arduino connections, provide a separate 5 VDC power supply to the breadboard and we've an independent 328 microcontroller in action.

Step 4: An Important Pitfall

In the arduino IDE , pin number 5 means the fifth pin of the arduino board not the fifth pin of 328 microcontroller.

It is actually 11th pin of the 328.

Since we are coding for a standalone 328, we've to put keen attention in accessing the I/O pins.

So, access 11th pin of the 328, we've to write in the code "5" instead of 11.

All the 18 I/O pins of 328 can be accessed like this.

So I'm attaching a table which describes everything about coding the I/O pins.

Step 5: Demo Video of Blinking Led on Breadboard

Have Funnnnnn........<3

Arduino Contest 2016

Participated in the
Arduino Contest 2016