A problem controlling multiple servos.

Hello everyone! I'm a second year mechatronics student, and this is my first Arduino project. I'm building a quadruped walker that can either be RC controlled or autonomous (basic collision avoidance). I have built a prototype body for testing the program, and this is the result:

Before testing the servos are manually set in "sleep" position. This is what the program is supposed to do:

void loop() 
{
reset_pos();//set all the legs in their normal position
delay(1000);
servoA1.write(posA1+45);
delay(1000);
servoA1.write(posA1-45);
delay(1000);
}

The problem: Servos start twitching when there are multiple servos operating. I use external Li-Po battery and the voltage is regulated to 5V. The wiring is a mess right now but getting the program work is a priority right now.

Parts:

  • 12x EMAX ES3154 17g digital servos with metal gears and bearing
  • Arduino Leonardo
  • Firefox 7.4V 1600mAh 20C lipo battery (will be replaced by Dualsky 7.4V 1750mAh 45C lipo battery)
  • 3mm plywood for prototyping

Servos start twitching when there are multiple servos operating

That code uses delays, using delays is not a good way when you have multiple things to do.
See the blink without delay example in arduino IDE for how to remove delays.

The problem: Servos start twitching when there are multiple servos operating. I use external Li-Po battery and the voltage is regulated to 5V. The wiring is a mess right now but getting the program work is a priority right now.

Sounds like a possible low power issue. The power to the servos should be closer to 6v than 5v for best performance. How are you regulating the voltage from the batterys?

@zoomkat

How are you regulating the voltage from the batterys?

I would assume a 7805 regulator.

@Treg

That code uses delays, using delays is not a good way when you have multiple things to do.
See the blink without delay example in arduino IDE for how to remove delays.

I agree with Mike, you should look into that example, it will definitely help you, and with any other projects.

Ok, I tried to use 4x AA batteries to drive three servos at the same time and it worked! The problem was low signal voltage I guess. The servo specs said they were for 4.8-6V, and the regulator gave steady 4.97V that I used to power all the servos. The funny thing is that I could run three Futaba S3003 servos @5V without problems.

After short googling:

http://www.petitrc.com/Tech/RCCA_DigitalServoGuide.htm:
Plastic gears or metal gears?
When you shop for a servo, its gear is one of the first things you should consider. Servo gears are typically made of molded plastic or machined metal (brass or aluminum alloy). As you’d expect, plastic gears are much cheaper to produce than metal gears, but they aren’t as strong. Certain manufacturers offer a servo in both plastic and metal versions, and the plastic one almost always has a lower torque rating. But there’s one area in which a plastic gear excels—low radio frequency (RF) noise. When metal parts move against one another, they generate RF noise, and an electrically “noisy” servo can cause glitching. This is why many top drivers use plastic-gear throttle servos in their vehicles.

Looks like metal gears have their downsides. Do I need to wrap the whole thing in tinfoil? :stuck_out_tongue:

Ok, I tried to use 4x AA batteries to drive three servos at the same time and it worked! The problem was low signal voltage I guess. The servo specs said they were for 4.8-6V, and the regulator gave steady 4.97V that I used to power all the servos. The funny thing is that I could run three Futaba S3003 servos @5V without problems.

It's not about the voltage directly, but rather the current demand that the servos are drawing. Servo companies do a poor job of listing the maximum current they require and each brand and model of servo will consume a different amount and of course the mechanical load placed on the servos will drastically increase their current consumption. If you try and draw too much current from a voltage regulator it's output voltage will sag or even shutoff. So yes most hobby servos will work just fine with a steady 4.8 to 6vdc DC voltage, however the source of that voltage must be able to handle the peak current requirements of all the servos it is trying to power. I usually recommend that the DC power source be able to handle at least 1 amp per servo attached if you want to avoid voltage dips, board resets and other annoying problems that servos can bring to the party.

Lefty

retrolefty:

Ok, I tried to use 4x AA batteries to drive three servos at the same time and it worked! The problem was low signal voltage I guess. The servo specs said they were for 4.8-6V, and the regulator gave steady 4.97V that I used to power all the servos. The funny thing is that I could run three Futaba S3003 servos @5V without problems.

It's not about the voltage directly, but rather the current demand that the servos are drawing. Servo companies do a poor job of listing the maximum current they require and each brand and model of servo will consume a different amount and of course the mechanical load placed on the servos will drastically increase their current consumption. If you try and draw too much current from a voltage regulator it's output voltage will sag or even shutoff. So yes most hobby servos will work just fine with a steady 4.8 to 6vdc DC voltage, however the source of that voltage must be able to handle the peak current requirements of all the servos it is trying to power. I usually recommend that the DC power source be able to handle at least 1 amp per servo attached if you want to avoid voltage dips, board resets and other annoying problems that servos can bring to the party.

Lefty

True. The regulator (7800 series) was not the component I needed. I think I need invest in 10-15A (or two 5-8A) battery elimination circuit to power all the servos. For example: http://www.dualsky.com/downloads/VR_Pro_Instructions_Manual_cn_en.pdf

If you go with a R/C hobby BEC add a small 5 volt fan on that heatsink, they are designed to to have fairly constant airflow over the heatsink, think heli's and airplanes fast moving cars.

Lastly if you plan on using a dedicated servo controller later make sure the output wires will handle your maximum amperage. If not you will have to change them out. I use a Castle Creations 20 amp for my bot, and it is nice and easy to switch wires, I am not sure why they don't come with 20 amp capable to start with.

You can get inexpensive UBEC voltage converters on ebay. You can add a small diode on the ground leg of the 7805 chip like below to increase the output voltage to 5.7v for better servo performance.

rgallant:
If you go with a R/C hobby BEC add a small 5 volt fan on that heatsink, they are designed to to have fairly constant airflow over the heatsink, think heli's and airplanes fast moving cars.

Lastly if you plan on using a dedicated servo controller later make sure the output wires will handle your maximum amperage. If not you will have to change them out. I use a Castle Creations 20 amp for my bot, and it is nice and easy to switch wires, I am not sure why they don't come with 20 amp capable to start with.

The BEC i linked have option to put a fan on top of it.

I'm wondering what are the benefits of using a dedicated servo controller. I assume they are used to smooth down the movements by using so called "ramps". I could buy the same BEC you got, and I'm sure I need more Amps if I'm going to expand the project later on.

zoomkat:
You can get inexpensive UBEC voltage converters on ebay. You can add a small diode on the ground leg of the 7805 chip like below to increase the output voltage to 5.7v for better servo performance.

Thanks for the tip. I heard UBECs cause RF noise am I correct?