Pages: [1] 2 3   Go Down
Author Topic: 3 servos for robot arm interfering big time  (Read 3138 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 39
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Code:
//
#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);                          
  
}







« Last Edit: April 30, 2012, 12:05:18 pm by automagp68 » Logged

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 652
Posts: 50863
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
  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?

Quote
Im assuming its interference on the servo signal wire.
Could be a number of things. Low current supply. Interference. How are the servos powered?

Code:
  delay(15);                                                     // waits for the servo to get there
How far do your servos actually move in 15 milliseconds?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 39
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
  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?

Quote
Im assuming its interference on the servo signal wire.
Could be a number of things. Low current supply. Interference. How are the servos powered?

Code:
  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

Logged

Manchester (England England)
Online Online
Brattain Member
*****
Karma: 639
Posts: 34725
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
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.
« Last Edit: April 30, 2012, 10:17:28 am by Grumpy_Mike » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 39
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
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
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 39
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 39
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Manchester (England England)
Online Online
Brattain Member
*****
Karma: 639
Posts: 34725
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

South Texas
Offline Offline
Edison Member
*
Karma: 8
Posts: 1025
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 39
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 39
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 39
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?



Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 39
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

UK
Offline Offline
Shannon Member
****
Karma: 223
Posts: 12630
-
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

I only provide help via the forum - please do not contact me for private consultancy.

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 310
Posts: 26626
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Time to post code again.
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Pages: [1] 2 3   Go Up
Jump to: