Breadboarding atmega328 yields unexpected behavior (newb needs help)

Hello all, new user here, looking for some help and possibly an explanation of what I'm doing wrong.

What I'm trying to do is simply remove a atmega328 from an arduino uno r3 and put it on a breadboard, without any need to program it after that.

I decided to start simple and put "blink" on it before pulling it off and putting it on the breadboard. So, this chip was working just fine, running blink on pin 13 on the uno. Good start.

I followed directions found in these forums, got a 16Mhz crystal, 2x 22pF caps, connected power via a 5v switching regulator, and tied the reset pin high with a button to bring it low for reset. A photo of how I set it all up is attached.

Somehow, though, after pulling the chip off and placing it in what seems to me like identical circumstances, the LED on pin 13 just stays on/high and never blinks. I've checked my wiring (though I suppose it could still be incorrect), looked around the forums, and haven't seen anything quite like this behavior.

Open to any ideas/advice on troubleshooting this. Thanks in advance for the help.

Troubleshooting steps I've taken already:

  1. Tried a different chip (bought another with optiboot, put blink on it, and replaced). No joy.
  2. Tried removing my switch and just connecting 5V to RESET via 10kOhm resistor, bringing it low for reset by touching it to ground for a sec.
  3. Checked connections and power with multimeter.

I don't have the decoupling capacitors I've seen mentioned a few places because I figured maybe I don't need them because of the 5v 1000ma store-bought supply I'm using - is that true?

Thanks again in advance. Looking forward to your thoughts.

Might try the attachment again, glad I've never forgotten an attachment :wink:

Really should use 100nF caps on the power pins of all digital ICs, although I doubt in this case that their absence is the cause of the trouble.

I wasn't sure about the first description of the reset switch, the description under troubleshooting steps is the correct way to connect one, 10K resistor from the Reset pin to Vcc (+5) and the switch from the Reset pin to ground.

Edit: Got the pic now!

Put a resistor in series with the LED as well before you damage the pin.
You look to have excessive wiring on the reset switch as well. Go with just the resistor to +5 for now.
Try it without the 22pF caps as well. Folks sometimes get the wrong value by mistake (wrong part delivered) and that keeps the crystal from oscillating.

The reset switch is wrong. As long as you don't push it, things should be ok, but when you push it it will directly short the +5V supply to ground. The way the 10K resistor is plugged in, both leads to the same row of pins on the breadboard, means it has no effect. The reset pin is connected directly to 5V, which won't hurt the chip but is an incorrect reset circuit. Put the resistor from the reset pin to +5, and the switch from the reset pin to ground. The resistor is more than sufficient to keep the pin at 5V, but when the switch is pressed, the reset pin is grounded, and only about half a milliamp flows through the resistor and the switch.

Those little tact button switches aren't rated for all that much current, if you have an ohmmeter, I'd check it out, shorting out a 1A supply with it may have had a detrimental effect on the switch.

Ahhhh you have the crystal pins grounded! Do you understand how the holes in the breadboard are connected to each other?

Okay, made the recommended changes (reset to +5v via 10kOhm resistor and putting resistor in series with LED) and attached new pic. I thought the crystal was hooked up properly, though - I've got the crystal across X1-X2, then a 22pF cap to ground from X1 and X2 as well. Is that incorrect? Should be able to see what I'm talking about in the new photo. How should this be hooked up if that's what I did wrong?

Still getting the same behavior - LED stays lit up and never blinks. Thoughts?

You're not understanding how breadboards connect things, you've made the same mistake with the LED current-limiting resistor as you did earlier with the reset pullup resistor, putting both leads in the same row does absolutely nothing, the resistor is not even in the circuit that way.

Pull out the two black wires that go from the X1 and X2 pins to ground and report back!

justanotherhumanoid:
Okay, made the recommended changes (reset to +5v via 10kOhm resistor and putting resistor in series with LED) and attached new pic. I thought the crystal was hooked up properly, though - I've got the crystal across X1-X2, then a 22pF cap to ground from X1 and X2 as well. Is that incorrect? Should be able to see what I'm talking about in the new photo. How should this be hooked up if that's what I did wrong?

Still getting the same behavior - LED stays lit up and never blinks. Thoughts?

Yikes... here's what, unhook everything, then get a multimeter and get familiar with the internal connections of your breadboard. See which set of holes are connected to one another. -- then you'll see how you currently wired your breadboard doesn't make sense.

You're basically treating it's holes as holes of a PCB, and you expect it to read your mind.

Suggest reading through this and building the simple LED-and-resistor circuit:

Your 5V supply will work fine, in fact probably preferable to use that rather than a 9V battery.

Resistor value is not critical, anything between 220 ohms and 1000 ohms will be fine, the LED may not be real bright with 1000 ohms.

Jack, fellas, thanks for the fast responses, solved in record time! It's blinking away happily. It was definitely due to the incorrect wiring, stemming from my lack of understanding of breadboard connections. In retrospect, the way I had things hooked up really didn't make sense, and I'm lucky I didn't cook anything.

Thanks again so much for the help. Have a good night, and rock on.

Hey, good deal! That last picture looks much better! One more improvement would be to shorten the wires from the X1 and X2 pins to the crystal loading capacitors. The oscillator is a very low power (i.e.sensitive) circuit, and the shorter the leads (and hence the lower the stray capacitance) the better. Just touching the X1 pin can be enough to stop the oscillator (try it, use a short piece of wire with one end stuck in the breadboard). I like to leave the leads on the capacitors a little longer so they can plug directly into the ground rail, as in this picture. Also note I have three 100nF bypass capacitors placed as close to the chip as possible, one from Vcc to GND (pins 7 and 8 ), one from AVcc to GND (20 and 22) and one from AREF to GND (21 and 22).

But you got it working and I can't knock success, welcome to the forum!

I am always amazed at the resilience of the 328 chips. He tried hard to 'smoke' it but failed.

The other day I ran a breadboard Arduino at 8.5 volts. It actually ran with a tendency to reset occasionally. Some supplier sent me some 15v regulators mixed in with the 5v parts I ordered.
After replacing the offending part, the 328 ran just fine with no sign of post traumatic stress disorder :wink: