3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

How to program a AVR (arduino) with another arduino

How to program a AVR (arduino) with another arduino
«
  • Selection_005.png
  • attiny2313_burning_fuses.jpg
  • atmega_rbbb1.jpg
This instructables is usefull if:

* you've got your arduino with atmega168 and you bought an atmega328 at you local electronics store. It doesn't have an arduino bootloader

* you want to make a project that doesn't use arduino - just a regular AVR chip (like the USBTinyISP) - you have a clean attiny2313/attiny48 etc that you want to burn firmware on.

Normally  you would have to have an ISP (In System Programmer) like USBTinyISP to program your new chip.  Having the arduino you can teach it to be a programmer thank to a great work done by Randall Bohn. He created Mega-ISP - an arduino sketch that works like a programmer.
 
Remove these adsRemove these ads by Signing Up
 

Step 1What do you need ?

What do you need ?
* a working Arduino (or a clone - i'm using the BBB - BareBonesBoard and a RBBB - RealBareBonesBoard by ModernDevices)
* a chip that you want to program (tested with atmega8,atmega168,atmega368, attiny2313, attiny13)
* a breadboard or a board with ISP header
* 3 leds + 3 resistors
* breadboard wires
« Previous StepDownload PDFView All StepsNext Step »
46 comments
1-40 of 46next »
May 9, 2012. 9:23 AMKarolisL says:
Hi,

can you help me?
PC doesnt see my programmer. Everything is ok with wiring. I think i did something bad with firmware burning.

As i understood i should insert hex from spi folder only or I should compile makefiles in 1 hex from all folder?

Can u upload hex which you used?
Mar 19, 2012. 6:40 PMphenoptix says:
Thanks for the ibble! Found it very useful for information programming an ATTiny85 (with slightly different board layout). Steps were largely the same. Cheers!
Feb 26, 2012. 1:22 AMcarnotricecooker says:
Hi kabturek, I'm a little confused on this part. I'm not quite sure through what you're sending the commands to upload firmware onto the ATTINY2313. Are you using the Arduino as an AVR programmer to upload the firmware or are you using a USBTinyISP that you bought to upload it? And after this, don't you still need the hardware support files to upload an Arduino sketch onto the ATTINY2313? Help on this section would be much appreciated.
Jun 4, 2011. 11:54 AMjcbed says:
for the bit about burning the tiny usb isp chip ummmmm... what pullup didu use if anney and do you have a fritzing image of it or any more info .
btw great indestrustiabel
May 26, 2011. 1:09 PMmeyer_lanski says:
hello,
Great Instructables, thank you very much for this. very informative. In your poist you mention you could use this method to program attiny13 chips. How do you go about wiring it up? the image you show is an atmega chip i believe which has more pins.

Sorry for the noob question. This is my first attempt at programming a standalone chip!

Any help would be appreciated.
Thank you.
Apr 7, 2011. 9:09 AMshanakaplus says:
um looking for elevator avr program. Do you have example program ?
Dec 10, 2010. 5:17 PMandrew101 says:
AHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH!!!!11!!!!

ONE FRIGGIN WIRE!!!!!!!!

(sorry)

I spent quite a while at this wondering where i went wrong (followed diagrams to the pin)

I didn't realize the reset resistor was supposed to be pull up, not pull down. Please fix the diagram.

Havne't gotten it working (yet) but made progress :)
Dec 13, 2010. 10:12 AMandrew101 says:
Well its been fixed now, but the chip was in an eternal state of resetting with a pulldown resistor instead of a pullup one

I used the method in this video:
http://www.youtube.com/watch?v=7LskShrK4vQ

plus I used your tutorial for the actual programmer and stuff.
Sep 18, 2010. 9:59 PMdustinandrews says:
I wanted to use this to upload to an ATMEGA168p from Windows 7.

Using a Pro Mini as the programmer and the Ardunio menu option to burn the bootloader I got an error.

avrdude: Expected signature for ATMEGA168 is 1E 94 06
Double check chip, or use -F to override this check.

I had to drop to a dos prompt and run the command by hand. I copied the hex file and conf file into the dir with avrdude to make things easy.

C:\>avrdude -p m168 -c avrisp -b 19200 -P com4 -F -U flash:w:ATmegaBOOT_168_diecimila.hex

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.05s

avrdude: Device signature = 0x1e940b
avrdude: Expected signature for ATMEGA168 is 1E 94 06
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed
To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "ATmegaBOOT_168_diecimila.hex"
avrdude: input file ATmegaBOOT_168_diecimila.hex auto detected as Intel Hex
avrdude: writing flash (16294 bytes):

Writing | ################################################## | 100% 2.50s

avrdude: 16294 bytes of flash written
avrdude: verifying flash memory against ATmegaBOOT_168_diecimila.hex:
avrdude: load data flash data from input file ATmegaBOOT_168_diecimila.hex:
avrdude: input file ATmegaBOOT_168_diecimila.hex auto detected as Intel Hex
avrdude: input file ATmegaBOOT_168_diecimila.hex contains 16294 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 22.43s

avrdude: verifying ...
avrdude: 16294 bytes of flash verified

avrdude: safemode: Fuses OK

avrdude done. Thank you.

I still need to test if it worked properly since I only have the pro-mini and some loose 168p chips.

By the way, I omited the external oscilator. So it's not mandatory for these chips.
Sep 22, 2010. 6:58 PMdustinandrews says:
P.S. if you need to burn the fuses on an atmega128 and you are using and external resonator:

avrdude -p m168 -c avrisp -b 19200 -P com4 -F -U lfuse:w:0xff:m -U hfuse:w:0xdd:m

If you don't burn any fuses your chip will run at 1mhz. You can tell because 1. The blink program will take 16 seconds to blink the light AND you can't program from the arduino IDE.

If you burn the wrong fuses, you can ruin your chip until you can get it into a high power (12v) programmer, so be sure before you burn fuses.
Sep 23, 2010. 10:51 PMdustinandrews says:
heh, still having problems. You can to burn the lock bits to keep from overwriting the bootload with the sketch. I haven't got that working yet... Moral of the story: atmega169p is $3.30, but problematic with Ardunio, just buy the pre-burned ones for $5.
Jul 9, 2010. 1:26 AMFast Eddy says:
I think I may be just being thick but ... I have two ATMEGA8-16PC chips that I want to put a bootloader on. I successfully execute this step (using "m8" instead of "m168") but how do I upload the bootloader correctly. I am confuse (as they say).
May 14, 2010. 11:37 AMDerin says:
In Arduino 0017 the avrdude.conf flie does not have anything like this:
id    = "avrisp";
  desc  = "Atmel AVR ISP";
  baudrate = 115200;    # default is 115200
  type  = stk500;

Apr 12, 2010. 12:04 AMesbit says:
Hi!

First of all: Great project :-)

You said, all we need is the chip, 3 leds and 3 resistors (and the arduino of course).
I understand the additional 10kΩ resistor to prevent the chip of resetting, but what are the two capacitors at pin 9 and 10 for? Can I omit them? If I need them, what value should I use for the capacitors?

Bye from Bavaria :-)
Apr 17, 2011. 8:42 AMesbit says:
Ahh, okay, this explains something :-) I didn't see the oscillator on the Fritzing-Graphic...
Because I get my oscillators not until friday, I tried without the caps and clock crystal, but when I try to test my attiny2313 with avrdude the heartbeat-led freezes and I get an "The programmer is not responding"-error. Same with attiny45 and atmega168...

Do all of the atmel chips (esp: attiny2313 and attiny25/45/85) work with an 16MHz oscillator?
Apr 13, 2010. 3:30 PMesbit says:
Hey, I might have found (can I say this in English :-p "might have found" sounds strange in german-school-english-ears ?!) the mistake, though I didn't test it, yet:

On the Fritzing-Graphic the Reset-Pin of the ic is connected (over the 10kΩ) to the ground -> the chip is nonstop resetting... Instead it should be pulled high to to the 5V, shouldn't it?

Well I will test it tomorrow and give feedback...

cya
Apr 13, 2010. 3:47 PMesbit says:
And I'm keeping replying to myself ;-)

Well I couldn't wait until tomorrow and gues what: I was right :-)! just connect the 10kΩ resistor to 5V instead of ground and everything is working fine!
But thanks to this mistake I learned myself a lot by reading all arduino sites in the web to solve the error ;-)
Feb 20, 2010. 11:45 AMTOCO says:
You can simply buy several atmega chips and pop them into your arduino and program them. Then you simply follow a breadboard arduino instructable. Granted this only works with a few types of chips that work in the specific arduino. This is a very good instructable though!

Sorry if that sounded mean I only wanted to say that to someone.
Mar 8, 2010. 1:06 PMTOCO says:
You can buy them online for like $5.50 with the boot loader already installed.
Mar 8, 2010. 3:33 PMivancho says:
I think paying people $2.42 extra to flash your chips is, well, wrong
Feb 25, 2010. 11:06 PMandy.parksie says:
is is possible to program a Arduino Duemilanove with an Arduino Mega?  Would it work in the same way?
Feb 14, 2010. 5:37 AM34nanana says:
Great stuff you did there with fritzing sketch.

Nevertheless it looks like the Atmega168 on the bread board is shifted on dot too far to the left. 
According to Atmega168 pinout, power should connect to pin 20(AVCC)
SCK to 19  (in your fritzing sketch  20)
MISO to 18 (in your fritzing sketch  20)
MOSI to 17 (in your fritzing sketch  20)

Apart from RESET connecting to pin 1 all the other are shifted as well.

Mar 7, 2010. 1:44 PMivancho says:
*!&^# .. I wish I'd seen your comment 2 hours earlier...
Mar 8, 2010. 3:45 PMivancho says:
they heated up quite a bit, but I don't think there's permanent damage... eventually I made it to the 328 datasheet and started counting..

In any case, thanks for the instructable
Feb 25, 2010. 12:51 PMwillrandship says:
This looks really handy for integrated projects!
Feb 14, 2010. 6:49 PMbrunoxyz says:
I wish I had found this earlier! thanks
Jan 31, 2010. 4:56 PMnadav says:
 does the it have to be an ATMEGA  with arduino bootloader?
Jan 25, 2010. 10:22 AMnadav says:
 if i do this can i still use my arduino as an arduino or will it mod it permanently?
ex:  can i still run the blink sketch after?
1-40 of 46next »

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
9
Followers
2
Author:kabturek
if you can't open - you don't own it