Arduino external power source causes timing issues

arduinobuttonservovoltage-regulator

I was prototyping a project (basically a servo and piezo controlled by a button with some LEDs to indicate the state) everything was going fine. So I decided to take the project off the ardiuno board and test it on a breadboard before soldering up the components.

To do this I followed several tutorials for taking the Atmega328 off the arduino and mapping the pins to the crystal and caps and adding a power regulator. But when I try to power it via a 9v battery or a 5v wall wart it acts really weird. The servo responds, then does not respond – or randomly moves about – so it seems like I have a timing issue or my button state is fluctuating.

The thing is this only happens when powered through the "power regulator" I set up – a 5v regulator and some caps. If I leave the Atmega328 on the breadboard and I plug in my arduino board via USB to my computer and just run a wire from 5v and ground to my power rails everything functions perfectly.

I have checked the voltage on the power rails using a multimeter and it is 4.96 (so it is the correct voltage) – I thought it might be an issue with not converting AC to DC – but the same thing happens with a 9v battery. Does anyone have any idea what is going on?

Please help!!!

Best Answer

From the description of your problem, it sounds like the servo is causing a lot of problems with the regulation of the supply to the micro.

What I think is happening is that the servo when moving is causing either a lot of ripple/electrical noise on the supply to the micro or tripping the current limit on your regulator causing the supply to drop out (if only for microseconds - which would not be visible on a multimeter - you would need a oscilloscope to see this) - either of these can cause the micro to be very unpredictable.

I would suggest using 4 AA batteries to power the servo, and a separate supply to the micro to prove this (you only need a common ground or negative for it to work)

Just a simple question what are you using for your 5v supply - what is it's maximum current ? - servos can take a very high current (over 0.2 amps to 2-3 amps depending on rating of servo and how much effort it need to move)