ATmega8 As Arduino (using Internal 8Mhz Crystal)

25,150

29

30

About: I am an 18 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 gadg...

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!

Congratulations on successfully converting your ATmega8 chip into a mini Arduino. Now you can make your projects much more compact and cheap. To understand its pin relation with Arduino pins, refer to the "ATmega8 as Arduino Pinout" file which you had downloaded earlier.

Also, if you found this instructable helpful, please support me by reopening the shortened download links twice or thrice. You can also support me on Patreon.

That's all for this instructable! If you have any doubt, feel free to comment.

Keep Tinkering!

Project By:

Utkarsh Verma

Thanks to Ashish Choudhary for lending his camera.

2 People Made This Project!

Recommendations

  • Games Contest

    Games Contest
  • Barbecue Challenge

    Barbecue Challenge
  • Backyard Contest

    Backyard Contest

30 Discussions

1
None
AkshayS226

7 months ago

Can it be used for ATMEGA8A micro-controller??
If yes, any chnages to be made here..??

1 reply
0
None
UtkarshVermaAkshayS226

Reply 7 months ago

The process is the same for all AVRs, but the bootloader might differ for ATmega8A, so you must ensure that.

0
None
parizpersian

8 months ago

Hi. Thanks for ur helpful tutorial.
I have a problem with IDE 1.0.1.
I wanna use nrf24 with my atmega8.
I have problem while uploading the code. There is no library for RF24 in this ide. I tried to add the library manually but no success.
Anyone could help ?

1 reply
0
None
UtkarshVermaparizpersian

Reply 8 months ago

There shouldn't be any issues in the older IDE with libraries, I myself have used several external libraries with this IDE. I think you might not be adding the required library, i.e the one which gets imported into your program. Check the import statements as well. It will work.

0
None
SanjuR9

1 year ago

it was soo tough

0
None
IffatH

1 year ago

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

3 replies
0
None
UtkarshVermaIffatH

Reply 1 year ago

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.

0
None
IffatHUtkarshVerma

Reply 1 year ago

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
0
None
UtkarshVermaIffatH

Reply 1 year ago

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.

0
None
ahmedj8

2 years ago

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
0
None
Black3rrorahmedj8

Reply 1 year ago

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

0
None
UtkarshVermaahmedj8

Reply 2 years ago

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

0
None
majidmp97

1 year ago

1 reply
0
None
UtkarshVermamajidmp97

Reply 1 year ago

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?

0
None
majidmp97

1 year ago

tank you i will buy isp programmer and cheek it agin