Programming an ATMEGA168 with an Arduino Uno r3

As from title, I am trying to program an ATMEGA168 with my Arduino Uno.

I have found several tutorials on the net with all sorts of different details... but none really seems to work for me.

What I have done for now is:

  1. Upload the Arduino as ISP sketch on the board
  2. Wire the ATMEGA as suggested by this site: BioPhysEngr Blog: Writing sketches to a ATmega328 pre-loaded with the Arduino Uno bootloader using an Arduino Uno and ArduinoISP

Pin 1 to Arduino reset pin, through a 10K resistor, with a 22uF capacitor to avoid automatic resetting of the board
Pin 7 and 20 to 5V
Pin 8 and 22 to GND
Pin 9 and 10 connected to a 16MHz crystal with a 22pF capacitor on each end

Arduino pin 10 to ATMEGA Pin 1
Arduino pin 11, 12, and 13 to ATMEGA Pin 17, 18, and 19 respectively

Like this:

  1. Now I open a sketch, for instance the Blink example (I added a LED to pin 19 of the ATMEGA in order to test if it is working), select "Arduino as ISP" as programmer from the Tool menu and upload the sketch.

I get a "Done uploading" message, with this error:
avrdude: stk500_getsync(): not in sync: resp=0xe0

Needless to say, the LED does not blink...

I am fairly new to all of this, so any solution or even hint would be much appreciated.

The blue wire connecting the programmer's RESET to the target's RESET is wrong. Remove it.

The capacitor is connected between RESET and GND only on the programmer (your Uno).

Your use of colour is very confusing. Normally red is for +5V and black is for Gnd. You have them backwards.

Here is my setup:

And to program:

Your use of colour is very confusing. Normally red is for +5V and black is for Gnd. You have them backwards.

Boy what a stick in the mud conventionalist you have become. :wink:

Free your mind, let the colours express themselves in their operation not their appearance I say. :smiley:

Lefty

There is no spoon colour.

Really? I'm fairly new to this, always thought it was the other way around... don't know why, but it doesn't really matter, at least I'm consistent!

Anyway, back to the question. First of all thanks for spotting the wrong connection, not sure why I put that... I guess that was the result of too much thinkering...

So I don't need to add the clock when programming the ATMEGA or it was just not in your photos for other reasons?

Thanks for taking the time to help a noob :slight_smile:

In any case, with or without crystal the sketch always gets uploaded to the Arduino and not on the ATMEGA168, even if I choose "Arduino as ISP" as a programmer.

This site http://www.open-electronics.org/arduino-isp-in-system-programming-and-stand-alone-circuits/ suggests adding a new entry in the boards.txt file, I am trying to do that but with not much success, as I continue to get this error:

avrdude: Yikes!  Invalid device signature.

Any ideas?

Are you selecting "Upload Using Programmer" not just "Upload"?