Servo anomaly when Uno powered via Vin

I’m trying to operate a sub-micro server (Servo - Generic (Sub-Micro Size) - ROB-09065 - SparkFun Electronics) from an Arduino Uno. When the Arduino is powered from the USB, everything operates normally. When I power the Arduino from three “123” batteries (3v x 3 = 9v) via the Vin port, it acts strangely.

For testing, I’m only using void setup() to move the servo. See code. When Arduino is powered from USB, I can see the servo go from 70 to 100 and back again to 70, just as it should.

However, when I disconnect the USB, and connect the batteries to Vin, the servo immediately jumps to over 100 (I don’t know the exact number), a second elapses, and then I can see the servo go from 70 to 100 and back again to 70. If I hit the reset button, the same events occur.

If I disconnect the batteries, and attach the USB, the nasty event just described happens, but only once. If I hit the reset button, the servo acts according to the code.

Thanks in advance for any help.

ServoCalibration.ino (1.15 KB)

Hi,

Try a delay before the Servo Attach.

Terry: Thx for the quick response. But no joy. The anomalous action of the servo happens the moment voltage is applied to Vin.

-- Dave

Additional information:

I disconnected the white (signal) lead, then reapplied voltage to Vin. The servo immediately went to the 100+ position, and stayed there. I’m hoping this information will help lead to a solution to my problem.


Dave

What are the servo power wires connected to?

If you want the servo to start at a known position then do the first write(70) BEFORE the attach().

But I have no idea why it behaves differently with the two different power sources.

Steve

Thanks for replies. Good to know there's folks out there that are willing to help out.

Three wires from servo: White (control) to Arduino 9 Black to ground Red to Arduino 5v

I was interpreting results incorrectly: Anomaly occurs with BOTH USB and external 9v power sources.

The servo moves THE MOMENT power is applied (either USB or 9v). However, and this is interesting, the servo moves FARTHER (100+) when the external 9v is applied than when the USB power is applied. It's not by much, but it is noticeable. It does this (either power source) even when the white control wire is disconnected.

Note that after this anomaly occurs after the power is connected, subsequent hits of the reset button on the Arduino result in normal operation. No anomalous movement.

Comment on suggestion of setting position before the attach: I tried this, no help. It's hard to imagine that the "write" would work, since, at that time, the control pin is undefined.

Thanks.

-- Dave

Almost all servo problems discussed on this forum are due to inadequate servo power supplies.

Never try to power a servo from the 5V Arduino output, as you can actually damage the Arduino.

Use a separate servo power supply. A 4xAA battery pack should be fine for 1-2 small servos, but budget 1 Ampere or more per servo for larger ones. Don't forget to connect all the grounds.

JRemington:

This micro servo (https://www.sparkfun.com/products/9065) should work OK, right? Sparkfun project here (https://learn.sparkfun.com/tutorials/sik-experiment-guide-for-arduino---v33/experiment-8-driving-a-servo-motor) shows the servo being operated from the Arduino 5v with no ill effects. When I was testing amperage draw, I saw 100mA when the servo was moving.

More testing: I pulled a new Arduino board out of the box, wired it up, so this was the only circuitry. Same results.

And one more test: I held two of the 3v batteries together, touched red wire to +, black wire to ground, and the servo jumped to the 100+ position. Sounds like we've ruled out everything but the servo! Is this normal operation for this micro servo?

Thanks again.

-- Dave

It may be worth connecting a pull-down resistor (perhaps 4k7 or 5k6) to the Servo signal wire to prevent it floating at startup.

...R

This micro servo (https://www.sparkfun.com/products/9065) should work OK, right?

With a separate battery pack, certainly.

When I was testing amperage draw, I saw 100mA when the servo was moving.

The stall current is 5 or more times higher, briefly drawn every time the servo starts moving.

shows the servo being operated from the Arduino 5v with no ill effects.

Sparkfun sells Arduinos, and will be happy to replace damaged ones!

You are posting because you are having power problems. Those problems will go away if you power the servo separately.

It may be worth connecting a pull-down resistor (perhaps 4k7 or 5k6) to the Servo signal wire to prevent it floating at startup.

Had high hopes for this suggestion. I tried this (by connecting 5 1000ohm resistors in series). No noticeable effect. Darn.

Those problems will go away if you power the servo separately.

Does this hold true, given the results of this test?

I held two of the 3v batteries together, touched red wire to +, black wire to ground, and the servo jumped to the 100+ position.

Thanks.

-- Dave

The test means that the servo electronics are basically functional, and in principle capable of controlling the motor position.

I’m inclined to agree with @jremington about the power source. The simple (and quick) test to eliminate the issue is to power the servo separately with a pack of 3 or 4 x AA alkaline cells. Make sure to connect the battery GND to the Arduino GND.

…R