Pages: [1] 2   Go Down
Author Topic: Arduino Mega support 14+ servos?  (Read 2899 times)
0 Members and 1 Guest are viewing this topic.
Toronto,Canada
Offline Offline
Newbie
*
Karma: 0
Posts: 30
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


I have build a biped robot with ArduinoMega. Originally I have 12 servos operate with no problem, however I tried add up to 14 or 16 servos they start acting weird. I tried to switch pins but no luck. Either it feels like no power at all or remains on its position without any movement.
Here is the YOUTUBE:


I have using digital servos and UBEC to maintain the voltage from lipo battery:


Truly appreciated if anyone could show me the light and any hints~~ smiley
Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 201
Posts: 8690
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The library reference page says "The Servo library supports up to 12 motors on most Arduino boards and 48 on the Arduino Mega. On boards other than the Mega, use of the library disables analogWrite() (PWM) functionality on pins 9 and 10, whether or not there is a Servo on those pins. On the Mega, up to 12 servos can be used without interfering with PWM functionality; use of 12 to 23 motors will disable PWM on pins 11 and 12."

If you are using 11 or 12 for PWM then going beyond 12 servos will disable that.

I hope you are providing plenty of external power to the servos and not trying to run them all off the 5V line of the Arduino. smiley
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

0
Offline Offline
Tesla Member
***
Karma: 141
Posts: 9470
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You may need a bigger power supply. Servos under load can use >1a each.
Logged

Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   smiley-cool

Toronto,Canada
Offline Offline
Newbie
*
Karma: 0
Posts: 30
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes, I do avoid 11,12 pins when I have more than 12 servos. I am pretty sure the power is enougth and battery is seprate from arduino board. Using 2S lipo 25C 2200mAh x 2. Since each battery produce over 7.4V and that's why I have UBEC to reduce voltage down to 6V. Voltage go over 6V kill servos easily.

Zoomkat, any suggestion for bigger power supply?
Logged

0
Offline Offline
Tesla Member
***
Karma: 141
Posts: 9470
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If you run the same code with some of the servos removed and the remaining servos work ok, then it is probably insufficient power. You may need a second 8a UBEC. Measure the battery voltage while the servos are under load and see how low it drops.
Logged

Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   smiley-cool

Ohio
Offline Offline
Full Member
***
Karma: 0
Posts: 227
Arduino Hexapod
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

So your battery is able to pump that current.
Your ESC handles 8Amp constant with 15Amp burst.
I run 18 standard servos on a hexapod with a smaller voltage regulator.
This is what I use: http://www.dimensionengineering.com/DE-SWADJ3.htm

I bet it only pushes 3.5Amp or so.  I need to get my watt meter out and see.

But I do not have 18 stalled servos pulling 1Amp each.  Really, the heavy lifting is done by 3 servos at a time, with the rest of the servo pulling very little current during the rest of the cycle.



Logged

Ohio
Offline Offline
Full Member
***
Karma: 0
Posts: 227
Arduino Hexapod
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Looking at your bot, all the servos in the arms will pull almost no current (relative to the 8Amp ubec capacity)  They only support the weight of the arm. 

Can you rig up some brace to hold the entire thing up in the air?  Then power up the bot.
This will keep the leg servos from bearing the weight.  Then you can see if anything works at all when you have more servos plugged in.
14 or 16 servos on a bot suspended in the air will not pull anything close to 8Amp.
Logged

Toronto,Canada
Offline Offline
Newbie
*
Karma: 0
Posts: 30
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for all inputs.
vinceherman, I remember your bot while ago. So, you are using arduino mega too?

I tried your method with no luck. Something interesting thou. 12 servos work perfectly. But when I add up to 14 or 16, something happens no matter which pin I plug them in.
In my chassis: 6 servos on each leg, 2 servos in each hand so make it 16 servos in total. When I power it up, all servos should goes to position "90". However:

1. The right feet servo didn't go "90" but remain wherever it start of. for example if I have it in position 60 before power up. It stay 60 and won't go any where even I force to move it. This only happens on this particular servo and no matter which pin I use.

2. Only left shoulder servo works normal and others were like dead. I don't feel any power on these 3 hand servos. I could move them by hand and they just go where ever you move and drop back. Just like dead body like the video I post above.

any ideas?
« Last Edit: March 04, 2011, 09:32:43 pm by hardmouse » Logged

0
Offline Offline
Tesla Member
***
Karma: 141
Posts: 9470
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The servos that are limp are either not getting power, not getting control signals, or not getting control signals that are within the control range of the servo.
Logged

Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   smiley-cool

Toronto, Canada
Offline Offline
Full Member
***
Karma: 0
Posts: 144
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Try to plug the servos as close to the battery screw connector as possible. Even if the uBEC supplies enough current, the traces might not be able to let it pass to the servos that are further away.
Logged


Toronto,Canada
Offline Offline
Newbie
*
Karma: 0
Posts: 30
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Try to plug the servos as close to the battery screw connector as possible. Even if the uBEC supplies enough current, the traces might not be able to let it pass to the servos that are further away.
I did try that but actually the servo which moves are further than servos which are not moving closer than power. Thanks for the point thou. smiley
Logged

Manchester, New Hampshire
Offline Offline
Edison Member
*
Karma: 4
Posts: 1358
Propmaker
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You say you have trouble when you go above 12 servos.  Tell me... when you DON'T have servos 13 and 14 plugged in, are you still creating the servo objects for them in the code, and updating them, or are you commenting out the code that creates those servo objects out and updates them when you go back down to 12 servos?

The reason I ask is because if you create the servo objects for servos 13 and 14, and update them, but don't have the servos plugged in, and the other servos work fine, you know the problem most likely isn't with your code, and is in fact, the power supply.

If on the other hand trying to update those servos without them plugged in breaks the other servos, then the problem is either with your code, or with the servo interrupt not having enough CPU time* to send pulses of the proper length out to the servos. 

(* This is unlikely, as others have said they have run more than 12 servos successfully, but if you're doing some other interrupts in your code, they might steal the needed cpu time away from the servo interrupt.  I would expect you to see the servos jitter in that case though, as that is what happened when I tried to update a DAC and servos at the same time.)


Oh and one more thing... I don't think you need to avoid using pins 11 and 12 when you have more than 12 servos... you just can't their PWM functionality, because the interrupts that do that are being used to update the servos instead.  You should still be able to connect servos and other things to those pins and have them work just fine.
Logged

Toronto,Canada
Offline Offline
Newbie
*
Karma: 0
Posts: 30
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

After couple attempts with all kind of possibilities, I might give up using Arduino Mega for machine which used up to 12+ servos.
So, I choose "Renbotics ServoShield" even I don't have 100% confidence to use this board for some reason and I will explain below.
Here is the video when 16 servos all moves at same time.


Where you can get this shield:

http://www.seeedstudio.com/depot/renbotics-servoshield-rev-11-p-498.html

Here are reasons why I don't really like to use this servo board:

I guess it was designed for Seeeduino because they use micro USB connecter that avoid the shortage like regular Arduino.

But still, I don't wanna give up on MEGA. So, if anyone has any better solutions please let us know.
Logged

0
Offline Offline
Tesla Member
***
Karma: 141
Posts: 9470
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Are the servos now performing as desired? You could trim the header pin bottoms that are contacting the USB connector, then put a piece of electrical tape between the two. You probably also need to sand some on the plastic servo connectors so they fit the header pin spacing. If controlling a lot of servos is needed, the ssc-32 servo controller does a nice job and easy to connect (bit not a "shield" form factor).
Logged

Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   smiley-cool

Toronto,Canada
Offline Offline
Newbie
*
Karma: 0
Posts: 30
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Are the servos now performing as desired? You could trim the header pin bottoms that are contacting the USB connector, then put a piece of electrical tape between the two. You probably also need to sand some on the plastic servo connectors so they fit the header pin spacing. If controlling a lot of servos is needed, the ssc-32 servo controller does a nice job and easy to connect (bit not a "shield" form factor).
Hi zoomkat, I thought of that too but even I sand them to flat it still doesn't fit. About SSC32, it was one of my option and I believe it works better than the one I am using but I don't find much info about how to use it and I am not the guy has electronic background. Perhaps you have any info relate to it?
Logged

Pages: [1] 2   Go Up
Jump to: