I2C/Qwicc inputs merging?

Hello, I have a flex sensor glove made from this website. When I run this code:

#include <SparkFun_ADS1015_Arduino_Library.h>

ADS1015 pinkySensor;
ADS1015 indexSensor;
uint16_t hand[4] = {0, 0, 0, 0};

void setup() { 
  Wire.begin();
  Serial.begin(115200);

  //Set up each sensor, change the addresses based on the location of each sensor
  if (pinkySensor.begin() == false) {
     Serial.println("Pinky not found. Check wiring.");
     while (1);
  }
  if (indexSensor.begin() == false) {
     Serial.println("Index not found. Check wiring.");
     while (1);
  }  
  pinkySensor.setGain(ADS1015_CONFIG_PGA_TWOTHIRDS); // Gain of 2/3 to works well with flex glove board voltage swings (default is gain of 2)
  indexSensor.setGain(ADS1015_CONFIG_PGA_TWOTHIRDS); // Gain of 2/3 to works well with flex glove board voltage swings (default is gain of 2)
}

void loop() {  
  uint16_t data;
  //Read and print our data
  for (int finger = 0; finger < 2; finger++) {
    hand[finger] = indexSensor.getAnalogData(finger);
    hand[finger + 2] = pinkySensor.getAnalogData(finger);
  }
  for (int finger = 0; finger < 4; finger++)
  {
    Serial.print(finger);
    Serial.print(": ");
    Serial.print(hand[finger]);
    Serial.print(" ");
  }
  Serial.println();
}

and plug only one of the flex sensor boards in, it works fine, with input 0 and 1 being repeated on input 2 and 3. However, when I plug in another flex sensor board into any of the I2C ports on the qwicc connect shield it makes the inputs merge I think. For example, if input 0 is 905 and input 1 is 918 when only one flex sensor board is plugged in, when I plug in the other flex sensor board and flex it, input 0 and 1 change to 10 and 8(and repeat on input 2 and 3). When I flex the first flex sensor board I plugged in the inputs change back to around 905 and 918. Any ideas on how I can separate the four inputs, or if it's an entirely different issue?

Thanks in advance,
Jai

you need to change i2c address for one of the modules i2c can't connect 2 device with same i2c address

Thanks for the reply, I'm new to the I2C thing. How would I go about changing the i2c address?

to answer this you have to provide a datasheet of the electronics that is connected to the flex-sensors. For most I2C-electronics they have one or two or three inputs that can be connected to ground or to Vcc to adjust to different I2C-adresses.

As a general hint: the microcontrollerworld is not super-standardised like USB-devices. You have to take care about more details than "does the plug fit into the socket"

best regards Stefan

Thanks, here is the datasheet. Apparently my board(ADS1015) does have an ADDR line for changing the address but I'm not sure how I would go about this. Would I have to make a physical change or could I code it?

check the link you send
its show how to change i2c address

This forum is supporting help to help yourself.

read the datasheet. Quote from the datasheet

  • for drawings of the datasheet you can use the take-picture-feature of almost any PDF-viewer
  • for text use mark, copy and past the text

and then ask specific questions

or look up general basics about the I2C-bus

best regards Stefan

Thanks for the advice! I think I've got the solution, I just need to cut the jumper to GND and Sauder a wire to SDA. I was being an idiot and didn't look on the back of the board for jumper connections. Thanks for helping me learn more about i2c!

Jai.

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