Atmega328P-PU on breadboard does not work [SOLVED]

I have set up an Atmega328P-PU chip on a breadboard as directed on Arduino - Setting up an Arduino on a breadboard

The blink sketch is already loaded on the chip and is working when I inserted in on an Arduino Uno board. But when I transfer it back to the breadboard, its not working.

Hi

Is there a chance that LED has been fried as it has no current limiting resistor in your image?

Geoff

I dont see led limiting resistor.
Neither decoupling caps.
Are both sides of the breadboard connected?

Put a 0.1uf ceramic cap between power and ground, right next to the pins, on each side. I am disappointed in how many guides omit this; it is not optional. Without this, chip operation will not be reliable - random failures, resets when it tries to switch something, etc.

Recheck all connections - breadboards are notoriously flaky, and get worse with age. Literally, every time a friend shows me something on a breadboard, they always spend 5-10 minutes trying to find the loose wire before it works, while I make fun of them. That breadboard looks like it's been used for a decade by students in an electronics class. Check continuity with a multimeter.

Ensure that the Vcc and Gnd rails on either side are connected to those on the other side (some breadboards have this done internally, others don't)

Of course, as noted above, if the connections to the breadboard are making contact, you've likely burned out the LED.

Thank you all for your replies.

I added the resistor and decoupling capacitors as suggested but sadly it still doesnt work. And yes both sides are connected.

I have also shifted the chip to a fresher looking part of the board and checked the rails for continuity. Everything seems to be ok but is still not working and the led is not fried (as shown in the second image).

Will wait for your replies again.

I suspect about the caps on the crystal, are they 22pF ? Is your crystal 16 mhz?
You could try with 18pF caps, because breadboard adds parasitic capacitance.

Also have you checked the ATmega328 still works ok when put back in the Uno? You probably overloaded it that one time you had the LED connected with no resistor, and would not be a bad idea to double check.

Yes the caps are 22uF (they are marked 22). And the crystal is 16 mhz. I dont have any 18uF around, will try to get it.

Yes the chip works fine when put back in the Uno board.

Strangely, when removing the one of the two 22uF caps, the led starts to blink, but the frequency is about 3 seconds (i.e stays off for 3 seconds and on for 3 seconds) while it is supposed to be at 1 second.

I removed the other 22uF cap and it is still working and it works as intended and the blink frequency is at 1 second.

Now i reinsert one of the caps and it blinks at 3 seconds again. If i reinsert the second cap, the led stays at the last state, i.e if i insert the second cap while the led is off, it stays off. If I insert the cap while the led is on, it stays on.

bigslo:
Strangely, when removing the one of the two 22uF caps, the led starts to blink, but the frequency is about 3 seconds (i.e stays off for 3 seconds and on for 3 seconds) while it is supposed to be at 1 second.

I removed the other 22uF cap and it is still working and it works as intended and the blink frequency is at 1 second.

Now i reinsert one of the caps and it blinks at 3 seconds again. If i reinsert the second cap, the led stays at the last state, i.e if i insert the second cap while the led is off, it stays off. If I insert the cap while the led is on, it stays on.

The problem is what I expected, the breadboard is adding cap, not allowing the crystal to start up.
Try with the 18 pF caps.

bigslo:
I removed the other 22uF cap and it is still working and it works as intended and the blink frequency is at 1 second.

This has been reported numerous times in the past.

The breadboard itself has sufficient capacitance to provide the (full) loading capacitance for the crystal.

Don't bother trying to add loading capacitors for now. Or just 5 to 10 pF. If and when you actually make a PCB, you will have to include the correct loading capacitors.

Now it is worth keeping in mind that all the other pins also have this loading capacitance present, so if you were to be prototyping things such as the "capsense" library functions - or any other crystal or RF oscillator - it would matter.

Thank you all.

I will keep that in mind and if i make a pcb, i will add the caps again.

I'll mark this thread as solved now.