I have a question about servo motors. I currently have 5 servo motors in parallel (4 of them draw up to 250mA, one is bigger and draws up to 350mA, all require 5V). I have an AC->DC converter source which converts 220V AC (EU standard) to 5V DC current (max 3A). There's also five potentiometers, one for each servo. In my script I read in the analog values of every potentiometer, map it to a 170 degree range (already in an attempt to stop vibrations, as moving them beyond 170 makes them vibrate) and then write these values to my servo (I also included some smoothing to this, so not every miniscule voltage change requires a servo displacement).
When I upload my script and only include the write command for one servo, the circuit works fine. Same goes for two and three servos. The issues start when I include four or five servos, that's when they all start vibrating. My question is if it's a script-related issue, or is it a circuit related issue, which could be fixed by placing a capacitor in parallel with the servos? (If so, what value should I use?)
Servos can draw over an ampere when straining or starting to move, so your power supply should be capable of supplying at least 5 amperes, for 5 servos.
Oh, but the box said it only goes 240mA max (not 250, my bad). Buying another source at this stage is kind of expensive, are there any other workarounds I can implement through coding or cheaper parts?
Jarn:
My question is if it's a script-related issue, or is it a circuit related issue, which could be fixed by placing a capacitor in parallel with the servos? (If so, what value should I use?)
As jremington pointed out your power supply probably isn't supplying enough current. A better power supply is the obvious solution but there are a few things you can do to try to get the supply you have to work better. Capacitors would likely help. A few hundred to a couple thousand microFarads would probably help. A ferrite ring with the power lead of a servo looped around a few times would also probably help tame the jitters.
Once the power supply issues are solved, you can smooth the motion of the servos by using writeMicroseconds rather than write. See this thread about using writeMicroseconds.
Think about what a DC motor actually is - its a piece of copper wire wound round a small armature. The
resistance of this wire is a few ohms or so, its designed to be as low resistance as possible. Stall currents
are normally 5 to 20 times the rated current for most motor types, otherwise the power would
mainly go into heating the windings (at stall 100% of the power heats the windings by definition). So
you always see peak currents much larger than continuous operation currents (except for stepper
motors)
A servo isn't just a motor, its a motor controller as well, so the power has to hold up during the current
peaks or the controller part will drop out / reset. So hobby servos require a supply that can provide the peak
currents without drooping much - typically a NiMH battery or LiPo battery are assumed to be powering
them (they are made for RC models remember), so a couple of amps isn't usually an issue.
Do you have a link to the servos you have? Note the 5v is the bottom end of the usual recommended 4.8v-6v voltage range for hobby servos. Have you measured the power supply voltage while the servos are vibrating? Does just one servo jitter when connected? Servos will vibrate when driven against their internal hard stops (which should be avoided). Do you have the servo grounds connected to the arduino ground?
Hi,
What you have to remember is that even though a servo may have reached the position it is commanded to do, if the shaft is turning against a load or torque it will still continue to consume current.
I implemented a 4700uF capacitor in parallel with all five servo motors, and lo and behold; the jitter has disappeared! Guess it was just those peak currents the power supply couldn't handle which are now handled by the capacitor, and everything works flawlessly. If anything else goes wrong again I'll keep your pieces of advice in mind, though. But for now, thank you for helping me!