0

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

keisi
  • 101
  • 1
  • 1
    A schematic would be helpful. – Kellenjb Jan 19 '12 at 21:33
  • The common thing between the 9V battery and the 5V regulator could be some noise added to the voltage, that in the battery may be caused by the voltage regulator (that you are obviously using, right? :D) that could be switching...i'm just arguing, tell us more – clabacchio Jan 19 '12 at 21:39
  • Yes I am using a voltage regulator. I do not have a schematic at the moment - I will try to create one tonight I was just wondering if there was any inside into what may be causing the problem. Should I just use a software like frizzing to make the schematic? – keisi Jan 19 '12 at 21:45
  • 1
    For schematics see http://electronics.stackexchange.com/questions/1024/good-tools-for-drawing-schematics – Kellenjb Jan 19 '12 at 21:51

2 Answers2

1

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)

  • I tried 3 different power supplies one was USB through the arduino which works great. The second was a 9v battery on the breadboard through a regulator which has problems, and the third is this wall wart (http://www.sparkfun.com/products/8269) also on the breadboard through a regulator which causes problems. – keisi Jan 19 '12 at 22:32
  • Sounds like your regulator is the common thread of failure and matching up with what wonko is talking about. – Kellenjb Jan 19 '12 at 22:37
0

You have probably solved this problem by now, but I managed to work around the same problem. My arduino uno working off a 12 volt DC wall wart would be able to time for short period say 20,000 - 40,000 milliseconds powered with wall wart, but for longer time periods, something would go wrong, and it would effectively freeze on the mode. My work around was to use a short time period for the delay function (say 20,000 ms) and embed this in a for loop to count the longer time period which you need. This is for a watering system, note the delay time is 20,000ms, and the watering time delay is 20,000*15 = 300,000 ms (5mins)

int doseTime1=20000;

//glass house on

digitalWrite(11,HIGH);

for(int ghouse = 0; ghouse < 15; ghouse++){

delay(doseTime1);
}

//glass house off

digitalWrite(11,LOW);

Hope this helps.

Null
  • 7,448
  • 17
  • 36
  • 48