My name is Joe and my friends and I are building a robotic arm for a competition.
We have constructed an arm that utilizes 6 servos for 5 joints, and a dc motor is used to turn the whole set up left and right. We are using an Arduino Mega 2560 and potentiometers to control each individual servo. The wiring is done through a breadboard. We have a 9 volt battery working the DC motor, a 6 volt battery giving power to the arduino board, and another 6 volt battery running the potentiometers. There are two servos at the base joint, and one servo at all the other joints. The servos are Standard servos from BP Hobbies and the baterris are 6 V, 1600maH, NiMH Tenergy batteries. The potentiometers are 25-ohm potentiometers from RadioShack. There is a knife switch controlling the direction of the DC motor and a 5K-ohm potentiometer controlling its speed.
Everything is wired properly, we have checked numerous times and used an ohm meter. Concerning the power sources, there are different ones. The board and the servos are running off their own 6V battery, which is inputted into the board with a spliced DC jack plug going into the DC jack on the arduino board. The other ends are attached to the battery leads. The servos are getting power through the 5V pin and grounded to the GND pin. They get their signal from the PWM outputs on the board.
The potentiometers have a very low ohm-rating, so we put them on a separate circuit because they use alot of current. Their positive and ground ends are attached to another 6V battery, and the output wires from the center of the potentiometer go into the analog input pins of the arduino board.
Here is an example of the code:
int potpin = 0;
int potpin1 = 1;
int potpin2 = 2;
int potpin3 = 3;
int potpin4 = 4;
val = analogRead(potpin); // reads the value of the potentiometer (value between 0 and 1023)
val = map(val, 0, 1023, 0, 179); // scale it to use it with the servo (value between 0 and 180)
myservo.write(val); // sets the servo position according to the scaled value
delay(30); // waits for the servo to get there
val1 = analogRead(potpin1);
val1 = map(val1, 0, 1023, 0, 179);
val2 = analogRead(potpin2);
val2 = map(val2, 0, 1023, 0, 179);
val3 = analogRead(potpin3);
val3 = map(val3, 0, 1023, 0, 179);
val4 = analogRead(potpin4);
val4 = map(val4, 0, 1023, 0, 179);
When we have everything hooked up, the arm start going nuts and moves like it has a mind of its own. We do have some control over it, but the arm is still jerking left and right at almost every joint, the most at the servo controlling the gripper. We have ruled out noise interference because we have had complete-non jerky control over it at previous points in time.
The competition is next weekend so please help.
If you need pictures, I will zip them and attach them but they are too large to attach at the moment