Make a standalone Atmega8 circuit

Suppose u have an Arduino board, and  u want to run a code independently on another blank Atmega IC that u have (coz u dont wanna deploy ur UNO to some place where it doesnt need to b programmed again.. n a programmed IC cud fit d job well.. ).. then how do you go about the coding ?

Well according to the tutorials on the arduino site, as of now, u shudn have ny issues if ur board is not UNO ( => if ur board is older than that)  .. But now, Uno is becoming the more common arduino platform .. and I have a Uno too, so I tried to get my AtMega8 (a 28 pin DIP ) run by programming it through the UNO.. and it worked..  😀

So here is how u go about it..

On the left is my UNO with an Atmega328.

below is the atmega8 I extracted from an old avr board

Now, the steps in brief :

  • First of all, u need to burn a  bootloader on to the atmega8, using the Arduino as an ISP (its ok if u didn understand this.. 😉 )
  • Once the bootloader is uploaded, u can now upload a simple sketch like Led blink on the new IC, and check whether the program works by connecting the IC on the breadboard.
  • Once checked on the breadboard, u can now go happy-soldering on a pcb.

But the procedure is a bit tricky, so lets get the hands dirty ..

Step 1 :Upload ArduinoISP code on ur UNO

Connect ur UNO to ur PC via the USB cable and go to File -> Examples -> ArduinoISP and upload this sketch.

Step 2 :Burn the bootloader

Connect ur Atmega (Atmega8 in my case) to the UNO via a breadboard as shown.

So what u need is :

a 16 MHz crystal

                                        2 ceramic caps (18 pf or 22 pf or 33 pf)

a 10k ohms resistor

few jumper wires

and a breadboard.

( a better version of this cartoon is available at http://arduino.cc/en/Tutorial/ArduinoISP)

  • Next, get an older version of the Arduino IDE (22 works & is available  at http://arduino.cc/hu/Main/Software    (older IDE versions) ) Donno why it doesnt work with the new IDE..
  • then u burn the bootloader in 2 steps :
  • Step 1 : Select the board

  • Step 1: Select Arduino NG or older w/ Atmega8      Bcoz this board used Atmega8 and so the bootloader for Atmega8  would b selected.

Next,

  • The bootloader should be burnt in a minute..  When the screen says bootloader uploaded..   u r half way through the work! 🙂

Step 3 : Burn the Blink code on the new Atmega8

Pull off the Atmega328 out of ur UNO and plugin the Atmega8   (b careful about the pin mappings  (keep the notch side of the Atmega8 on the lower side of the UNO ) )

Now , go to       File – Examples – Basics – Blink

Then go to       Tools -Board – NG or older w/Atmega8

Click                Upload.

When the code is uploaded, u can check it right there as there is an LED on pin 13 of the UNO and it should start blinking by now..  🙂

Step 4 : Time for  breadboarding

The bare minimum connections required for an Atmega8 are as shown.

to this connect an LED + a 220 ohms resistor on pin 18 of the IC (it corresponds to dig pin 13 of the UNO ). Once done, it should start blinking.

If it blinks implies that ur power, reset and crystal circuit are alright..  🙂 Bravo!

Step5 & final : Solder ur circuit on a pcb..

In my case, I had to turn on a relay after some interval and the soldered circuit is as shown..

PCB soldered =)

Happy DIYing..   🙂

useful links on the web :

http://arduino.cc/en/Tutorial/ArduinoISP

http://arduino.cc/en/Hacking/PinMapping168

http://arduino.cc/hu/Hacking/Bootloader

http://arduino.cc/forum/index.php?topic=92925.0

Advertisements
This entry was posted in DIY, Projects, TECH and tagged , , , , , . Bookmark the permalink.

47 Responses to Make a standalone Atmega8 circuit

  1. Teerapon says:

    I not have 16MHz x-tal . Can I use 12 MHz to replace 16MHz?

    • nirzaree says:

      Well, I havnt tried with a 12MHz crystal.. So r u trying to program it through a 12Mhz crystal or u want to run it on a 12MHz once its programmed ? I guess the settings should b stringent while programming.. but then after if u run on a lower MHz, it would just slow down the cycles accordngly… u cud give a try n lemme know . . 🙂 Gud luck!

  2. vj says:

    i have a 16mhz ceramic resonator however when i try it, it just makes my program frezze is it meant to do that or is something wrong i put a 0.22uf before the resonator connected to the ground and the rest looks the same can u plz help

    thank you

  3. website says:

    I adore that website layout . How was it made. It is so sweet!

  4. Mohannad Rawashdeh says:

    thank you so much , I did it and its worked well

    small inquiry , when I uploaded program to ATmega 8 it’s take a lot of time to start work “8-10 sec”

    is that refer to bootloader ? how we can fix it ?

    • nirzaree says:

      Hey good to hear that you found smthing helpful here. 🙂
      Well, I too m facing the delay issue issue in the bootloaded Atmega8. Around 9 seconds or so.
      I think this issue shudn b der in the higher version of the IC, like the atmega128 or atmega328. U cud give it a try. I couldn find those, so had to work with the atmega8 only. Or probably you could order boot-loaded ICs [which may b a lil expensive than the other ones]
      But in case you application isnt time critical then probably, it wont be much of an issue.

      • Mohannad Rawashdeh says:

        Hi nirzaree

        So it’s same issue

        not huge problem ,BTW, I’m so happy to do this .

        soon I will try upload program on atmega 8 By ICSP to elimination this delay “due to ICSP no bootloader needed” and I will tell you if it’s done

        thank you

      • nirzaree says:

        sure.. All the best! 🙂

  5. khairul says:

    nice tutorial..i will try this..
    will tell u later..thanks 😀

  6. vivek kumar says:

    now i am going to perform this job….

  7. Sufian Kaki says:

    cool job budy… liked it…

  8. khairul says:

    work 100%, thanks mate

  9. Anonymous says:

    “Life is a verb, not a noun”
    Liked it 🙂

  10. Petr Broža says:

    Hi, I just try it but its show :avrdude: Yikes! Invalid device signature.
    Double check connections and try again, or use -F to override
    this check.
    I check all connections but doest help.. Im using Atmega8-16PU and now I noticed I got 12MHz, can it be problem?

  11. lavansj says:

    Thank you!. You made is very easy.. I was breaking my head since couple of hours until I come across your blog.

  12. kain says:

    Description

    This is a Atmega8-16PU MCU preloaded with Arduino Optiboot (Arduino UNO) Bootloader.

    To use this MCU,simply

    Insert the following to the end of the boards.txt in Arduino\hardware\arduino Folder
    ##############################################################
    opti8.name=Arduino Optiboot-Atmega8-16
    opti8.upload.protocol=arduino
    opti8.upload.maximum_size=7680
    opti8.upload.speed=115200
    opti8.bootloader.low_fuses=0xbf
    opti8.bootloader.high_fuses=0xcc
    opti8.bootloader.path=optiboot
    opti8.bootloader.file=optiboot_atmega8-16.hex
    opti8.bootloader.unlock_bits=0x3F
    opti8.bootloader.lock_bits=0x0F
    opti8.build.mcu=atmega8
    opti8.build.f_cpu=16000000L
    opti8.build.core=arduino
    opti8.build.variant=standard
    ##############################################################

    1. plug it into a arduino UNO board and serve as a replacement for the old MCU OR
    2. supply this MCU with 5V and with a 16Mhz crystal, and use a USB>UART adapter to upload arudino sketch to the MCU ( eg FT232RL Adapter)

    Then select Arduino Optiboot-Atmega8-16 From the Tools>board menu
    Compile and Upload!

    Q: What is the difference with Atmega328 arduino Optiboot bootloader?
    A: This Atmega8-16PU was preload with official Optiboot bootloader compiled for Atmega8 (16Mhz). It does not have any difference in upload speed and MCU speed with Atmega328. The maximum sketch size is 7680bytes, but the price is half of that with Atmega328! So save money for projects with small size sketches!

    Package List:
    1. 3pcs ATmega8-16PU Lot Number 12+ (preloaded with arduino UNO bootloader)
    2. 3pcs 16Mhz DIP crystal

  13. Nikhil says:

    not working for me… After about 30 secs while uploading the booloder… it says error while uploading boootloader.. Please help.. very urgent…

    • Nikhil says:

      avrdude: stk500_getsync(): not in sync: resp=0xe6
      avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x80
      this is the error

  14. jfrmilner says:

    Thank you for the great post! I’ve used your guide to successfully burn the bootloader onto six Atmega8-16PU’s.
    I also get the 9 second delay on boot but I don’t mind.

  15. Edward says:

    Thanks for your tutorial. But it does not work for me. My controller is an ATmega8-16PU. The error is Yikes! Invalid device signature. However, when I replace the ATmega8-16PU by an ATmega328p it works fine (just modify the boards.txt). But I have some ATmega8-16PUs, I want to use them. How can I solve this problem?

    • nirzaree says:

      Is your crystal 16 Mhz? And which version of IDE are you using to burn the bootloader? I am guessing that the problem is in bootloading the atmega8 ICs.

      • Edward says:

        Yes, I am using the 16Mhz crystal. My IDE version is 0022. When I try to burn by using USBISP with progisp software, the problem is “Chip Enable Program Error”. And the prewritten Fuse: 0xD9E1. How do you think about the Fuse bit?

      • nirzaree says:

        Though its been quite a while since I played with Arduino & so I dont know about the changes in the newer IDE versions, I may still suggest u a few things to try out :

        1) u can give a try with the newer IDE versions, to check if the problem is due to the version of the IDE.

        2) Since the circuit works well with the atmega328s (hope that works still!), I dont think there are connection issues. I did not do ny changes in the fuse bits, so I dont think if that could be an issue. What changes have u made to the board.txt file?

        Since the circuit is pretty simple, I dont think of other things that could go wrong.

    • rishav says:

      i am too getting the same error…. did u find the solution?

  16. saqib says:

    I did everything perfectly. My program worked well on board but when i detached atmega8 from board and placed it on a breadboard it didn’t work at all. I checked the circuit many times but couldn’t get any response. I am programming an LCD. Any help would be appreciated.

    • nirzaree says:

      Well, when you have an elaborate wiring in the circuit, breadboards aren’t reliable. Some loose connection may keep u wondering for a long while.
      If u can do it on a PCB, it would be better.

  17. Deepak Ingale says:

    Hi,
    It was a great tutorial (simple to follow), i tried the same with Atmega8A-PU, but i got the error
    Arduino: 1.5.5 (Windows XP), Board: “Arduino NG or older, ATmega168”

    avrdude: Yikes! Invalid device signature.
    Double check connections and try again, or use -F to override
    this check.

    my question is do we need to connect the 16Mhz Crystal ckt on Atmega8A-PU while burning the boot loader ? i am using 022 ver IDE

  18. Solar Panel says:

    Hay Man ! Thanks-A-Lot ………..

    It worked with the latest AtMega8A (previous was Atmega8) …………………It will be very helpful for me in future to off-board in cost effective way ………

    You Did Really Good,

    Internet is great because of some (or maybe many) helpful people like you are out there, helping as a fellow human on some other corner of the world, not expecting power, money or anything else in return !

    And indeed “Life in a Verb not a Noun”
    Good luck to you !

  19. Brah says:

    Please i need help, when i have follow all steps in order, but i get this error : avrdude: stk500_recv(): programmer is not responding. I have a mac OS

  20. symplytimepass says:

    Thanks a lot! Worked for me even without having to put atmega8 into uno board!

  21. Finally, I found the simplest tutorial with the greatest result. Thanks friend, it work well,,,,
    now, i have two chip (Mega8 and Mega 328 using Xtal 16MHz) with bootloader inside them. Nice to know you and, thank you so much,,,

    http://www.wachid-elektronik.com

  22. Daniel Thrun says:

    Hi

    Tanks for you tutorial. It helped a lot.
    But I get the same error as “saqib”

    It works perfectly on the board, but on the breadboard it doesnt. I also tried a standalone circuit (on a PCB) made for my Atmega328p (the conections are the same right?!) and it doesnt work too. 😦

    I wonder whats happening. If you could help id be glad.

    • nirzaree says:

      Hello Daniel,

      Usually breadboards aren’t that reliable when u put components like crystals; so I would definitely suggest making a small circuit board. But as I read, it doesn’t work on a pcb for you?
      It is a pretty simple circuit. Just the power and clock connections for the chip. Can u put a snapshot of your circuitry?

      All the best!

  23. memet says:

    great job man….. owesome……. but same with you, i still don’t know why not working in IDE 1.6.0….

  24. Aditya Prasad says:

    I am using ATmega8A-PU, while burning the bootloader it throws an error “Arduino: 1.6.0 (Windows 8), Board: “Arduino NG or older, ATmega8”

    “efuse” memory type not defined for part “ATmega8”
    Error while burning bootloader.

    This report would have more information with
    “Show verbose output during compilation”
    enabled in File > Preferences.

  25. ushab acharya says:

    hello. i m doing a major project on at mega 8. i couldnt configure the problem with the development board… do i need to use oscillator in at mega 8?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s