Arduino ATMEGA328 from UNO

I have been working on creating a stripped down Arduino project that uses the ATMEGA328 chip without the Arduino board.

After buying a bunch of ATMEGA328 chips with UNO bootloader installed I found that I was unable to get the Arduino on a breadboard example to work(found Here)

The reason for this is that once a chip is boot loaded with a boot loader that requires a crystal oscillator (or any external oscillator for that matter) it needs to be connected to the external clock source before you can overwrite the bootloader or even overwrite any of the fuse bits.

Since my ATMEGA328s were boot loaded with an UNO bootloader I needed to attach a 16MHz crystal. There are cases that I’ve read about where people have accidentally set the fuse bits to expect some other clock input. The way they got around this is by using another micro controller to provide the clock signals while overwriting the boot loader.

In my case, I don’t have an UNO but I do have an Arduino Nano (v3.0). So to overwrite the boot loader I set it up as follows

ATMEGA328OnBreadboard1_bb
Points to note:

Capacitor between 5V and Reset is 10μF and is used to override the automatic reset on connection

The crystal oscillator is 16MHz with two 22pF capacitors

 
Steps to get the bootloader on is:
  1. Set up your project as seen above
  2. Download the board spec for Arduino on a breadboard from here
  3. Unzip the file and place it in the ‘hardware’ folder in your Arduino directory (don’t place the .txt file as it is, instead place the folder in the hardware directory. It should looks something like this ../Arduino/hardware/ATMEGA328/boards.txt
  4. Restart the Arduino IDE
  5. Select the board you connected on the correct port. In my example the board is an Arduino Nano w/ ATMEGA328
  6. Burn the Ardunio ISP sketch from the examples onto your board.
  7. Next select ‘ATMega328 on Breadboard (8MHz internal clock)’ from your boards
  8. Now select Tools>Programmer>Arduino as ISP
  9. Then select Tools>Burn Bootloader
 
That should be it.
 
Now, I use a USB to Serial converter to connect this newly bootloaded chip and burn a sketch.
ATMEGA328withUSBToSerial_bb-2
However, that’s not the end of it. The Arduino numbers do not map directly to the pin numbers on the ATMega328 pins. 
 
For the Arduino to ATMega328 pinout check this page out: http://arduino.cc/en/Hacking/PinMapping
So connecting an LED with a resistor to pin 19 on the ATMega corresponds to pin 13 in Arduino land. Now you are ready to load the Blink sketch on your stripped down Arduino.
 
 
Hope this helps some of you out there.
 
 


Leave a Reply

Your email address will not be published. Required fields are marked *