i have to servos (4,8V), drawing power from the 5V-pin. the servos are supposed to turn clockwise, stop for a second and turn counterclockwise. (loop). when powering the arduino via USB the servos do exactly what they are supposed to do, when switching to a 9V-battery (power is managed by arduino, no direct supply) they decide to go only in one direction (they stop like they are supposed to, but then start going again in the same direction as before).
i measured the output of the 5V-pin on the arduino using the battery and USB.
USB: ca. 280mA Batt: ca. 300mA
since that was the only difference in the setup i could spot, i thought it might be the cause, but it doesn't look like it.
any thoughts why this is happening? any hint or guess is appreciated.
It's possible the battery voltage is dropping too low under the load of the two servos and causing the Arduino to reset. Try monitoring the voltage while running the sketch.
Your current measurements, were they taken with the meter in series between the 5V pin and the positive supply terminal on the servos?
my measurements were taken without anything draining power from the arduino. i've tried it now with the servos connected and running but noticed that it's impossible to measure mA without draining all of it. the servos just stop and the power-led of the arduino goes dark.
since the servos are still doing the correct interval (1 second on, 1 second off) i doubt that the arduino resets. another hint would be that the servos move at random when powering the board up for the first time which they are not doing once powered up.
had the idea to pipe the output of millis() to serial but then i would be using USB as a powersource again (was doing it allready when i discovered the major flaw in my plan :)).
I'll try to write to the internal memory to determine if the little f*cker resets and get back to you.
EDIT: eeks, just noticed you wrote voltage ... should've read your post more carefully.
Servos moving: 3,4V
Servos stopped: 5,0V
it never dropped to zero, though my multimeter is autoranging and therefore kinda slowish so i might have missed it. really improbable though.
also i have no realy experience with electricity, but i thought that the voltage shouldn't differ when devices are drawing power but ampere is the one that "gets consumed".
since i took a measurement that states my assumption is (at least partially) wrong i am kinda lost.
batteries arent perfect, they have internal resistance. so its like as if a resister was inline with the battery. the more current you draw the lower the voltage sinks. and amperage is something thats drawn by a load, not provided. you measure the amperage something is drawing by wiring the meter in series with the load. not in parallel, that just shorts it out. also, im pretty sure 3.4. volts isnt enough. you need 5 volts for reliable operation. why not try parallelling up some batteries?
9v batteries are really terrible sources for any sort of "big" current like you'll pull with a servo. Replace that with a bunch of NiCad cells or something else made for the job and see if your problem continues.
Indeed. And keep in mind most RECHARGEABLE batteries, AA, AAA, etc... can often not have the power required to run the two, they hold a much lower charge than store bought.
A battery from a remote control car with a battery charger would probably be your best bet, so you won't need to worry about building a circuit for charging the battery.
most RECHARGEABLE batteries, AA, AAA, etc... can often not have the power required
It really depends on the type of rechargeable battery - NiCad are cheap, easy to get, have decent capacity, and can sustain extremely high current (tens or hundreds of times more than a few servos will draw.) That's why, as you mentioned, they are often the choice in R/C vehicles.
PS - I think it's important to differentiate between the capacity of a battery (mAh, milliamp-hours) and the current draw it can sustain (mA). 9v batteries are poor in both respects - iirc, most manufacturers rate them for 50mA sustained current draw, and around 150mAh capacity. Versus a good C-size NiCad battery, which might be able to sustain peaks of 100A (100,000mA) draw, and have 1000mAh capacity. The only real advantage of a 9v battery is that you get 9v in a small package - creating the same 9v source out of C-size NiCad cells would take 8 cells.