Sunday 4 June 2017

Use Atmega8 in circuit, programmed with Arduino Uno

Now you have programmed Atmega8 on Arduino Uno board and you want to place it on real circuit. But there is problem. On Arduino Board there is external crystal clock and in real circuit it is not there. To solve this problem, atmega8 need to set for internal clock while loading its bootloader.

Now I assume you have followed the procedure given in my blog http://nilyash81.blogspot.in/2017/01/burn-arduino-bootloader-on-atmega8.html. The blog explains about burning arduino bootloader on atmega8. Lets move ahead from there.


  1. Open Board.txt file in Vim editor. Search in file for  NG. You will find a line atmegang.name=Arduino NG or older.
  2. Change a line atmegang.build.f_cpu=16000000L to atmegang.build.f_cpu=8000000L. It will basically change cpu frequency from 16 mhz to 8 mhz. This way we can set any clock speed as per the need.
  3. Go to line ## Arduino NG or older w/ ATmega8. Below this line is block dealing with atmega8 and above it is a block deals with atmega168. We are focused on atmega8 block. In this fuse bits are set which decides about internal or external clock to be used.
  4. We want to use internal clock of atmega8. Hence change lines
             atmegang.menu.cpu.atmega8.bootloader.low_fuses=0xdf
             atmegang.menu.cpu.atmega8.bootloader.high_fuses=0xca


with

            atmegang.menu.cpu.atmega8.bootloader.low_fuses=0xe4
            atmegang.menu.cpu.atmega8.bootloader.high_fuses=0xc2


Save the file and again burn bootloader using usbasp (using programer). Now atmega8 is set to work with 8 mhz internal clock. Also upload the code using usbasp. Now your chip is ready to work standalone on veroboard or breadboard. You only need to connect 5v and ground to chip the code inside chip will start executing.

If you are lazy to edit Board.txt. You can download it from https://www.dropbox.com/s/pektx7if5dn9qxc/boards.txt?dl=0. Paste it at location C:\Program Files (x86)\Arduino\hardware\arduino\avr. Before you paste the file, it is better to backup original Board.txt file.

Thanks for reading......Keep coding.....

Tuesday 3 January 2017

Burn Arduino bootloader on Atmega8

11.  Download Zadig usbasp drivers from http://www.fischl.de/usbasp/
22.  Open Zadig then connect usbasp. Zadig may autodetect usbasp, if not detected go to options and click List All Devices. Choose usbasp and select Winusb as driver to install. The Winusb is detected by Arduino IDE (libusb is not detected). But Winusb is not detected by extreameburner.
33.  Arduino installation needs modification to avoid an Error  ‘Effuse memory not defined’ .

Please follow following video
or
Download platform.txt from link as suggested by above video https://drive.google.com/drive/folders/0B4VbEW_iRqjmM1dHYWZDRlJpSUk

Paste (replace) the platform.txt at location “C:\Program Files (x86)\Arduino\hardware\arduino\avr\”

44.  Connect usbasp. Usbasp should have connected to arduino ICSP pins. Open Arduino IDE.  Go to  Tools, select Boards, select Arduino NG or Older. In Tools select processor as Atmega8. In Tools  select Programmer as Usbasp.
55.  In Tools select Burn Bootloader. It will burn bootloader.
66. To upload sketch remove usbasp and connect Arduino board at USB and then upload. There is warning regarding “cannot set sck period and firmware upgrade ”. But ignore it.