I'm encountering an issue with an ATmega328P circuit when using a 12V to 5V voltage regulator Texas Instruments LM1117MPX-5.0-NOPB.The setup includes the ATmega328P, three LEDs, a crystal oscillator with two 22pF capacitors, a 10kΩ resistor, and the mentioned voltage regulator. My power source is a bench power supply providing 12V. Here's a schematic of my configuration:


At input voltages of approximately 8-9 volts, the circuit performs as expected: the regulator outputs a stable 5V, and the microcontroller correctly drives two of the LEDs. However, issues arise when the input voltage reaches the 10-12 volt range. The ATmega328P starts behaving unpredictably with LED patterns becoming inconsistent—unexpected LEDs light up, all LEDs may light up simultaneously, or the intended LEDs fail to illuminate. Despite these issues, the output voltage from the regulator remains consistently at 5V. Subjecting the ATmega328P to these conditions multiple times ultimately results in the microcontroller becoming unresponsive, necessitating a reflash of both the application code and the bootloader.

Interestingly, this circuit worked flawlessly on a breadboard, but the problem emerged after transitioning to a soldered board. Additionally, I discovered that introducing an additional load in parallel on the 12V line (in this case, a CPU fan) mitigates the erratic behaviour. Despite adding decoupling capacitors to both the input and output sides of the regulator, the issue persists.

Has anyone encountered similar instability with voltage regulators and microcontrollers? Any insights or troubleshooting tips would be greatly appreciated.

  • 1
    \$\begingroup\$ How many capacitors do you have in the circuit, and where are they located? "Despite adding decoupling capacitors to both the input and output sides of the regulator, the issue persists" - how much capacitance? "the output voltage from the regulator remains consistently at 5V" - as determined by what? (multimeter or oscilloscope?) What current limiting resistors are you using for the LEDs, and what is their typical forward voltage and current rating? Are the second GND and AVCC really not connected? \$\endgroup\$
    – Attie
    Mar 9 at 22:34
  • 2
    \$\begingroup\$ "A minimum of 10-µF tantalum capacitor is required at the output to improve the transient response and stability." -- the datasheet (you can use standard aluminium electrolytic too) \$\endgroup\$
    – bobflux
    Mar 9 at 22:54
  • \$\begingroup\$ thank you for your comments guys, i am learning lots here. I did have decopling capacitors but I realized they are much smaller than what the datasheet recommends (0.10 nF used vs 10 µF required), so i'll be switching those (should they be for both input and output of regulator?). I don't have an oscilloscope, just a multimeter. sorry, yes the second GND is connected, but AVCC is not. For LEDs, I have no resistors at the moment, should i measure the current draw on them? i know they have 2.7 v going through them when they're on. \$\endgroup\$
    – sam prince
    Mar 9 at 23:06

1 Answer 1


Yes, this has been encountered by many people.

Regulators and microcontrollers do not work stably without bypass caps.

That is why bypass caps are needed in every circuit, and they should be added as per datasheet examples.

But your AVR has likely many more problems working properly, not just that it's being powered by an unstable regulator.

Half of the AVR is unpowered, and there are no resistors for the LEDs.

  • \$\begingroup\$ excuse my ignorance, i think i have alot to learn here, so thank you for your response. I have previously added a decopling capcaitor to the output of the regulator, but i just realized its a lot smaller than whats written in the datasheet (0.10 nF used vs 10 µF). would i need to have those on both the input and output of the regulator? in terms of the LEDs, i don't have any resistors, should i put 150 ohms on each led? what are those for? could they cause the current behaviour? or is just for protecting the LEDs? also what do you mean by half AVR is unpowered? \$\endgroup\$
    – sam prince
    Mar 9 at 22:58
  • \$\begingroup\$ @samprince No, 0.10 nF will not work. And bypass caps are needed on regulator input and all power supply pins of the MCU. And you have only connected one supply and one ground pin of the MCU, not all of them, so half of the MCU innards are unpowered because you did not connect all power supply and ground pins. And LEDs cannot be directly connected to MCU without resistors. It literally reads in every example how to connect LEDs to MCUs. All these could cause the non-working behaviour or damage MCU permanently. \$\endgroup\$
    – Justme
    Mar 9 at 23:05
  • \$\begingroup\$ @samprince The MCU outputs 5V to LED but the LED might work only at 2V. So it will draw too much current and it can be too much for the LED and MCU and exceed maximum ratings of MCU and LED and they may permanently damage. \$\endgroup\$
    – Justme
    Mar 9 at 23:06
  • \$\begingroup\$ great thank you, i will try your suggestions. any reason why this behaviour didn't occur on the breadboard vs transferring that into a soldered board? \$\endgroup\$
    – sam prince
    Mar 9 at 23:22
  • \$\begingroup\$ @samprince No clue, but using a breadboard without soldering versus soldering components on a PCB you have not shown are two completely different scenarios. The breadboard may be better or worse than your PCB design, depending on your PCB design. \$\endgroup\$
    – Justme
    Mar 9 at 23:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.