I've come across an issue with my servos. Whenever I try to power a few servos at a time they seem to drift from their original position. It seems to happen with any code that tries to keep multiple servos in a certain position. I'm using TIANKONGRC and HEXATRONIX 9g servos. When I try to set any of the three servos to a position, for example 90 degrees it seems to drift a few degrees per second but it does it in sudden timed bursts. Does anyone know the solution to this problem?
Most of the servo problems reported on this forum are due to inadequate servo power supplies.
Use a separate 5-6V power supply, capable of supplying 1 Ampere per servo and connect all the grounds together. Never try to power servos or motors from the 5V Arduino output.
That seemed to help. I'm driving these servos to stabilize an rc plane so they will be driven by a lipo battery. You said to use a separate power supply for the servos so would that mean two separate batteries? If so is there a way to power the system with a single power supply?
Yes, you can use one battery to power all circuits, but in general, EE design skills are required to properly implement what is called "power supply decoupling".
The problem is that the motors introduce severe electrical disturbances into the power supply, which have to be removed or they will cause a microprocessor to reset, or actually damage sensitive electronics. You might be able to get away with adding a voltage regulator and large capacitor between the battery and the uP.
And, of course, the 5V output of the Arduino was never intended to handle motors or servos.
jremington:
And, of course, the 5V output of the Arduino was never intended to handle motors or servos.
Or anything really - other than sensors that draw little or no current and the odd indicator LED.
It is not really an "output" pin - actually the main power input or reference voltage.
The 5V pin is inout, both usable as an input (if Vin isn't used), or an output. There may be issues using it
as 5V input, dependent on board in question and which regulator it uses, but it seems to work for me.