Cross talk problem

I am using flex sensors to make a glove to control a robotic hand. I used a arduino uno and also tried an arduino mega but when I bend one flex sensor there is cross talk from the arduino analog read pins. I tried adding different power sources but nothing has worked so far.

Please post the code (using code tags), and a wiring diagram. There are ADC input restrictions that need to be obeyed, like voltage source impedance less than 10K Ohms.

1 Like

// #include <Servo.h>

// Servo servo1;  // create servo object to control a servo
// // Servo servo2;

int potpin = A0;  // analog pin used to connect the potentiometer
int potpin2 = A1;
int potpin3 = A2;
int potpin4 = A3;
int val;    // variable to read the value from the analog pin
int val2;
int val3;
int val4;

// int potpin2 = A2;
// int val2;


void setup() {
  // servo1.attach(10);  // attaches the servo on pin 9 to the servo object
  // servo2.attach(10);
  Serial.begin(9600);
  // servo1.write(180);
  // delay(1000);
  // servo1.write(0);
  // delay(1000);
  // servo1.write(90); 
}

void loop() {
  val = analogRead(potpin); 
  val2 = analogRead(potpin2);
  val3 = analogRead(potpin3);
  val4 = analogRead(potpin4);
  // val2 = analogRead(potpin2);
  Serial.print("thumb: ");
  Serial.print(val);
  Serial.print("index: ");
  Serial.print(val2);
  Serial.print("middle: ");
  Serial.print(val3);
  Serial.print("ring: ");
  Serial.println(val4);
  // Serial.println(val2);
  // val = map(val, 0, 1023, 0, 180);     // scale it for use with the servo (value between 0 and 180)
  // val2 = map(val2, 0, 1023, 0, 180);
  // servo1.write(180);
  // delay(1000);
  // servo1.write(0);
  // delay(1000);
  // servo1.write(90); 
  // servo2.write(val2);
  //myservo2.write(val2);
   
                 // sets the servo position according to the scaled value
  delay(450);                           // waits for the servo to get there
}

Post the wiring diagram, with pins, connections, parts and values clearly labeled.

I doubt it`s a crosstalk, you are printing raw data...with 450mS delay in a main loop.
For a start, connect 10-100nF caps from each ADC input to GND.

  • read post #4



The diagram is this but 4 times

If you used 10K resistors, in the voltage dividers, that should be OK.

Try this approach, reading each pin twice:

  val = analogRead(potpin); //toss this reading
  val = analogRead(potpin);  
  val2 = analogRead(potpin2); //toss
  val2 = analogRead(potpin2);
  val3 = analogRead(potpin3); //toss
  val3 = analogRead(potpin3);
  val4 = analogRead(potpin4); //toss
  val4 = analogRead(potpin4);
1 Like

Can you share the output you are getting?

You should not power the Servos from the 5v Arduino pin. Use a 5V external power source.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.