So I have an Uno r3 with a L293D motor shield on top. One of the common motor shields found on ebay (here is an image of the type http://b.lnwfile.com/_/b/_raw/nb/pn/vc.jpg)
It has 2 ports for 2 servos on the top left, these actually line up to pins 9 & 10 on the arduino Uno.
I need to manage 3 servos (on top of the motors) from this board (there is plenty of power 11.1v going directly into the motorshield and ive checked multiple times for voltage drop and ruled that out as the cause)
So for the 3rd servo I soldered the servo power lines onto the free 5v motor shield board and the signal wire onto pin 11.
The servo seems to get commands some of the time however much of the time it goes berserk or doesnt respond and not just servo 3 but it also affects the servos plugged into pins 9 & 10 in strange random ways.
At first I thought voltage drop.. but ruled that out with multiple tests.
Next I thought maybe something funny with pin 11, tried pin 13 with same results.
So next I tried different servos just to check but same results.
I also checked for some kind of interference onto the signal cables laying next to something high powered but ruled that out.
I dont think its my code, when I remove this 3rd soldered on servo everything works as expected.
Now I am almost out of ideas except that I suspect it has something to do with the #include <Servo.h> only liking pins 9 & 10 for servos.
Has anyone experienced this problem or got a suggestions?
Im about out of ideas.
Three servos and the motor shield may be drawing too much current for the Arduino's regulator to handle. Do you have anything connected to the motor driver ICs?
The DC motors in a servo can draw quite a lot of current, and make quite a bit of noise. You might fix it by soldering a 0.1uF capacitor across the 5V/Gnd connection.
Looking at this schematic of an L293D motor shield, D11 (I presume that is what you meant by "pin 11") goes to one of the L293D ICs.
I currently have it on D13 and not difference in the problem with D11
At first I thought it was a current issue (i realize it usually is) but the motor shield is getting a direct 11.1v from 3 x 3400mah 18650 batteries.
Even if I remove the dc motors and servos on D9 & D10 and just run solely the servo on D13 it still hardly responds or if it does in a very erratic fashion almost like an epileptic fit. This is why im almost certain its not a current or voltage issue, the whole setup works fine running dc motors and 2 servos on 9&10 just goes bad when i try to connect the 3rd servo to a pin which is not 9 or 10.
The l293D driver may be getting enough current but can only output 600 mA. the SN754410 has the exact same pin layout but can supply 1A to your servos, maybe try this instead.
I reckon that the servo is trying to draw current and hence starving all 3 servos at once, causing the sporadic behaviour of all 3 servos.
Well my doubt with the SN754410 making a difference is because it works fine supplying power to 2 servos normally connected on the motor shield in the 2 positions (which connect to 9 & 10) so why would it have trouble running just one servo connected on D11 or D13?
I should add that I completely unpluggged the other 2 plugged in servos (9&10)before testing the 3rd soldered one on (13) just to make sure there was no voltage loss anywhere.
I can only imagine something in the L293D motor shield is causing the problem. (I have tried multiple arduino Uno's and multiple L293D motor shield's just to make sure it wasnt something specific to this board).
Perhaps its a library issue restricting servos to only pin 9 & 10?
The only included libraries I use is #include <AFMotor.h> for the motor shield
and #include <Servo.h> for the servo. (I checked in AFMotor.h for any possible issues and couldnt see anything related to the servos, only the motors which are working fine)
Has anyone else connected up an extra servo to this motor shield beyond the 2 ports?
Yes I understand the power issue however as I said even with just a single servo with its 5v power coming from the motor shield itself and the signal cable attached to the shield which is not in D9 or 10 the issue remains.. with no other servos at all.
OK, so you are -not- connecting to the 5V buss on the motor shield to run the 3rd servo. Are all three servos identical? Have you tried a different servo on that pin? Check your grounds?
Thanks for sticking with this problem but ive had to travel away from my gear for the next month so will unlikely be able to do a full test.
Ive had an idea, perhaps it is a power issue but more about where on the board I am pulling the power from.
The servos I am using are 1 MG90S micro servo on shield servo SER1 which is D10
Then SERVO_2 which is D9 I have a more heavy MG995 servo
and the extra servo which has its power soldered onto the shield (ive tried 2 locations one was onto the other 2 servos power one elsewhere over on the shield) and its signal cable is wired around and under directly onto the Uno's D13
Its a very intermittant problem, sometimes it seems to work fine others its having a heart attack.
What has turned me around on it possibly being power related is perhaps my tests are being down when the 3 18650 3200mah lipos are fully charged or not, perhaps that sometimes gives enough juice to make it work sometimes and not others. I really thought that was plenty of juice for these 3 servos but perhaps the Uno filters alot of it out. I swear ive seen problems when only the soldered servo was connected however.
In any case if anyone has an Uno, this particular shield and 3 servos and would like to troubleshoot id be much appreciated.
the extra servo which has its power soldered onto the shield
So it -is- powered by the 5V on the shield? The pins/holes labeled "5V" -are- connected to the Arduino's 5V line. The two servo connectors are also powered through the Arduino's 5V line, regardless of where the external power on the shield is connected. The screw clamp terminals only provide power to the L293D chips, not the servos.