ATmega8 As Arduino (using Internal 8Mhz Crystal)

8,809

22

23

Posted in TechnologyArduino

Introduction: ATmega8 As Arduino (using Internal 8Mhz Crystal)

About: I am a 17 years old hobbyist who finds a great drive in tinkering with electronic circuits. The reason I love electronics is that it empowers me to solve real-life issues with ease. I also enjoy making gadge...

Nowadays, gadgets like Arduino have found a very popular use. They can be used to create a plethora of projects, however, they occupy a lot of space and are expensive for some of us (including me). To solve this problem, I present to you this instructable, which will teach you how to use an ATmega8 (or any other avr) chip to store Arduino code and act as a compact and cheap Arduino. Doing this requires easily available electronics, which, if you are a hobbyist too, will already have. Unlike other instructables, which depend on the usage of an external crystal oscillator to achieve the same goal, this project uses the internal 8Mhz crystal of ATmega8, which makes it a boon for those who lack the 16Mhz crystal.

Also, I will be using an Arduino as an ISP to program the chip, so this makes it more cheap.

Now, without further ado, let's begin tinkering!

Step 1: Gather Around Some Stuff and Some Files

Requirements:

1. 10uF capacitor - 1

2. Male to Male Jumper Wires - 8

3. Breadboard - 1

4. ATmega8 chip - 1

5. Arduino UNO or any other Arduino

Stuff To Download:

1. Bootloader for ATmega8

2. Arduino IDE v1.0.1

This link will lead you to the Arduino IDE Downloads page. Download the v.1.0.1 specifically because I have found it to work perfectly with the ATmega8 chip. For some reason, latest version doesn't support the modification of Boards.txt, which is crucial for this instructable.
5. Boards.txt

The usage of this file will be explained afterwards.

Step 2: Converting Arduino Into a Programmer

Arduino can be converted into a programmer by simply uploading the ArduinoISP sketch to it. It is provided as an example sketch by Arduino. However, I am providing the code as a file too. Download it and upload it to your Arduino.

Once the code is uploaded, proceed to the next step.

Step 3: Setting Up Arduino V1.0.1

After downloading Arduino v1.0.1, extract it. Also, copy the whole text of "boards.txt" file you downloaded.

1. Now you have to browse the following file in the extracted folder:

"........\arduino-1.0.1\hardware\arduino\boards.txt"

2. Open "boards.txt" and paste the copied text at the end of the file.

3. Now open "arduino.exe" placed in the extracted Arduino 1.0.1 folder.

4. Select the Arduino board as "ATmega8-noxtal @8MHz"

5. Select the Programmer as "Arduino as ISP"

Now your Arduino IDE v1.0.1 is set up!

Step 4: Hooking Up Arduino With ATmega8

Wire the ATmega8 IC with your Arduino by referring to the above posted schematics.

Also, keep in mind to place the 10uF capacitor between the RESET and GND pins.

I have attached a picture of how I had wired my Arduino to ATmega8.

Step 5: Burning the Bootloader to ATmega8

Bootloaders are the files which enable a microcontroller to be programmed independently. Therefore, once ATmega8 is burnt with a bootloader, we will be able to use it as an Arduino.

To burn the bootloader:

1. Extract "atmega8_noxtal.zip" to ".......\arduino-1.0.1\hardware\arduino\bootloaders\".

2. If Arduino IDE is already running, restart it, else open it.

3. Check if the Programmer, COM Port and Board is correctly set as described in one of the previous steps.

4. Hit "Burn Bootloader" under "Tools" menu.

If you have wired correctly, on clicking the "Burn Bootloader" option, the RX,TX, and L lights on the Arduino will start glowing brightly. I have posted the picture too.

Step 6: Uploading Sketches to ATmega8

After burning the bootloader to your ATmega8, you have almost finished this project.

Now all that's left to do is to upload your desired sketch to your chip. To do that, ensure that the board is set to "Atmega8-noxtal @8Mhz", and the programmer to "Arduino as ISP".

Remember that the wiring which you had used to burn the bootloader is also used for uploading sketches.

Uploading the sketch is done by using Arduino as a programmer, so unlike usually, when you pressed "Ctrl+U", now you will have to press "Ctrl+Shift+U", which tells the IDE to program the chip through Arduino.

Step 7: Congratulations!

{"context":{"location":{"href":"https://www.instructables.com/editInstructable/publish/E0TZ4DLJ1CETZKL","origin":"https://www.instructables.com","protocol":"https:","host":"www.instructables.com","hostname":"www.instructables.com","port":"","pathname":"/editInstructable/publish/E0TZ4DLJ1CETZKL","search":"","hash":""},"jQuery1102010854159319476697":1,"b":{"jQuery1102010854159319476697":20,"sizzle-1521627561643":{"parentNode":["6806 46",267]}},"h":{}},"selector":"#editor-Object-56"}

2 People Made This Project!

Recommendations

  • Casting Contest

    Casting Contest
  • Make it Move Contest

    Make it Move Contest
  • Microcontroller Contest

    Microcontroller Contest
user

We have a be nice policy.
Please be positive and constructive.

Tips

Questions

23 Comments

Hi, I am having an error (or warning maybe) : avrdude: stk500_getsync(): not in sync: resp=0x66.
Please help...

3 replies

This error is shown by the IDE when there's a connection issue with the Arduino. Ensure whether your Arduino is properly connected by doing loopback test and try again.

Thank you, I had a problem in my cable.
Now I am experiencing a new problem. I am having a huge level of noise while taking input though analog pin(ADC0). Meanwhile, in Arduino, I am getting the actual input. I searched the internet and found a solution to remove noise (as they said, getting a noise in analog input without this setup is general). I applied this, but no result.

For you information, I am using audio signal as input.
Can you please help me...

ADC - Power Hookup.jpg

I'm sorry to say I won't be of any help to you regarding this matter since I haven't tried out Arduino's analog pins yet and don't have the time to do so currently. So you'll have to look it up yourself.

I have the error ?

avrdude: Expected signature for ATMEGA8 is 1E 93 07

Double check chip, or use -F to override this check.

4 replies

I had the same problem.
solved when I've unplugged the LED from pin PB5 or Digital13 and ground

This error happens when your Board isn't correctly set in Arduino IDE.

Then what to do next? I am getting same error..

Correct your board settings by re-doing Step 3.

1 reply

I can't say anything about the AVR ISP Shield since the website doesn't provide its schematic. Also, try the process as shown in this Instructable. If it isn't working then you might be missing something.
By the way, did you buy ATmega8 without bootloader or with a bootloader? Also, does your Arduino have removable IC or not?

No need to buy ISP. You can use Arduino as an ISP as shown in Step 2

i dont have arduino

it work with mega 8 smd to? my chip is smd i thing that my priblem

2 replies

Firstly, I'd like to enlighten you that there's no difference between the SMD and DIP versions of any IC rather than the size.
Therefore this method will with for you too. Just recheck the stated steps.
Also ensure that the clock fuse is not set to 16MHz because if it is, then you'll have to add an external 16MHz crystal oscillator between the OSC pins to make your chip boot up.
Also, tell me the specific part where you are failing with this process.

if i program mega 8 with ATmegaBOOT.hex

work without isp programer?

1 reply

You will need the programmer for sending data into the chip.