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.

Step 1: 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
<p>Unpack the USBTinyISP firmware.</p><p>from where???</p>
<p>There is an alternative set of instructions that works if you have an Arduino Uno and want to transform it into an universal programmer for any stand alone AVR. Read this tutorial:</p><p><strong>&quot;Arduino Uno R3 as a true ISP programmer for any Attiny and Atmega AVR&quot;</strong></p><p>see:</p><ul> <br><li><a href="http://forum.arduino.cc/index.php?topic=317138.0" rel="nofollow">http://forum.arduino.cc/index.php?topic=317138.0</a><li><a href="https://app.box.com/s/ol1z8jjnrpy6wly4w61imt7wcbxk3fcg" rel="nofollow">https://app.box.com/s/ol1z8jjnrpy6wly4w61imt7wcbxk3fcg</a></ul><p>No boot-loader has to be first loaded into your target AVR. You can simply program the Attiny or Atmega micro-controllers, existent on the breadboard, directly with the hex file generated from the source code you wrote (Blink a led, for example).</p>
Hi, <br> <br>can you help me? <br>PC doesnt see my programmer. Everything is ok with wiring. I think i did something bad with firmware burning. <br> <br>As i understood i should insert hex from spi folder only or I should compile makefiles in 1 hex from all folder? <br> <br>Can u upload hex which you used?
Thanks for the ibble! Found it very useful for information programming an ATTiny85 (with slightly different board layout). Steps were largely the same. Cheers!
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.
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 .<br>btw great indestrustiabel
hello,<br>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. <br><br>Sorry for the noob question. This is my first attempt at programming a standalone chip!<br><br>Any help would be appreciated.<br>Thank you.
Hey,<br>thanks!<br>Look at the attiny13 datasheet:<br>http://www.atmel.com/dyn/products/product_card.asp?part_id=3175<br>On page 2 you've got te pinout for an atmega. You need these signals :<br>13 - SCK<br>12 - MISO<br>11 - MOSI<br>10 - RST (Reset)<br><br>on attiny13 they are on pins::<br>SCK is pin 7<br>MISO - pin 6<br>MOSI - pin 5<br>RESET - pin 1<br>GND is pin 4 and VCC pin 8<br>Connect them like this and you should be ready to go. Look at step 2.<br><br>Hope that helps.<br>
um looking for elevator avr program. Do you have example program ?
AHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH!!!!11!!!!<br><br>ONE FRIGGIN WIRE!!!!!!!!<br><br>(sorry)<br><br>I spent quite a while at this wondering where i went wrong (followed diagrams to the pin)<br><br>I didn't realize the reset resistor was supposed to be pull up, not pull down. Please fix the diagram.<br><br>Havne't gotten it working (yet) but made progress :)
Really sorry about that, i uploaded the new version some time ago but didnt include it in the instructable. <br><br>Whats your actual problem ?
Well its been fixed now, but the chip was in an eternal state of resetting with a pulldown resistor instead of a pullup one<br><br>I used the method in this video:<br>http://www.youtube.com/watch?v=7LskShrK4vQ<br><br>plus I used your tutorial for the actual programmer and stuff.
I wanted to use this to upload to an ATMEGA168p from Windows 7. <br> <br>Using a Pro Mini as the programmer and the Ardunio menu option to burn the bootloader I got an error. <br> <br>avrdude: Expected signature for ATMEGA168 is 1E 94 06 <br> Double check chip, or use -F to override this check. <br> <br>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. <br> <br>C:\&gt;avrdude -p m168 -c avrisp -b 19200 -P com4 -F -U flash:w:ATmegaBOOT_168_diecimila.hex <br> <br>avrdude: AVR device initialized and ready to accept instructions <br> <br>Reading | ################################################## | 100% 0.05s <br> <br>avrdude: Device signature = 0x1e940b <br>avrdude: Expected signature for ATMEGA168 is 1E 94 06 <br>avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed <br> To disable this feature, specify the -D option. <br>avrdude: erasing chip <br>avrdude: reading input file &quot;ATmegaBOOT_168_diecimila.hex&quot; <br>avrdude: input file ATmegaBOOT_168_diecimila.hex auto detected as Intel Hex <br>avrdude: writing flash (16294 bytes): <br> <br>Writing | ################################################## | 100% 2.50s <br> <br>avrdude: 16294 bytes of flash written <br>avrdude: verifying flash memory against ATmegaBOOT_168_diecimila.hex: <br>avrdude: load data flash data from input file ATmegaBOOT_168_diecimila.hex: <br>avrdude: input file ATmegaBOOT_168_diecimila.hex auto detected as Intel Hex <br>avrdude: input file ATmegaBOOT_168_diecimila.hex contains 16294 bytes <br>avrdude: reading on-chip flash data: <br> <br>Reading | ################################################## | 100% 22.43s <br> <br>avrdude: verifying ... <br>avrdude: 16294 bytes of flash verified <br> <br>avrdude: safemode: Fuses OK <br> <br>avrdude done. Thank you. <br> <br>I still need to test if it worked properly since I only have the pro-mini and some loose 168p chips. <br> <br>By the way, I omited the external oscilator. So it's not mandatory for these chips.
P.S. if you need to burn the fuses on an atmega128 and you are using and external resonator: <br> <br>avrdude -p m168 -c avrisp -b 19200 -P com4 -F -U lfuse:w:0xff:m -U hfuse:w:0xdd:m <br> <br>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. <br> <br>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.
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.
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 &quot;m8&quot; instead of &quot;m168&quot;) but how do I upload the bootloader correctly. I am confuse (as they say).
In Arduino 0017 the avrdude.conf flie does not have anything like this:<br /> <em> id&nbsp;&nbsp;&nbsp; = &quot;avrisp&quot;;<br /> &nbsp; desc&nbsp; = &quot;Atmel AVR ISP&quot;;<br /> &nbsp; baudrate = 115200;&nbsp;&nbsp;&nbsp; # default is 115200<br /> &nbsp; type&nbsp; = stk500;</em><br />
When i wrote the guide 0017 was the actual version and im sure it was there. search the file for &quot;avrisp&quot;
Hi!<br /> <br /> First of all: Great project :-)<br /> <br /> You said, all we need is the chip, 3 leds and 3 resistors (and the arduino of course).<br /> I understand the additional 10k&Omega; 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?<br /> <br /> Bye from Bavaria :-)<br />
hey,<br /> Thanks.<br /> the two capacitors are 22p for the crystal oscilator. it will probably work without them but its a good design to include them. You do need the 16mhz oscilator if you're going to program the chip on a breadboard. <br /> <br /> If you have a Ceramic oscillator (this one has 3 legs) you don't need them cause ceramic oscilator has them built in. <br /> <br /> the 16mhz oscilator (with the 22p caps) and reset resistor is used on the second soon-to-be arduino (Its the minimal number of needed components on an arduino)<br /> <br /> <br />
Ahh, okay, this explains something :-) I didn't see the oscillator on the Fritzing-Graphic...<br /> 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 &quot;The programmer is not responding&quot;-error. Same with attiny45 and atmega168...<br /> <br /> Do all of the atmel chips (esp: attiny2313 and attiny25/45/85) work with an 16MHz oscillator?<br />
Most of them work with 16mhz. but you don't have to use exactly 16mhz - its only used on the arduino after the fuses are burnt. when you only upload programs to attiny it runs with the internal oscilator (8mhz divided by 8). The important thing is to match the oscillator to the fuses that you burned<br /> <br /> HTH<br />
Hey,&nbsp;I might have found (can I say this in English :-p &quot;might have found&quot; sounds strange in german-school-english-ears ?!) the mistake, though I didn't test it, yet:<br /> <br /> On the Fritzing-Graphic the Reset-Pin of the ic is connected (over the 10k&Omega;) to the ground -&gt; the chip is nonstop resetting... Instead it should be pulled high to to the 5V, shouldn't it?<br /> <br /> Well I will test it tomorrow and give feedback...<br /> <br /> cya<br />
Hey, thanks! You're right, on my breadboard the gnd and 5v rails are switched and i wired it the other way in Fritzing.<br /> I'll update the drawings when ill be back home<br />
And I'm keeping replying to myself ;-)<br /> <br /> Well I couldn't wait until tomorrow and gues what:&nbsp;I was right :-)! just connect the 10k&Omega; resistor to 5V instead of ground and everything is working fine!<br /> But thanks to this mistake I learned myself a lot by reading all arduino sites in the web to solve the error ;-)<br />
Great stuff you did there with fritzing sketch.<br /> <br /> Nevertheless it looks like the Atmega168 on the bread board is shifted on dot too far to the left.&nbsp;<br /> According to Atmega168 pinout, power should connect to pin 20(AVCC)<br /> SCK to 19&nbsp; (in your fritzing sketch&nbsp; 20)<br /> MISO to 18 (in your fritzing sketch&nbsp; 20)<br /> MOSI to 17 (in your fritzing sketch&nbsp; 20)<br /> <br /> Apart from RESET connecting to pin 1 all the other are shifted as well.<br /> <br />
*!&amp;^# .. I&nbsp;wish I'd seen your comment 2 hours earlier...<br />
sorry for the confusion ivancho, hope your chips are ok :)<br />
they heated up quite a bit, but I&nbsp;don't think there's permanent damage... eventually I&nbsp;made it to the 328 datasheet and started counting.. <br /> <br /> In any case, thanks for the instructable<br />
ups, sorry for the mixup, these things are hard to catch up with all the work. the images are updates with the correction. thanks 34nanana<br />
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!<br /> <br /> Sorry if that sounded mean I only wanted to say that to someone.<br />
hmm Are you sure thats possible ? to burn the arduino bootloader on the chip you need a programmer (look in tools-&gt;burn bootloader menu for a list of supported programmers from the ide). the other way around is bit-banging with the serial/ftdi-usb interdace)<br /> <br /> np. every comment is welcome:)<br />
You can buy them <a href="http://www.sparkfun.com/commerce/product_info.php?products_id=9217" rel="nofollow">online</a> for like $5.50 with the boot loader already installed.
I&nbsp;think paying people <a href="http://avnetexpress.avnet.com/store/em/EMController?langId=-1&amp;storeId=500201&amp;catalogId=500201&amp;action=products&amp;N=0&amp;mfr=ATL&amp;term=ATMEGA328P-PU" rel="nofollow">$2.42 extra</a> to flash your chips is, well, wrong<br />
is is possible to program a Arduino Duemilanove with an Arduino Mega?&nbsp; Would it work in the same way?<br />
yeah it should work ok, nothing specific in the sketch. Just change the pins if necessery (dont have a mega so can't help much) do write if you succeed.<br />
or just use digital 1/0 and 5v. you will have to press reset before upload
i'm not sure what are you refering to :)<br /> i don't think you can flash a bootloader&nbsp; or program another avr chip that way:)<br />
the boot loader is already programmed just use the blink sketch<br />
i did it and it worked with a atmega 328/168 with bootloader<br />
This looks really handy for integrated projects!
I&nbsp;wish I&nbsp;had found this earlier! thanks<br />
&nbsp;does the it have to be an ATMEGA &nbsp;with arduino bootloader?
it probably should work with any arduino hardware with SPI. what board are you referring to ?<br />
&nbsp;if i do this can i still use my arduino as an arduino or will it mod it permanently?<br /> ex: &nbsp;can i still run the blink sketch after?
yes sure, just disconnect the wires and upload a new sketch. its just a sketch so the arduino acts as a programmer.<br />
&nbsp;Great! Thanks Great instructable!&nbsp;
This is a keeper!<br />

About This Instructable




Bio: if you can't open - you don't own it
More by kabturek:How to program a AVR (arduino) with another arduinoDIY Jewlery stand / hanger
Add instructable to: