Go Down

Topic: [SOLVED] Helpppp noob here pleaseee.....Power supply in servo motor. (Read 1 time) previous topic - next topic

Run_piggy

im using an arduino mega connected to a arduino sensor shield ver.2 and planning to  use it to control 19 servo motors. 10 Mg995 and 9 sg90 servo motors.. now i tried connecting it to a power source which has 6 volts according to my multimeter. but somehow they started jittering. can somebody help me find what is the problem?? also i tried measuring its supply while connected and it gave off 2v reading. why did it turn into 2v from 6v?? thanks
My code goal is just to position each of them at 90 degrees.

Code: [Select]
[// Include servo library
#include <Servo.h>
// Creating servo objects
// left and right is with respect to looking at the robot from the back
Servo Neck;
Servo Left_Shoulder1;
Servo Left_Shoulder2;
Servo Left_Palm;
Servo Left_Hip1;
Servo Left_Hip2;
Servo Left_Hip3;
Servo Left_Knee;
Servo Left_Foot1;
Servo Left_Foot2;
Servo Right_Shoulder1;
Servo Right_Shoulder2;
Servo Right_Palm;
Servo Right_Hip1;
Servo Right_Hip2;
Servo Right_Hip3;
Servo Right_Knee;
Servo Right_Foot1;
Servo Right_Foot2;


// Setting neutral position values for each motor
// neutral position is with feet flat pointing straight outwards
// with hips also straight and with both hands pointing down
// change the value below so that your robot is in neutral position
int NeckPos = 90;
int Left_Shoulder1Pos = 90;
int Left_Shoulder2Pos = 90;
int Left_PalmPos = 90;
int Left_Hip1Pos = 90;
int Left_Hip2Pos = 90;
int Left_Hip3Pos = 90;
int Left_KneePos = 90;
int Left_Foot1Pos = 90;
int Left_Foot2Pos = 90;
int Right_Shoulder1Pos = 90;
int Right_Shoulder2Pos = 90;
int Right_PalmPos = 90;
int Right_Hip1Pos = 90;
int Right_Hip2Pos = 90;
int Right_Hip3Pos = 90;
int Right_KneePos = 90;
int Right_Foot1Pos = 90;
int Right_Foot2Pos = 90;
void setup()
{
  //setting output for motors
  Neck.attach(25);
  Left_Shoulder1.attach(32);
  Left_Shoulder2.attach(30);
  Left_Palm.attach(28);
  Left_Hip1.attach(34);
  Left_Hip2.attach(36);
  Left_Hip3.attach(38);
  Left_Knee.attach(40);
  Left_Foot1.attach(42);
  Left_Foot2.attach(44);
  Right_Shoulder1.attach(33);
  Right_Shoulder2.attach(29);
  Right_Palm.attach(31);
  Right_Hip1.attach(35);
  Right_Hip2.attach(37);
  Right_Hip3.attach(39);
  Right_Knee.attach(41);
  Right_Foot1.attach(43);
  Right_Foot2.attach(45);
}
void loop() {
  Neck.write (NeckPos);
  Left_Shoulder1.write (Left_Shoulder1Pos);
  Left_Shoulder2.write (Left_Shoulder2Pos);
  Left_Palm.write (Left_PalmPos);
  Left_Hip1.write (Left_Hip1Pos);
  Left_Hip2.write (Left_Hip2Pos);
  Left_Hip3.write (Left_Hip3Pos);
  Left_Knee.write (Left_KneePos);
  Left_Foot1.write (Left_Foot1Pos);
  Left_Foot2.write (Left_Foot2Pos);
  Right_Shoulder1.write (Right_Shoulder1Pos);
  Right_Shoulder2.write (Right_Shoulder2Pos);
  Right_Palm.write (Right_PalmPos);
  Right_Hip1.write (Right_Hip1Pos);
  Right_Hip2.write (Right_Hip2Pos);
  Right_Hip3.write (Right_Hip3Pos);
  Right_Knee.write (Right_KneePos);
  Right_Foot1.write (Right_Foot1Pos);
  Right_Foot2.write (Right_Foot2Pos);

}
]

i really appreciate any help for this....

vinceherman

19 servos will pull a lot of current.
Tell us more about your power supply. (hint, this is the most common failure when using an arduino and multiple servos)
When loaded, those servos might pull 1A each.
Can your 6v power supply provide 19A?

Another common mistake is failing to connect the grounds.  The servos and the arduino should share a ground.  Your shield likely takes care of this.

Edit: you *can* use a lower power supply.  I ran 18 servos off of a 6v 3A regulator.  This worked perfectly for bench testing, when the servos were not loaded.  But as soon as I loaded them up in real tests, the supply could not provide the required current and the servos failed.  To do it over, I would use multiple power supplies.  This is because these are easily available.  6V 20A regulators not so much.

Run_piggy

i am using this battery as a power supply but it seems that there is a problem with it instead of producing only 4v so i use a XL6009E1 DC-DC BUC CONVERTER to power it to 6v. im not really sure about its current rating but it says 2000mA in the battery.

vinceherman

Inlining the OP pics



If that battery is at 4v, you likely have damaged it.
LiPo's do not like going down lower that 3.0v per cell, and your 2S battery is at 2.0v per cell.
Maybe it will be usable?  Maybe your charger will still charge it?
But it will likely have a reduced capacity in the future, if it takes a charge at all.

In healthy shape, it would be a workable battery.  The wires are a bit marginal.  I would check that they do not get too hot in use.

Also, if the battery is healthy, you do not need a step-up converter because it would be at 6v or higher.

If I were doing this, I would go with a 3s battery.  This puts the pack range from about 14v at full charge down to 9v at full discharge.  This gives a margin so that a voltage regulator can drop down to 6v with enough margin that the input side does not go too low.

HobbyKing has a lot of good selections.  Let us know if you want help picking out a suitable battery.

vinceherman

Well, like this:
https://hobbyking.com/en_us/turnigy-2200mah-3s-20c-lipo-pack.html
Note the heavier wire on the main side.  This will handle all the current 19 servos will pull.
Do you have a 3s charger?

This regulator puts out 5v or 6v at 4A continuous and 5A surge.
https://hobbyking.com/en_us/turnigy-hv-sbec-5a-switch-regulator-8-42v-input.html

Oh, wait.  You are running these all from one shield.  4A is not enough.  I was thinking you could power a few servos on each of multiple regulators.

edit: 10A but out of stock

Run_piggy

Inlining the OP pics




HobbyKing has a lot of good selections.  Let us know if you want help picking out a suitable battery.
can you suggest a suitable battery that will make all servos move without jittering because of insufficient power supply?



vinceherman

Good, you have a charger.  Let us know if that battery is salvageable.

The 20A bec I linked to says it will work with a 2s battery like yours.  But a 3s battery makes me happier.  Having a margin between the battery low voltage and the regulated output.  I like that.

Run_piggy

Well, like this:
https://hobbyking.com/en_us/turnigy-2200mah-3s-20c-lipo-pack.html
Note the heavier wire on the main side.  This will handle all the current 19 servos will pull.
Do you have a 3s charger?

This regulator puts out 5v or 6v at 4A continuous and 5A surge.
https://hobbyking.com/en_us/turnigy-hv-sbec-5a-switch-regulator-8-42v-input.html

Oh, wait.  You are running these all from one shield.  4A is not enough.  I was thinking you could power a few servos on each of multiple regulators.

edit: 10A but out of stock
can you show an image how will i connect this regulator?? i'm confuse since the other end have 3 wire like servo. do i connect this on the shield just like the servos???
also since im not using usb to power the arduino will it also work and not damage the arduino if i used this also to power the arduino mega 2560?

Run_piggy

i tried charging it and it still charge base on the indicator. 

vinceherman

Here is a setup layout.
You might put a switch in between the plug and the BEC so that the battery can be plugged in but the system powered off.

You might add another regulator to provide 5v to your arduino.  Make sure you have the polarity right.  If you reverse power to the 5v pin there is no protection.

Run_piggy


Go Up