Give zero volt to specific servo motors in a certain time

I have a robot that uses 4 mechanical arms. Each mechanical arm has 4 "READYTOSKY 30kg" servo motors on them.

At some point, I need to use the absolute maximum force of only two mechanical arms (while the other two will stay still). Even though I do not change the coordinates of the other two mechanical arms (which I am not using),they consume voltage and "take away" the full potential of force from the other two.

Is there a way to stop the voltage consumed by the two other arms just for a brief moment using Arduino code? Shortly afterwards they will get back the voltage they need.

``````    if(level==25)
{
pwm.setPWM(12, 0, 200);
pwm.setPWM(13, 0, 255);
pwm.setPWM(14, 0, 430);
delay(100);
pwm.setPWM(1, 0, 380);
pwm.setPWM(2, 0, 520);
delay(500);
pwm.setPWM(0, 0, 170);
delay(600);
stepperten.setCurrentPosition(0);
while (stepperten.currentPosition() != (-3*200))
{
stepperten.setSpeed(-600);
stepperten.runSpeed();
}
steppertwist.setCurrentPosition(0);
while (steppertwist.currentPosition() != (100))
{
steppertwist.setSpeed(200);
steppertwist.run();
}
stepper1.setCurrentPosition(0);
while(stepper1.currentPosition() != (30))
{
stepper1.setSpeed(200);
stepper1.run();
}

pwm.setPWM(1, 0, 295); //THIS IS THE MOMENT I NEED TO STOP VOLTAGE FOR OTHER ARMS
pwm.setPWM(2, 0, 400); //AND GET THE MAXIMUM VOLTAGE POSSIBLE ON THESE TWO ARMS
delay(1500);
pwm.setPWM(12, 0, 125);

array1[25][0] = 170;
array1[25][1] = 295;
array1[25][2] = 400;
array1[25][3] = 153;
array4[25][0] = 125;
array4[25][1] = 255;
array4[25][2] = 395;
}
``````
• You mean they consume current? Cutting the other servos power would also mean, that they are not able to hold their position against outside forces (like gravity). Would that be a problem? You can control the power lines of a servo with a p-channel MOSFET Oct 23, 2023 at 12:01
• Did you try to `detach()` the servo, then `attach()` it again later? Oct 23, 2023 at 12:24
• chatgpt told me to use detach and attach. I thought it might not work during a code
– Noy
Oct 23, 2023 at 12:30
• I thought about getting a bigger trasformatore. The one I am currently using is 6.5[v] w/ 2.5[A]. The servo can get 4.8-7.2[V]. What is the optimal current I need for better results? The model is "readytosky td-8130mg". Thanks!
– Noy
Oct 23, 2023 at 12:36
• If you want to keep the maximum flexibility, then add together all the stall currents of your servos. If you google for the TD-8130mg datasheet 2.1A for 4.8V and 2.7A for 7.2V. So you will have stall current of about 2.6A. Make sure, that your power source can accommodate your maximum current. Oct 23, 2023 at 12:44

If you want to turn off power for some external parts you could try to power them via the digital pins. See this example code:

``````void setup(){
pinMode(YOUR_ARM_POWER_SUPPLY_PIN, OUTPUT);

// switch arm on
digitalWrite(YOUR_ARM_POWER_SUPPLY_PIN, ON);
}

void loop(){
if(armMustNotUseAnyPower()){
// switch arm off
digitalWrite(YOUR_ARM_POWER_SUPPLY_PIN, OFF);
}

}
``````

Keep in mind that the digital Pins cannot output as much power as VCC. But since you drive some servo motors over it I assume they get their power externally anyway. You might need to add some transistor or another way on how to switch the power on and off from the big power source. Hope this helps you in some way.