Potentiometer Input to Botboarduino

Hello all!

I am trying to build a robot arm using 5 servos. My idea to control this robot arm is to create a scale model of the robot arm with wood. The user would then manipulate that model of a robot arm, and the actual robot arm would mimic its movements. In order to do this, I want to put potentiometers at the joints of the scale model to measure the angles in between each part of the arm. The values of the potentiometers would then be scaled to match the range of the servos, and then those values would be written to the servos, thus creating mimicked moment.

To test this, I have connected only one potentiometer to my arduino board. I am using the Lynxmotion Botboarduino to control my robot arm. I have my code listed below, its fairly simple. All I was trying to do is connect the potentiometer to the board at the analog pin 3 (this is within the set of analog pins where the leftmost pin of each set of three is TX, the middle is RX, and the rightmost is Gnd) and then use the serial monitor to measure the input. However, when I connect the potentiometer to analog pin 3 and begin turning the knob left and right, there is no change in value within the serial monitor; it just stays at zero. I know that the potentiometer is affecting that pin though because when I remove the potentiometer, the value for that pin begins to oscillate around 250 (sometimes anywhere between 100 and 400). This potentiometer has a range of 0 - 1023, and it works when I test it with my Arduino Micro.

How do you think I can solve this?

[code]int potPin = A3; // select the input pin for the potentiometer
int value = 0; // variable to store the value coming from the sensor

void setup() {

// initialize serial
Serial.begin(9600);

}

void loop() {

value = analogRead(potPin);

Serial.print(value);
Serial.println();

}[/code]






Sort of like this? youtube.com/watch?v=F-5-ymKTiMU
Start with one potentiometer (connected to an analog input) and one servo at a time. You’ll get it.
You need to map the potentiometer position to a servo position using a simple equation.
github.com/Lynxmotion/BotBoardu … ing%20pots

Yeah that humanoid robot suit is very similar to what I’m trying to do. I did look at that script before, and it looks very similar to what I have, except it has GetValue as a function rather than analogRead. Should I be using get value?

We used analog read. Feel free to experiment.

Hi,

The int GetValue(int apin) function does some extra processing on top of analogRead() to prevent various issues. That extra work includes changing to the pin and preparing it (basically perform a read and waiting) and also taking two measurements and averaging them.

We hope this helps.

Sincerely,

Thanks guys, you responded really quickly. I’m going to try those out next time I have access to my robot arm and I will update you on how they go. I will try substituting my analogRead for scharette’s GetValue function, and I will try the RC Control script in its entirety