I am currently building the Lynxmotion AL5D Robot arm, and trying to use a master slave type of controller, but I am having a lot of issues with the potentiometers. I have bought 2 sets of servos and have already built the slave arm with the BotBoarduino micro controller. Am I supposed to mod the other set of servos I have to measure their resistance? I know servos already have pots in them, but I don’t know if I can use the servo as a pot. In addition, can I just use the servo as is, and tell the micro controller to read the master servos as a pot? And can anyone provide detailed instructions on how to mod the servos to be used as pots for this project. It would mean a lot to me as I cannot seem to find much online. Thanks again! (P.S. I have very limited experience with robotics and would like as much help as I can get.)
If you purchased a complete second arm to use for feedback (a 1:1 scale using the same parts), you would need to open each servo to get access to the built-in potentiometer. The potentiometer wires (signal, voltage and ground) would be connected to the BotBoarduino’s analog pins (signal, voltage and ground). The servo’s normal three wires would no longer be used and you should not plug in the red and black wires since they connect to the motor. You would essentially be using the servo as a simple potentiometer. Once you get the analog inputs from each of the servos, you can create code to convert those to actual servo positions (also sent via the BotBoarduino).
Will I have to do any soldering or other of any kind?
Absolutely; an RC servo is a complete / finished product. Take a look at the inside of the servo (image courtesy of justanotherlanguage.org)
You would need to cut the wires (or de-solder them) from the potentiometer, remove the motor and other electronics (they won’t be needed) and csolder new wires to the potentiometer, ensuring the signal goes to the middle pin on the potentiometer.
Alternatively for a cleaner setup, you can also cut and reuse the existing servo wires and solder those directly to the potentiometer.
Once again be sure you have the pinout correct.
Are there any places you can send me to that will give me detailed instructions, preferably with pictures? I am a complete dummy, and have no experience whatsoever with soldering or modding.
So is all I need to do remove all the electronics and attach wires from the pot to the botboarduino?
Correct. Try it with one servo first before undoing them all.
Which wires are connected together to the potentiometer(red and red, yellow and yellow, black and green)?
I am currently working on a master slave system for the AL5D. I was able to mod the servos for the slave system into pots by removing everything except for the pots in the hitec servos. But the problem is that it only sends the analog voltage readings for only 90 degrees of rotation. Although it rotates beyond 90 degrees, the voltage hit a peak after I turn it 90 degrees and won’t go above 10 volts in the analog voltage reader? Please HELP!!! I will try to post a video on this topic, to explain the problem further
The potentiometer should have three connections: the outer two are power (red and black for 5V and GND) and the center is the signal. You would connect the wires directly to these pins. You should not have 6 wires.
The potentiometer should be 5V. It should not provide 10V. You should only be powering it at 5V. Most microcontroller analog input pins are also 0-5V.
Dear Mr. Benson,
Thank you for all the help you have given me so far! I have managed to set up all the potentiometers and they all are working properly. However, I am now having another problem. First the arm is in a ratio of 3:8 meaning the slave arm is larger than the master arm. When I connect all my wires to the botboarduino, they are doing a very strange calibration type thing that doesn’t end. This is the code I am using. Do I need to change the scaling for the arm? I will attach pictures and videos to explain problem.
[code]#include <Servo.h>
int dummy;
// Arduino digital pin numbers for servo connections
#define BAS_SRV_PIN 2 // Base servo HS-485HB
#define SHL_SRV_PIN 3 // Shoulder Servo HS-805BB
#define ELB_SRV_PIN 4 // Elbow Servo HS-755HB
#define WRI_SRV_PIN 10 // Wrist servo HS-645MG
#define GRI_SRV_PIN 11 // Gripper servo HS-422
// Arduino analog pin numbers for potentiometer connections
#define BAS_POT_PIN 0
#define SHL_POT_PIN 1
#define ELB_POT_PIN 2
#define WRI_POT_PIN 3
#define GRI_POT_PIN 4
// Arduino pin number of on-board speaker
#define SPK_PIN 5
// Pot range limits for +/- 90 degree rotation from midpoints
// Used to scale pot input to servo position
#define BAS_POT_MIN 183
#define BAS_POT_MAX 950
#define SHL_POT_MIN 114
#define SHL_POT_MAX 935
#define ELB_POT_MIN 67
#define ELB_POT_MAX 905
#define WRI_POT_MIN 87
#define WRI_POT_MAX 932
#define GRI_POT_MIN 0
#define GRI_POT_MAX 1023
// Define generic range limits for servos, in microseconds (us)
// Specific per-servo/joint limits are defined below
#define SERVO_MIN 600
#define SERVO_MID 1500
#define SERVO_MAX 2400
// Servo offsets (in microseconds) for centered position
#define BAS_SRV_OFFSET (0)
#define SHL_SRV_OFFSET (-50)
#define ELB_SRV_OFFSET (-20)
#define WRI_SRV_OFFSET (+30)
#define GRI_SRV_OFFSET (0)
#ifdef WRIST_ROTATE
#define WRO_SRV_OFFSET (0)
#endif
// Servo range limits
// Used to scale pot input to servo position
#define BAS_SRV_MIN (SERVO_MIN + BAS_SRV_OFFSET)
#define BAS_SRV_MAX (SERVO_MAX + BAS_SRV_OFFSET)
#define SHL_SRV_MIN (SERVO_MIN + SHL_SRV_OFFSET)
#define SHL_SRV_MAX (SERVO_MAX + SHL_SRV_OFFSET)
#define ELB_SRV_MIN (SERVO_MIN + ELB_SRV_OFFSET)
#define ELB_SRV_MAX (SERVO_MAX + ELB_SRV_OFFSET)
#define WRI_SRV_MIN (SERVO_MIN + WRI_SRV_OFFSET)
#define WRI_SRV_MAX (SERVO_MAX + WRI_SRV_OFFSET)
#define GRI_SRV_MIN (SERVO_MIN + GRI_SRV_OFFSET)
#define GRI_SRV_MAX (SERVO_MAX + GRI_SRV_OFFSET)
// Audible feedback sounds
#define TONE_READY 1000 // Hz
#define TONE_RANGE_ERROR 200 // Hz
#define TONE_DURATION 100 // ms
// Servo objects
Servo Bas_Servo;
Servo Shl_Servo;
Servo Elb_Servo;
Servo Wri_Servo;
Servo Gri_Servo;
/*
- Setup function - runs once when Arduino is powered up or reset
*/
void setup()
{
// Attach to the servos and specify range limits
// Note that the scaling limits (e.g. BAS_SRV_MIN, etc.) are not used here
// The limits here are just the physical limits of the servos, to prevent damage
Bas_Servo.attach(BAS_SRV_PIN, SERVO_MIN, SERVO_MAX);
Shl_Servo.attach(SHL_SRV_PIN, SERVO_MIN, SERVO_MAX);
Elb_Servo.attach(ELB_SRV_PIN, SERVO_MIN, SERVO_MAX);
Wri_Servo.attach(WRI_SRV_PIN, SERVO_MIN, SERVO_MAX);
Gri_Servo.attach(GRI_SRV_PIN, SERVO_MIN, SERVO_MAX);
delay(500);
// Sound tone to indicate it’s safe to turn on servo power
tone(SPK_PIN, TONE_READY, TONE_DURATION);
delay(TONE_DURATION * 2);
tone(SPK_PIN, TONE_READY, TONE_DURATION);
} // end setup()
/*
- Loop function - runs forever, after setup() function
*/
void loop()
{
int bas, shl, elb, wri, gri;
#ifdef WRIST_ROTATE
int wro;
#endif
// Read potentiometer positions
bas = analogRead(BAS_POT_PIN);
shl = analogRead(SHL_POT_PIN);
elb = analogRead(ELB_POT_PIN);
wri = analogRead(WRI_POT_PIN);
gri = analogRead(GRI_POT_PIN);
// Scale to servo output
bas = map(bas, BAS_POT_MIN, BAS_POT_MAX, BAS_SRV_MIN, BAS_SRV_MAX);
shl = map(shl, SHL_POT_MIN, SHL_POT_MAX, SHL_SRV_MIN, SHL_SRV_MAX);
elb = map(elb, ELB_POT_MIN, ELB_POT_MAX, ELB_SRV_MIN, ELB_SRV_MAX);
wri = map(wri, WRI_POT_MIN, WRI_POT_MAX, WRI_SRV_MIN, WRI_SRV_MAX);
gri = map(gri, GRI_POT_MIN, GRI_POT_MAX, GRI_SRV_MIN, GRI_SRV_MAX);
// Write output to servos
Bas_Servo.writeMicroseconds(bas);
Shl_Servo.writeMicroseconds(shl);
Elb_Servo.writeMicroseconds(elb);
Wri_Servo.writeMicroseconds(wri);
Gri_Servo.writeMicroseconds(gri);
} // end loop()[/code]
I actually don’t know how to do attachments, so can you also help me out with that?
When you press “reply” there is a gray bar just beneath the text field which says “Attachments”. You can expand this section by clicking the arrow at the far right of this gray bar.
Hi,
I am using the following code for Robot Arm with Mater Slave system. I am usin g10k potentiometers for master. When I turn on the power, the slave servos are turning very fast /going wild making the arm fall. Is there any issue with below code??
I am using Botborduino v1.0 version board.
[code]#include <Servo.h>
Servo myservo; // create servo object to control a servo
Servo myservo1; // create servo object to control a servo
Servo myservo2; // create servo object to control a servo
Servo myservo3; // create servo object to control a servo
Servo myservo4; // create servo object to control a servo
int potpin0 = 0; // analog pin used to connect the potentiometer
int val0; // variable to read the value from the analog pin
int potpin1 = 1; // analog pin used to connect the potentiometer
int val1; // variable to read the value from the analog pin
int potpin2 = 2; // analog pin used to connect the potentiometer
int val2; // variable to read the value from the analog pin
int potpin3 = 3; // analog pin used to connect the potentiometer
int val3; // variable to read the value from the analog pin
int potpin4 = 4; // analog pin used to connect the potentiometer
int val4; // variable to read the value from the analog pin
void setup() {
myservo.attach(; // attaches the servo on pin 8 to the servo object
myservo1.attach(9);
myservo2.attach(10);
myservo3.attach(11);
myservo4.attach(12);
}
void loop() {
val0 = analogRead(potpin0); // reads the value of the potentiometer 0 (value between 0 and 1023)
val0 = map(val0, 0, 1023, 0, 180); // scale it to use it with the servo (value between 0 and 180)
myservo.write(val0); // sets the servo position according to the scaled value
delay(15); // waits for the servo to get there
val1 = analogRead(potpin1); // reads the value of the potentiometer 0 (value between 0 and 1023)
val1 = map(val1, 0, 1023, 0, 180); // scale it to use it with the servo (value between 0 and 180)
myservo1.write(val1); // sets the servo position according to the scaled value
delay(15);
val2 = analogRead(potpin2); // reads the value of the potentiometer 0 (value between 0 and 1023)
val2 = map(val2, 0, 1023, 0, 180); // scale it to use it with the servo (value between 0 and 180)
myservo2.write(val2); // sets the servo position according to the scaled value
delay(15);
val3 = analogRead(potpin3); // reads the value of the potentiometer 0 (value between 0 and 1023)
val3 = map(val3, 0, 1023, 0, 180); // scale it to use it with the servo (value between 0 and 180)
myservo3.write(val3); // sets the servo position according to the scaled value
delay(15);
val4 = analogRead(potpin4); // reads the value of the potentiometer 0 (value between 0 and 1023)
val4 = map(val4, 0, 1023, 0, 180); // scale it to use it with the servo (value between 0 and 180)
myservo4.write(val4); // sets the servo position according to the scaled value
delay(15);
}[/code]
Hi,
Here is a general tip.
- Make sure you potentiometer reading is giving you the correct value. If possible, try to do a code that reads the pot values and sends them over the serial port to know what is the actual value when you have 0, 90 and 180 degrees.
The read values will probably be different that what you are expecting.
regards,