1

I am making an RGB LED project right now using the Arduino UNO board.

At this point everything is working fine so I would like to transfer this onto a small microcontroller circuit to be put inside the enclosure. Since the enclosure is small, I cannot fit the UNO board inside it, hence I want to make a small circuit on perfboard with minimal components.

I read that you can burn the arduino bootloader on a standalone AVR (hooked up to power, filter caps and 16Mhz crystal) which can then execute Arduino code.

Any idea how can I do this? Also can I do this on an ATmega8l AVR, since my code is small enough to fit in one? No point wasting a 328 if 8L can do the job.

Thanks!

  • If you have the ability to burn the bootloader to a chip then you have the ability to burn the program to it without using the bootloader. – Ignacio Vazquez-Abrams Dec 1 '14 at 15:57
  • 1
    No need for a bootloader. Just upload your program to the ATMega8 using your Uno as an ISP programmer. If you do more projects like this, it would be a good idea to buy a separate programmer like mpflaga is suggesting. – Gerben Dec 1 '14 at 17:11
  • Also, why the '8L instead of the '88PA (or even '48PA)? – Ignacio Vazquez-Abrams Dec 2 '14 at 5:08
  • 1
    @IgnacioVazquez-Abrams 8L because I had several of them lying unused in my parts box. Regarding burning the bootloader, I understand now that the bootloader is only required to do stuff like uploading using USB etc. Has nothing to do with the actual compiled program – Ankit Dec 2 '14 at 19:43
1

The Bootlader

If you want to burn the bootloader to the standalone AVR that you will be using, you can do so using a programmer like the USBasp. Or, you can simply use the Arduino  itself to do this.

  • Open the ArduinoISP sketch from File > Examples.
  • Upload it.
  • Push reset on the Arduino.

Wire it up

Next, wire up the AVR on a breadboard as shown here: Arduino ISP

  • If you are using a variant/derivative, use a crystal that matches the crystal on your board. You might have not_in_sync() trouble if you don't.
  • Add a 10uF capacitor between RESET and GROUND on the Arduino, if you are using Uno, or something similar.

Burning the Bootloader

Then select Arduino as ISP as the programmer.

  • Goto Tools > Programmer.
  • Select Arduino as ISP.

Now click on Tools > Burn Bootloader.

Verifying it all works

Once that is done, open the Blink LED example and try uploading it to the AVR. You have to use the Upload using Programmer option from File > Upload using Programmer. You can verify if it is successful, by connecting an LED to pin 19 of the AVR, and checking if it blinks.

Notes:

  • Remember that the pins on an AVR don't map to the corresponding pins on the Arduino, even if they are both the same chips. Search for "AVR to Arduino pin mapping" for your chip on Google. Here's the ATMega8 to Arduino pin mapping.

  • Don't forget to connect the ground lines of the AVR and the Arduino.

  • This worked for me using an ATMega8A-PU. It should work with the 8L too.

  • Post here if you have any problems. Glad to help :)

  • 1
    "First, you have to burn the bootloader to the standalone AVR that you will be using." Incorrect. You do not need the bootloader in order to use ISP, nor do you need it in order to use the Arduino libraries. – Ignacio Vazquez-Abrams Dec 4 '14 at 17:40
  • 1
    Yes, I am aware of that. OP: "I read that you can burn the arduino bootloader on a standalone AVR". I assumed the OP wanted to burn the bootloader. Will re-word the answer. Thanks for pointing it out :) – cepradeep Dec 4 '14 at 17:42
  • 1
    Thanks guys. I realize now my wording was quite incorrect. – Ankit Dec 5 '14 at 14:42
0

You can program the 8u2 by either using a ISP programmer such as Pocket AVR Programmer or directly over USB using the FLIPS software as documented

In reference to:

"hence I want to make a small circuit on perfboard with minimal components"

I would recommend getting Tiny AVR Programmer or alike to program ATtiny's and at use the ATtiny's directly for small specific tasks. Hence you can avoid the cost of the whole UNO if not needed. You can even emulate limited USB connection as done with the DigiSpark. They even support internal oscillator. So they often need now external parts. They can be often applied without PCB.

0

Problem with Atmega8A-pu

Make sure the correct com port is selected then on the tools menu select Arduino NG or Older as the board type then choose the ATmega8 as the processor from the tools menu and upload any example Program probably i prefer blink to test (courtesy-PARC-India).

All the best

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.