Introduction: Standalone Atmega8-16pu With Arduino Optiboot Bootloader

Picture of Standalone Atmega8-16pu With Arduino Optiboot Bootloader

This instructable is made because I experienced various problems to make Atmega8-16pu to run Optiboot Bootloader, so I want to share how I finally can use Atmega8-16pu with Optiboot Bootloader

There are many advantages of using Optiboot Bootloader, including:

1. Larger uploadable sketch size due to bootloader's smaller size.

2. Faster startup (Instant startup vs Arduino NG Bootloader's 8-10seconds startup)

Step 1: Parts & List

You are going to need:

1. Atmega8-16pu (1)

2. 22pF Capacitor (2)

3. 16MHz Crystal (1)

4. Arduino UNO (1)

5. 10K Resistor (1)

6. Jumper Wires

Step 2: Breadboarding

Picture of Breadboarding

Assemble the components according to the picture above.

At Atmega 8:

Pin 1 > 10K resistor to +5V & Wire to Pin 10 Arduino UNO

Pin 7 > +5V

Pin 8 > Ground

Pin 9 > 22pF Capacitor to ground & Crystal

Pin 10 > 22pF Capacitor to ground & Crystal

Pin 17 > Pin 11 Arduino UNO

Pin 18 > Pin 12 Arduino UNO

Pin 19 > Pin 13 Arduino UNO

Pin 20 > +5V

Pin 22 > Ground

Step 3: Burning the Optiboot Bootloader Using OptiLoader

Picture of Burning the Optiboot Bootloader Using OptiLoader

Download and upload optiLoader sketch to Arduino UNO ( Link: https://github.com/WestfW/OptiLoader )

Open serial monitor and set Baudrate to 19200 with Both NL & CR

Type 'G' if nothing appears in Serial Monitor

The burning process should be started

The finished process should be appears like the second image above

Step 4: Uploading Sketch to Optiboot Burned Atmega8

Picture of Uploading Sketch to Optiboot Burned Atmega8

Plug your Atmega8 to Arduino UNO (Replace the Atmega328)

(or use some kind of FTDI Adapter to program it)

Download and extract Arduino IDE 1.0.5 ( Link: http://arduino.googlecode.com/files/arduino-1.0.5-... )

Open the extracted folder and navigate to \hardware\arduino and open the board.txt file using WordPad (don't use Notepad)

Go to the lowest line and paste this text:

##############################################################
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

##############################################################

Save it and run arduino.exe in the root directory of the extracted folder

Choose Arduino Optiboot-Atmega8-16 in Tools>Board

Choose your Serial Port in Tools>Serial Port

You should can upload sketch without any problems. (I tested to upload Blink sketch)

Step 5: Enjoy!

Picture of Enjoy!

Congratulations!

Your Atmega8-16pu now loaded with Optiboot Bootloader and you can use it just like Atmega328p-pu with instant startup and larger sketch room.

The pin diagram is the same with Atmega328p-pu ( Image from: https://www.instructables.com/file/F2SFHSDH3Z3V3P4/ )

Credits:

Optiboot ( https://code.google.com/p/optiboot/wiki/Installing... )

WestfW's OptiLoader ( https://github.com/WestfW/OptiLoader )

board.txt modification from wkws20's eBay Listing (http://www.ebay.com/itm/3pcs-Arduino-MCU-ATMEGA8-1... )

Step 6:

Comments

UtkarshVerma (author)2017-04-15

For those who don't have the 16MHz crystal, try this instructable:

https://www.instructables.com/id/ATmega8-As-Arduino-using-Internal-8Mhz-Crystal/

dwl (author)2016-05-20

You can use the latest version of the Arduino IDE.

Just add the following line to the Optiboot-Atmega8-16 entry in the Boards.txt file :

opti8.upload.tool=avrdude

Sakib Ahmed made it! (author)2016-04-28

This Worked like a charm.... I was trying to work with the latest ide andadditional board url and managed to burn the chips successfully but while tried to upload codes(replacing the Uno IC with the new ones) it would not do for Atmega8A no matter how many times and different ways i tried while working for Atmega328p just fine!!

Finally downloading the older IDE and editing the boards.txt file saved me, Thanks to you.

ivankusumo (author)Sakib Ahmed2016-04-28

Yeah, it can't work with new Arduino IDE. Last time I tried it with 1.6.4 and experiencing same problem with you, that's why we need the older IDE to burn the code by editing boards.txt. Good luck for your project!

db9pz (author)2015-11-08

Hello, fine Instuctable you wrote! Did you realiezed that the Instruction code of an AT-Mega8 is not exactly the same then an AT-Mega328 ? There are slightly differences in the code. At least the memory (RAM) is also less then the 328? The ROM also? If I remember correct it is a fourth of the 328! Every new Generation of the AT-MEGA will double the RAM/ROM/EEPROM . A good value for small programms/sketches, will be the AT-Mega 168 . It will be sold in Germany for about 3.25€ for a single device, without p&p. This should be not a critic in the main, more a simple advice for you, and the other "builders". Markus ; db9pz

ivankusumo (author)db9pz2015-11-08

ROM and RAM in Atmega8 is less than Atmega328 has. This chip is a good alternative to someone working in project in very low budget (cost below $1.5 in eBay) or has atmega8 lying around and want to make something from it. Well, I would recommend having ATmega328 besides of having 168 for higher level of projects, because in fact atmega328 is the same chip that Arduino UNO use and it's even cheaper from what I found in eBay. Well, at last, thank you for your advice :)

db9pz (author)ivankusumo2015-11-08

You are absolutly right! The pre- version of the UNO, was the DUEMILANOVE (2009). The first edition of the 2009 was equipt with the AT-Mega 168 as the main chip. Absolutly the same set of Instruction code, and the same pin-layout, as the 328 chip, but only half of the memory. I agree with you, that for small, or breadbord made circuts with small sketches to upload in the memory, it is allmost good to look for the 168! Even when you are on a budget. The most beginner sketches will fit into the 168 memory, even some of the elaborated and more complex one, often do! Before I shoot my expenive 328, I'll try it with the cheaper 168, and very often it is O.K. that way! Sorry for my English, it's not my native tounge. The German dicionary in my tablet will correct all the "wrong" words that I write! Hope you unterstand what I mean... Have a nice sunday! Markus ; db9pz

DIY Hacks and How Tos (author)2015-11-07

Cool Arduino project.

Thank you :)