So I am trying to build a standalone circuit using the Atmega 328p. After uploading the code using Atmel Studio and AVRDude I get no response from the circuit; however, when I take the Atmega and put it on an Arduino board I can verify that the code uploaded works. Can anyone shed light on what I may be doing wrong?

Here is what I have so far:

  1. I am using a 16Mhz crystal with 2 22pF capacitors
  2. An LED which verifies that Atmega is powered on
  3. I am using a USBAsp clone programmer

I took an image of the circuit I have below.


  • 2
    \$\begingroup\$ Sigh. Bypass Capacitors. (Note: I'm principally exasperated at any tutorial you're following that doesn't mention the requirement for bypass caps, not you.) \$\endgroup\$ – Connor Wolf Nov 25 '14 at 9:40
  • 1
    \$\begingroup\$ Also, I do not see any resistor inline with the green LED, so you may have blown the LED. You need a current limiting resistor for every LED! The ATmega can generally drive 40 mA, and most T 1 3/4 LEDs are rated to 20 mA max. \$\endgroup\$ – Connor Wolf Nov 25 '14 at 9:43
  • \$\begingroup\$ Are you sure you've got the reset tact-switch right? Remember that the four pins are permanently linked in two pairs. The two pairs are shorted together when you press the switch. \$\endgroup\$ – John Honniball Nov 25 '14 at 13:49
  • \$\begingroup\$ Well I know that the LED is working since I have tested it directly with the with the power pins. I followed a tutorial when wiring the pins for the reset switch and as of now I am using the programmer to power the atmega. Anyways, if the tutorial was wrong can anyone point me to a tutorial that would show me how to correctly wire this circuit? \$\endgroup\$ – user40699 Nov 25 '14 at 15:45
  • \$\begingroup\$ I recently was doing something similar. I checked and re-checked everything until I found out I had the brown out fuse set too low. Make sure you are using 5v or have the appropriate brown out settings. \$\endgroup\$ – tehwalris Dec 15 '14 at 1:00

Remove the LED and use either an oscilloscope or a voltmeter to examine D13. Do you see it pulsing up and down? If so, then the LED isn't working. As @Connor Wolf said above, you need a current limiting resistor in series with the LED to protect both the LED and the controller pin from excessive current.

If the pin doesn't pulse, then try pulsing a different pin to see if you've blown the D13 pin.

If you do have a scope, check for oscillation on the two crystal pins (use a high impedance scope probe to do this). If you don't see that, then it's possible the crystal is the wrong kind. You need to match its load capacitance up with the loading caps. See this article.

Lastly, I would not connect AREF to Vcc. If you want a Vcc analog reference, you use analogReference(DEFAULT). AREF should - for production circuits - have a decoupling cap to ground and/or be fed a reference voltage (selected via analogReference(EXTERNAL)). If you're not using it, then you can let it float.

I've done what you're trying to do, and it does work. There's nothing obvious that you've missed.

| improve this answer | |
  • \$\begingroup\$ If the crystal wasn't working then the programmer wouldn't be able to talk to the chip at all (assuming the fuses were set to use it). \$\endgroup\$ – Ignacio Vazquez-Abrams Dec 14 '14 at 21:42
  • \$\begingroup\$ Didn't he say he took the chip out of the breadboard and stuck it in an Uno to program it? \$\endgroup\$ – nsayer Dec 15 '14 at 2:07
  • \$\begingroup\$ To test it. He used a USBasp clone to program it. \$\endgroup\$ – Ignacio Vazquez-Abrams Dec 15 '14 at 3:07
  • \$\begingroup\$ Then you're right, and I stand corrected. Either the crystal works or the controller isn't fused to use it, otherwise the USBasp wouldn't work. \$\endgroup\$ – nsayer Dec 15 '14 at 6:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy