How to Program Any Type of AVR Microcontroller With Arduino Ide || Hex Shield || Attiny85 || Atmega8 || Atmega32

by vishalsoniindia in Circuits > Arduino

1987 Views, 7 Favorites, 0 Comments

How to Program Any Type of AVR Microcontroller With Arduino Ide || Hex Shield || Attiny85 || Atmega8 || Atmega32

how to program AVR microcontroller with arduino ide || avr microcontroller programming tutorial
PicsArt_06-26-09.26.12.jpg

Please subscribe to my YouTube channel.........

In this article we will learn how to program any type of avr microcontroller using arduino IDE via arduino.

I am explaining a concept to program any avr microcontroller with help of Attiny85 example.

Arduino As ISP

Screenshot_2021-07-01-03-26-45-632_com.mxtech.videoplayer.ad.jpg
Screenshot_2021-07-01-03-27-37-606_com.mxtech.videoplayer.ad.jpg
Screenshot_2021-07-01-03-27-50-170_com.mxtech.videoplayer.ad.jpg
Screenshot_2021-07-01-03-28-14-010_com.mxtech.videoplayer.ad.jpg

  1. Take your arduino
  2. Connect with your pc.
  3. Open arduino IDE.
  4. Go in file >> example >> ArduinoISP
  5. Open ArduinoISP program.
  6. Select correct board and port in tools.
  7. Now upload the code.

Program AVR Via Arduino Circuit

Screenshot_2021-07-01-03-28-32-745_com.mxtech.videoplayer.ad.jpg

  • In the circuit the SCK,MISO,MOSI,RESET pins of AVR are respectively connected with 13,12,11,10 pin of arduino

Arduino's 13 pin -----------------> SCK of AVR

Arduino's 12 pin -----------------> MISO of AVR

Arduino's 11 pin -----------------> MOSI of AVR

Arduino's 10 pin -----------------> RESET of AVR

Arduino's +5v pin -----------------> VCC of AVR

Arduino's GND pin -----------------> GND of AVR

ICSP Pinout of AVR

Screenshot_2021-07-01-03-28-46-718_com.mxtech.videoplayer.ad.jpg
Screenshot_2021-07-01-03-29-04-749_com.mxtech.videoplayer.ad.jpg
Screenshot_2021-07-01-03-29-14-606_com.mxtech.videoplayer.ad.jpg
Here We are taking example of attiny85 but you can choose any AVR.
  1. Search "Attiny85 arduino pinout" in google.
  2. find the image same as given.
  3. find the ICSP pins, SCK,MISO,MOSI,RESET and VCC,GND
  4. Connect ICSP pins as shown in circuit.

Find AVR Board Link for Arduino IDE

Screenshot_2021-07-01-03-29-32-875_com.mxtech.videoplayer.ad.jpg
Screenshot_2021-07-01-03-29-37-299_com.mxtech.videoplayer.ad.jpg
Screenshot_2021-07-01-03-30-06-901_com.mxtech.videoplayer.ad.jpg
Screenshot_2021-07-01-03-30-14-857_com.mxtech.videoplayer.ad.jpg
Screenshot_2021-07-01-03-30-26-443_com.mxtech.videoplayer.ad.jpg
  1. Search "Program Attiny85 with arduino".
  2. Find the Board link in google results.
  3. Copy the the board link for attiny85 the link given below.

https://raw.githubusercontent.com/damellis/attiny/ide-1.6.x-boards-manager/package_damellis_attiny_index.json

  1. Go to the arduino IDE.
  2. Click on File -> Preferences
  3. Paste the link in Boards Manager URLs. if there is other links, then paste link after comma ",".

Install the AVR Board for Arduino IDE

Screenshot_2021-07-01-03-30-41-962_com.mxtech.videoplayer.ad.jpg
Screenshot_2021-07-01-03-30-58-881_com.mxtech.videoplayer.ad.jpg
Screenshot_2021-07-01-03-31-32-620_com.mxtech.videoplayer.ad.jpg
Screenshot_2021-07-01-03-31-39-307_com.mxtech.videoplayer.ad.jpg

  1. Go the Board manager via "Tools >> Board >> Board manager"
  2. Here search "Attiny85".
  3. You will get a Library install it.

Upload Bootloader in AVR and Upload Program in AVR

Screenshot_2021-07-01-03-33-06-942_com.mxtech.videoplayer.ad.jpg
Screenshot_2021-07-01-03-33-23-224_com.mxtech.videoplayer.ad.jpg
Screenshot_2021-07-01-03-33-36-402_com.mxtech.videoplayer.ad.jpg
Screenshot_2021-07-01-03-33-51-236_com.mxtech.videoplayer.ad.jpg

  1. Open the code which you want to upload in AVR or you an download the code from github page given below.
  2. Select Attiny category in board.
  3. Select processor as attiny85.
  4. Select clock as internal 8Mhz.
  5. Select programmer "Arduino as isp".
  6. Click on upload bootloader.
  7. After bootloader uploaded go to the sketch.
  8. Go to the sketch >> Upload using programmer.
  9. The code will be uploaded successfully.

github link : - https://github.com/vishalsoniindia/Program_AVR_fro...

Connect Circuit As Program

Screenshot_2021-07-01-03-34-00-256_com.mxtech.videoplayer.ad.jpg
Screenshot_2021-07-01-03-34-04-822_com.mxtech.videoplayer.ad.jpg
Screenshot_2021-07-01-03-34-11-623_com.mxtech.videoplayer.ad.jpg

if you uploaded my code then you can connect circuit as shown.

  1. Push button is connected to 2nd pin of AVR
  2. Two leds is connected at 3rd and 4th pin of AVR.

Done

Screenshot_2021-07-01-03-34-22-263_com.mxtech.videoplayer.ad.jpg
  • Now you can see the Push button turn on led Alternatively.

Hex Shield

Screenshot_2021-07-01-03-34-50-915_com.mxtech.videoplayer.ad.jpg
Screenshot_2021-07-01-03-35-02-703_com.mxtech.videoplayer.ad.jpg
Screenshot_2021-07-01-03-35-09-041_com.mxtech.videoplayer.ad.jpg
Screenshot_2021-07-01-03-34-39-662_com.mxtech.videoplayer.ad.jpg

  • If you don't want to mess with wires then you can use the hex shield.
  • The Gerber file and schematic is given below on github link .
  • The shield many type of controller all are written on the shield.
  • if any AVR is out of this list then you can program it via ICSP pins on shield.
  • the shield has crystal selection jumper for 8Mhz and 16Mhz.

Github :- https://github.com/vishalsoniindia/Program_AVR_fro...

Order PCB

Screenshot_2021-07-01-03-35-25-055_com.mxtech.videoplayer.ad.jpg
  • This PCB is sent by PCBway you can order high quality PCB from PCBway.
  • Link to order PCB :- https://www.pcbway.com/