Hello everyone, I am opening in the forum due to a problem that I cannot solve due to lack of knowledge and I see that it is overflowing here.
I am trying to configure a hexapod of 18 servos, the code I am using for testing is this:
//#include <ArduinoRobotMotorBoard.h>
//#include <EasyTransfer2.h>
//#include <LineFollow.h>
//#include <Multiplexer.h>
//los pines de la araña se cuenta como un integrado el boton de power es la guia de la pata uno
#include <Servo.h>
//#include <PS2X_lib.h>
//PS2X ps2x; //The PS2 Controller Class
//int ForwardVal = 0 ; // Valor leído de la PS2 Right Stick arriba / abajo.
//int YawLeftVal = 0 ; // Valor leído en el PS2 Right Stick izquierda / derecha
//int UpVal = 0 ; // Valor leído de la palanca izquierda de PS2 arriba / abajo
//int RollLeftVal = 0 ; // Valor leído en la palanca izquierda de PS2 izquierda / derecha
Servo servo1;
Servo servo2;
Servo servo3;
Servo servo4;
Servo servo5;
Servo servo6;
Servo servo7;
Servo servo8;
Servo servo9;
Servo servo10;
Servo servo11;
Servo servo12;
Servo servo13;
Servo servo14;
Servo servo15;
Servo servo16;
Servo servo17;
Servo servo18;
////piens servo 2, 3, 4, 5, 6, 7, 14, 15, 16, 17, 18, 19
////pines pata 1
#define SERVO_MANO1 29 //ok
#define SERVO_CODO1 28 //PK
#define SERVO_BASE1 27 //OK
//pines pata 2
#define SERVO_MANO2 43 //OK
#define SERVO_CODO2 42 //ok
#define SERVO_BASE2 41 //ok
//pines pata 3
#define SERVO_MANO3 3 //ok
#define SERVO_CODO3 4 //ok
#define SERVO_BASE3 50 //ok
////pata pata 4
#define SERVO_MANO4 A8
#define SERVO_CODO4 A9 //ok
#define SERVO_BASE4 A10 //ok
//pata pata 5
#define SERVO_MANO5 5 //ok
#define SERVO_CODO5 2 //PK
#define SERVO_BASE5 8 //OK
////pines pata 6
#define SERVO_MANO6 A1 //OK
#define SERVO_CODO6 A2 //ok
#define SERVO_BASE6 A3 //ok
void setup()
{
// ps2x.config_gamepad(13,11,10,12, false, false);
servo1.attach(SERVO_MANO1);//AQUI COLOCA SERVO POR SERVO PARA CALIBRAR LOS 90
servo2.attach(SERVO_CODO1);//AQUI COLOCA SERVO POR SERVO PARA CALIBRAR LOS 90
servo3.attach(SERVO_BASE1);//AQUI COLOCA SERVO POR SERVO PARA CALIBRAR LOS 90
servo4.attach(SERVO_MANO2);//AQUI COLOCA SERVO POR SERVO PARA CALIBRAR LOS 90
servo5.attach(SERVO_CODO2);//AQUI COLOCA SERVO POR SERVO PARA CALIBRAR LOS 90
servo6.attach(SERVO_BASE2);//AQUI COLOCA SERVO POR SERVO PARA CALIBRAR LOS 90
servo7.attach(SERVO_MANO3);//AQUI COLOCA SERVO POR SERVO PARA CALIBRAR LOS 90
servo8.attach(SERVO_CODO3);//AQUI COLOCA SERVO POR SERVO PARA CALIBRAR LOS 90
servo9.attach(SERVO_BASE3);//AQUI COLOCA SERVO POR SERVO PARA CALIBRAR LOS 90
servo10.attach(SERVO_MANO4);//AQUI COLOCA SERVO POR SERVO PARA CALIBRAR LOS 90
servo11.attach(SERVO_CODO4);//AQUI COLOCA SERVO POR SERVO PARA CALIBRAR LOS 90
servo12.attach(SERVO_BASE4);//AQUI COLOCA SERVO POR SERVO PARA CALIBRAR LOS 90
servo13.attach(SERVO_MANO5);//AQUI COLOCA SERVO POR SERVO PARA CALIBRAR LOS 90
servo14.attach(SERVO_CODO5);//AQUI COLOCA SERVO POR SERVO PARA CALIBRAR LOS 90
servo15.attach(SERVO_BASE5);//AQUI COLOCA SERVO POR SERVO PARA CALIBRAR LOS 90
servo16.attach(SERVO_MANO6);//AQUI COLOCA SERVO POR SERVO PARA CALIBRAR LOS 90
servo17.attach(SERVO_CODO6);//AQUI COLOCA SERVO POR SERVO PARA CALIBRAR LOS 90
servo18.attach(SERVO_BASE6);//AQUI COLOCA SERVO POR SERVO PARA CALIBRAR LOS 90
}
void loop()
{
servo1.write(90);
servo2.write(90);
servo3.write(90);
servo4.write(90);
servo5.write(90);
servo6.write(90);
servo7.write(70);
servo8.write(70);
servo9.write(90);
servo10.write(90);
servo11.write(90);
servo12.write(90);
servo13.write(90);
servo14.write(90);
servo15.write(90);
servo13.write(90);
servo14.write(90);
servo15.write(90);
servo13.write(30);
servo14.write(30);
servo15.write(50);
servo16.write(90);
servo17.write(75);
servo18.write(45);
}
I am sure it can be improved. However if you test the servos individually it works fine. So I rule out servo failure.
I am using an external 12V power supply
I have avoided using pins 11, 12, 44, 45, 46 by PWM from the servo library.
When I connect them all two of them tremble at me ..
Thanks in advance, regards.
"When I connect them all two of them tremble at me .."
When you see this condition, start disconnecting the other servos from the servo power supply to see if the trembling stops. Also suspend the bot so the servos are not under load to see if the trembling stops. If the trembling stops, it is probably a power supply problem. If the trembling continues, then there may be some type of timing conflict.
I'm using the MG995 servo, I honestly don't know the amperage I'm working with but I think I have the tools to measure it if I'm looking for how.
I am using a power supply that has several outputs, the one shown in the photo.
The plate and the connections are also attached in photos.
I have a data sheet of the board in which they explain how it works, reading it over and over again makes me think about PWM pins ... But I have no idea the truth.
I have tested with 5V and it does the same, it only stops when 11 servos are connected.
Attached link to we transfer to a zip with the data to see if you can understand it
Most people won't download files from off site. Attach them to your post.
The MG995 servo startup/stall current is 1.2 Amperes.
Multiply 1.2A by the number of servos that will be moving at once, and that is the absolute minimum current that your servo power supply must be able to provide.
"I have tested with 5V and it does the same, it only stops when 11 servos are connected."
"I honestly don't know the amperage I'm working with but I think I have the tools to measure it if I'm looking for how."
You really need to operate the servos at the high end of their operating voltage range to get best performance. For servos with an operating range of 4.8-6.0v, 5v is barely above the minimum operating voltage. You can use a multimeter to measure the power supply voltage while the servos are operating to see how low it drops.
Actually a multimeter will not show the brief drop-outs very well if at all, a 'scope is needed really.
Most multimeters average over a timescale of a second or two, hiding any rapid fluctuations.
"Actually a multimeter will not show the brief drop-outs very well if at all, a 'scope is needed really.
Most multimeters average over a timescale of a second or two, hiding any rapid fluctuations."
My limited knowledge with hexipod robotics is that a digital multimeter might pick up general low voltage conditions caused by that many servos being under load. YMMV
I am currently unclear on what to focus on to fix the problem.
I have been reading the controller's PDF over and over again and its not can be related to PWM signal and make rc filter. Or, focus on feeding the servos.
If you're having servo issues, the problem is almost certainly power related. Obviously, there are other reasons but power overwhelms them to the extent that you may as well ignore them for now.
Check your power supply and find out how much current it can provide.
ok, i have checked the amperage that three servos use.
You currently need 2.40A for three trembling servos.
I want to attach a video but it gives me an error due to the size. How can I get it to the forum?
The video shows the problem and how I measure the amperage with the values it gives me and you have an idea
The code I am using to simulate movement when walking. Is this:
Put the video on youtube and post the link to it here.
Like I did with these stepper motors https://www.youtube.com/watch?v=5-9pqTQP_SQ
(which the forum insists on adding extra characters to the start and end of, I haven't found a way to stop that, and can't seem to edit them out in Chrome)
According to JRemington in reply #7, you need 1.2A per servo, so your power supply isn't cutting it. You might measure the voltage too - I'll bet it's sagging with the servos attached.
Hello, I have uploaded the video so you can see what exactly the problem is, say that they are trembling now and there are only three servos connected.
The power source I am using is also appreciated.
How can I know with visible numbers that the source is not giving all the necessary energy?