Pages: [1]   Go Down
Author Topic: Breadboarding atmega328 yields unexpected behavior (newb needs help)  (Read 1002 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.


* atmega328 breadboarded.jpg (911.51 KB, 2592x1944 - viewed 29 times.)
« Last Edit: January 20, 2013, 11:13:02 pm by justanotherhumanoid » Logged

Grand Blanc, MI, USA
Offline Offline
Faraday Member
**
Karma: 71
Posts: 3494
CODE is a mass noun and should not be used in the plural or with an indefinite article.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Might try the attachment again, glad I've never forgotten an attachment smiley-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!
Logged

MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

Global Moderator
Boston area, metrowest
Online Online
Brattain Member
*****
Karma: 434
Posts: 23593
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
« Last Edit: January 20, 2013, 11:29:20 pm by CrossRoads » Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Grand Blanc, MI, USA
Offline Offline
Faraday Member
**
Karma: 71
Posts: 3494
CODE is a mass noun and should not be used in the plural or with an indefinite article.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

Grand Blanc, MI, USA
Offline Offline
Faraday Member
**
Karma: 71
Posts: 3494
CODE is a mass noun and should not be used in the plural or with an indefinite article.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?



* reconfig1.jpg (1382.2 KB, 2592x1944 - viewed 29 times.)
« Last Edit: January 20, 2013, 11:52:43 pm by justanotherhumanoid » Logged

Grand Blanc, MI, USA
Offline Offline
Faraday Member
**
Karma: 71
Posts: 3494
CODE is a mass noun and should not be used in the plural or with an indefinite article.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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!
Logged

MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

Offline Offline
Sr. Member
****
Karma: 9
Posts: 296
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Grand Blanc, MI, USA
Offline Offline
Faraday Member
**
Karma: 71
Posts: 3494
CODE is a mass noun and should not be used in the plural or with an indefinite article.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Suggest reading through this and building the simple LED-and-resistor circuit:
http://www.sciencebuddies.org/science-fair-projects/project_ideas/Elec_primer-simplecircuit.shtml#summary

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.
Logged

MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.


* IMG-20130120-00030.jpg (1660.99 KB, 2592x1944 - viewed 19 times.)
« Last Edit: January 21, 2013, 12:12:59 am by justanotherhumanoid » Logged

Grand Blanc, MI, USA
Offline Offline
Faraday Member
**
Karma: 71
Posts: 3494
CODE is a mass noun and should not be used in the plural or with an indefinite article.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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!
Logged

MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

0
Offline Offline
Sr. Member
****
Karma: 6
Posts: 383
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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  smiley-wink


Logged

Pages: [1]   Go Up
Jump to: