3 servos for robot arm interfering big time

Hello

I built a robot claw/gripper with a pan and tilt from parts from Spark fun

Have major issues with cross talk on the signal wires. If i run one servo at a time it runs just fine

If i have more then one hooked up at a time forget it. Complete crazy movement.

Im assuming its interference on the servo signal wire. Has anyone heard of a fix for this.
Its all on a separate supply of course

The servos are being controlled from an analog read from a pot. No big deal.

Def major issues here and my project is due in a few days. Anyone have any ideas?

Here is the simple code for it

// 
#include <Servo.h> 
 
 Servo grip_servo;
 Servo pan_servo;
 Servo tilt_servo;
 
int pot_grip_pin = 0;
int pot_pan_pin = 1;
int pot_tilt_pin = 2;
int val=0;
 

int pot_grip_pin_value;
int pot_pan_pin_value;
int pot_tilt_pin_value;



void setup() 
{ 
  grip_servo.attach(13);  // attaches grip servo on pin 13 to the servo object
  pan_servo.attach(1); //attach pan servo to Digital pin 1
  tilt_servo.attach(7);//attach tilt servo to pin 7
  
   

} 
 
void loop() 
{ 
  pot_pan_pin_value = analogRead(5);                                // reads the value of the potentiometer (value between 0 and 1023) 
  pot_pan_pin_value = map(pot_pan_pin_value, 20, 1000, 0, 179);     // scale it to use it with the servo (value between 0 and 180) 
  pan_servo.write(pot_pan_pin_value);                             // sets the servo position according to the scaled value 
  delay(15);                                                     // waits for the servo to get there 
  
  
  
  pot_grip_pin_value = analogRead(4);                                // reads the value of the potentiometer (value between 0 and 1023) 
  pot_grip_pin_value = map(pot_grip_pin_value, 20, 400, 0, 179);     // scale it to use it with the servo (value between 0 and 180) 
  grip_servo.write(pot_grip_pin_value);                             // sets the servo position according to the scaled value 
  delay(15);                           
  
  pot_tilt_pin_value = analogRead(3);                                // reads the value of the potentiometer (value between 0 and 1023) 
  pot_tilt_pin_value = map(pot_tilt_pin_value, 200, 1000, 0, 179);     // scale it to use it with the servo (value between 0 and 180) 
  tilt_servo.write(pot_tilt_pin_value);                             // sets the servo position according to the scaled value 
  delay(15);                           
  
}
  grip_servo.attach(13);  // attaches grip servo on pin 0 to the servo object
  pan_servo.attach(1); //attach pan servo to Digital pin 5
  tilt_servo.attach(7);//attach tilt servo to pin 10

If the comments are not going to match the code, do they really add any value?

Im assuming its interference on the servo signal wire.

Could be a number of things. Low current supply. Interference. How are the servos powered?

  delay(15);                                                     // waits for the servo to get there

How far do your servos actually move in 15 milliseconds?

PaulS:

  grip_servo.attach(13);  // attaches grip servo on pin 0 to the servo object

pan_servo.attach(1); //attach pan servo to Digital pin 5
  tilt_servo.attach(7);//attach tilt servo to pin 10



If the comments are not going to match the code, do they really add any value?



> Im assuming its interference on the servo signal wire.


Could be a number of things. Low current supply. Interference. How are the servos powered?



delay(15);                                                     // waits for the servo to get there



How far do your servos actually move in 15 milliseconds?

The comments were left over from an old line of code sorry

As i said in the post they are separately powered by a high current DC supply.

The servos do not move very fast
15 ms is more then enough time. As i said it runs fine with one servo at a time.

The other are still powerd up but just yanking the signal wire and they run fine one at a time like that
Its obviously interference

Does anyone have a good solution? shield wire? toroid beads?wire twisting?
Im more of an AC person. This methods above would be effective on AC dunno about this though.

anyone dealt with this before

anyone dealt with this before

You are not the first by any means. Assuming your servo powering PSU has it's ground common with the arduino, you need decoupling on each motor's supply. You can try with just capacitors but you might need two capacitors and an inductor in a Pi configuration on each motor.

You could also try a pull down resistor of about 4K7 on each of the servo's input lines close to the servo itself.

I notice you are using pin 1 for one of the servos, this is a bad idea as this gets used by the serial communications used to upload code to the board. The same goes for pin 0.

Grumpy_Mike:

anyone dealt with this before

You are not the first by any means. Assuming your servo powering PSU has it's ground common with the arduino, you need decoupling on each motor's supply. You can try with just capacitors but you might need two capacitors and an inductor in a Pi configuration on each motor.

You could also try a pull down resistor of about 4K7 on each of the servo's input lines close to the servo itself.

I notice you are using pin 1 for one of the servos, this is a bad idea as this gets used by the serial communications used to upload code to the board. The same goes for pin 0.

Hello

Thanks for the suggestions

Im curious why you suggest a cap.

You mean a cap on the signal line?

Interesting. I don't think i have ever experimented with caps on a square wave signal. Normally i would say it would have no effect but because there is oscillation in the signal it may. Im not sure if it will do any good though.

Any recommendations on cap size and type?

electrolytic? disc? ceramic?

How is a pull down going to help? The PWM is Constant

Can you please explain ur theory?
Thanks for the ideas

also i will change the pins off 0 and 1
I had them as far apart as possible thats why it was over there.

Good idea though

just tried both your cap and pull down resistor with no change at all

5k resistor and a both a .047 ceramic and a .01 ceramic

Actually it wouldn't work at all with the cap in place

No you are totally missing the point.
Do not put caps on the signal line I never said that!

Your motors are generating interference so you need to suppress this. Your chips are picking this up you want to prevent this. Your signal lines you want to minimise this.

A pull down on the signal line will lower the output impedance and so make interference more difficult to pick up.

A capacitor across the power supply connections of your motors and your arduino will stop interference on the supply. Typically you would use a 0.1uF ceramic cap.

You need a Pi filter supplying the motors, with this you need bigger caps say 47uF or larger as well as 0.1uF ceramics across them for high frequency response.

This is all simple basic everyday stuff, not rocket science.
All wiring should be as short as possible, all grounds should meet only at a common point, a so called star ground.

Power Supply. Is the power supply for the servos big enough? If you load th power supply down too much the servos will twitch and do all sorts of flakey movement. And verify your grounds.

Guys please stop asking me about the power supply

Its a 24 amp high current supply for my big full size robots i work on. Its got enough juice to run serious DC motors let alone these servos.
Ive stated this in the original post and once again

Its not the supply. Thanks for the thoughts

Grumpy mike
Your name suits you.

No need to be sarcastic. I appreciate your input
I will attempt a cap on the supply line as you suggest. I personal do not see how this is going to help. Its DC caps have no effect on DC but I'm assuming you know more about electronics then i so i will give it a whirl.

How would you like the cap for the power supply. Standard procedure is in parallel to ground. Is that how you want it?
or some other configuration? in series seems unlikely as i said above with DC thats not going to help my cause.

Please let me know and ill give it a whirl right now

Thanks

Grumpy mike

Is this what you wanted?

Im assuming this is you.

Wish you would of sent me this before i would of known what you meant instead of asking stupid questions

Ill try something like this

Thanks

In regards to your transistor design schematic which i like by the way. Do you have a recommendation part number for the transistors?

Any suggestions on a temporary fix for me seeing as this project is due in 2 days.

I dont think i will have time to rewire everything and get all that wired up X 3

Also, how does the transistor effect the the fact that the signal is a PWM square wave. Im assuming it just passes right through at its correct given frequency?

After further investigation i have only more questions unfrotunatley

If the problem is supply noise, Then why does it work fine with one, not so great with 2 and terrible with 3

I never disconnect the supply at all.

All i ever do is unplug the signal. the supply voltage never goes away. Also, even with all 3 of the hooked up at once, as long as i dont move the pots it doesnt twictch really. The issue comes from when i turn a pot while all 3 are hooked up.

So can you explain how that is supply noise. With all 3 hooked up at one time, you can move one axis at a time not perfectly but its better then normal.

Do you think this could be any thing other then what you originally suspected?

Don't know what is causing your problem but I suggest you provide a wiring diagram so we can see if anything obvious drops out. Have you isolated everything except the servos and the Arduino?

Some debug output too would be useful, to show if the crosstalk is on the input or the output.

Time to post code again.

ok stand by let me see if i can come up with a quick diagram on Eagle that i can post

Sorry i did this in 5 min

I just wanted to get something up

This is accurate

No one has any ideas?

The code is posted on the first page.

I increased the delay with no real change in behavior other then a noticeable jerk in the arm.

Where's the debug output?

What do you mean debug output?

There is no debug output 16 lines of code thats it

I dont understand what your asking for