connecting multple VL6180X sensors using i2c protocol

I am using multiple vl6180x sensors along with Arduino UNO to detect the light and distance of each sensor. Right now, when I tried to connect three sensors applying i2c protocol(after removing four 10k resistors from two of the sensors for pull up resistors). Results read from serial monitor of Arduino shows the minimum values of three sensors. And the sensitivity, precision for these sensors drop a lot, which I am not satisfied with.

Then I used "digitalWrite" function in Arduino and applied to VL6180X pin "GPIO01-CEO" to enable certain sensor and disable certain sensor in the Arduino code. Wired thing is that it only works when the first time I set them, like if I put something like enable sensor 1, disable sensor 2, disable sensor 3, delay 1s in the loop, it works well. But later if I continue put enable sensor 2, disable sensor 1, disable sensor 3, then the results made no sense, the whole system cant work. Another thing is that I can only enable one sensor at a time, which is fine as it is described as the i2c protocol that only one slave could do the operation at a time.

Also, the address shows on serial monitor by using function " sensor.readReg16Bit(VL6180X::I2C_SLAVE__DEVICE_ADDRESS);" makes no sense once I use "setAddress" function to change the sensor address.

There are some files/ datasheet provided online for vl6180x sensor, declaring that this sensor could apply i2c and make multiple of them working properly. Till now, I don't know if this address problem, changing sensor problem lies on the Arduino side or the sensor side. As there are also many videos on youtube indicates Arduino is totally capable of applying i2c protocol. Any help will be appreciated^^

#include <Wire.h>
#include <VL6180X.h>
#define Address1 0x29
#define Address2 0xA9
#define Address3 0x169

VL6180X sensor;
int pin2 = 2;
int pin4 = 4;
int pin7 = 7;

int pin3 = 3;
int pin5 = 5;
int pin6 = 6;

void setup()
{
  Serial.begin(9600);
  Wire.begin();
  pinMode(pin2,OUTPUT);
  pinMode(pin4,OUTPUT);
  pinMode(pin7,OUTPUT);

  pinMode(pin3,OUTPUT);
  pinMode(pin5,OUTPUT);
  pinMode(pin6,OUTPUT);

  digitalWrite(pin2,HIGH);
  digitalWrite(pin4,HIGH);
  digitalWrite(pin7,HIGH);

  digitalWrite(pin3,HIGH);
  digitalWrite(pin5,HIGH);
  digitalWrite(pin6,HIGH);

  sensor.init();
  sensor.configureDefault();

  Wire.beginTransmission(0x29);
  int error = Wire.endTransmission();
  Serial.println(error);
 // Wire.beginTransmission(VL6180X::I2C_SLAVE__DEVICE_ADDRESS);
 // Wire.read(0x52);
  // Reduce range max convergence time and ALS integration
  // time to 30 ms and 50 ms, respectively, to allow 10 Hz
  // operation (as suggested by Table 6 ("Interleaved mode
  // limits (10 Hz operation)") in the datasheet).
  sensor.readReg16Bit(VL6180X::I2C_SLAVE__DEVICE_ADDRESS);
  sensor.writeReg(VL6180X::SYSRANGE__MAX_CONVERGENCE_TIME, 30);
  sensor.writeReg16Bit(VL6180X::SYSALS__INTEGRATION_PERIOD, 50);
 // sensor.writeReg16Bit(VL6180X::SYSTEM__MODE_GPIO0,0);
  sensor.writeReg16Bit(VL6180X::INTERLEAVED_MODE__ENABLE,0);
 // sensor.setAddress(VL6180X::I2C_SLAVE__DEVICE_ADDRESS);
  sensor.setTimeout(500);
   // stop continuous mode if already active
  sensor.stopContinuous();
  // in case stopContinuous() triggered a single-shot
  // measurement, wait for it to complete
  delay(300);
  // start interleaved continuous mode with period of 100 ms
  sensor.startInterleavedContinuous(100);
  //sensor.setAddress(Address1);
////  sensor1.setAddress(Address2);
//  sensor1.init();
//  sensor1.configureDefault();
//  //sensor1.setAddress(Address4);
//  sensor1.writeReg(VL6180X::SYSRANGE__MAX_CONVERGENCE_TIME, 30);
//  sensor1.writeReg16Bit(VL6180X::SYSALS__INTEGRATION_PERIOD, 50);
//  sensor1.setTimeout(500);
//  sensor1.stopContinuous();
//  delay(300);
//  sensor1.startInterleavedContinuous(100);


}


void loop()
{

//  digitalWrite(pin2,HIGH);
//  digitalWrite(pin4,HIGH);
//  digitalWrite(pin7,HIGH);
//  digitalWrite(pin3,HIGH);
//  digitalWrite(pin5,HIGH);
//  digitalWrite(pin6,HIGH);
//  int input = random(1,4);
//  Serial.println(input);
//  if (input == 1){
//     hello1();
//   //  int error = Wire.endTransmission();
// // Serial.println(error);
//  }
// 
//  else if (input == 2){
//    hello2();
//    //int error = Wire.endTransmission();
//  //Serial.println(error);
//  }
//
//  else if (input == 3) {
//     hello3();
//   //  int error = Wire.endTransmission();
// // Serial.println(error);
//  }
   hello1();
 //   hello2();
  //  hello3();

//  Serial.print(sensor.readReg16Bit(VL6180X::SYSTEM__MODE_GPIO0));
//  Serial.println();
////  Wire.beginTransmission(0x00);
////  Wire.write(0);
////  Wire.endTransmission();
////  sensor.setAddress(VL6180X::I2C_SLAVE__DEVICE_ADDRESS);
//  //sensor.setAddress(Address2);
//  //digitalWrite(pin4,HIGH);
// // digitalWrite(pin4,HIGH);
//  //digitalWrite(pin7,HIGH);
//  Serial.print("Ambient 1: ");
//  Serial.print(sensor.readAmbientContinuous());
//  if (sensor.timeoutOccurred()) { Serial.print(" TIMEOUT"); }
//
//  Serial.print("\tRange 1: ");
//  Serial.print(sensor.readRangeContinuousMillimeters());
//  if (sensor.timeoutOccurred()) { Serial.print(" TIMEOUT"); }
//
//  Serial.println();
//  
//  delay(1000);

}
void hello1(){
  sensor.setAddress(0x80);
  Wire.beginTransmission(0x80);
  int error = Wire.endTransmission();
  Serial.println(error);
  digitalWrite(pin2,HIGH);
  digitalWrite(pin4,HIGH);
  digitalWrite(pin7,HIGH);
  digitalWrite(pin3,LOW);
  digitalWrite(pin5,LOW);
  digitalWrite(pin6,HIGH);

  sensor.setAddress(Address1);
  Serial.print(sensor.readReg16Bit(VL6180X::SYSTEM__MODE_GPIO0));
  Serial.println();

  Serial.print("Ambient 1: ");
  Serial.print(sensor.readAmbientContinuous());
  if (sensor.timeoutOccurred()) { Serial.print(" TIMEOUT"); }

  Serial.print("\tRange 1: ");
  Serial.print(sensor.readRangeContinuousMillimeters());
  if (sensor.timeoutOccurred()) { Serial.print(" TIMEOUT"); }

  Serial.println();

  delay(1000);
}
void hello2(){
  sensor.setAddress(0x82);
  Wire.beginTransmission(0x82);
  int error = Wire.endTransmission();
  Serial.println(error);
  digitalWrite(pin2,HIGH);
  digitalWrite(pin4,HIGH);
  digitalWrite(pin7,HIGH);
  digitalWrite(pin3,LOW);
  digitalWrite(pin5,HIGH);
  digitalWrite(pin6,LOW);
  sensor.setAddress(Address2);
  //sensor.setAddress(VL6180X::I2C_SLAVE__DEVICE_ADDRESS);
  Serial.print(sensor.readReg16Bit(VL6180X::SYSTEM__MODE_GPIO0));
  Serial.println();
  Serial.print("Ambient 2: ");
  Serial.print(sensor.readAmbientContinuous());
  if (sensor.timeoutOccurred()) { Serial.print(" TIMEOUT"); }

  Serial.print("\tRange 2: ");
  Serial.print(sensor.readRangeContinuousMillimeters());
  if (sensor.timeoutOccurred()) { Serial.print(" TIMEOUT"); }

  Serial.println();

  delay(1000);
}

void hello3(){
  sensor.setAddress(0x84);
  Wire.beginTransmission(0x84);
  int error = Wire.endTransmission();
  Serial.println(error);
  digitalWrite(pin2,HIGH);
  digitalWrite(pin4,HIGH);
  digitalWrite(pin7,HIGH);
  digitalWrite(pin3,HIGH);
  digitalWrite(pin5,LOW);
  digitalWrite(pin6,LOW);

  sensor.setAddress(Address3);
  Serial.print(sensor.readReg16Bit(VL6180X::SYSTEM__MODE_GPIO0));
  Serial.println();
  Serial.print("Ambient 3: ");
  Serial.print(sensor.readAmbientContinuous());
  if (sensor.timeoutOccurred()) { Serial.print(" TIMEOUT"); }

  Serial.print("\tRange 3: ");
  Serial.print(sensor.readRangeContinuousMillimeters());
  if (sensor.timeoutOccurred()) { Serial.print(" TIMEOUT"); }

  Serial.println();

  delay(1000);

}

Manufacturer's page : http://www.st.com/content/st_com/en/products/imaging-and-photonics-solutions/proximity-sensors/vl6180x.html

Run the i2c_scanner : Arduino Playground - I2cScanner
If each sensor has a different I2C address, then the i2c_scanner should detect all three.
You have address 0x169 for Address3, but that is not possible.

The sensor uses a very strange voltage of 2.8V. Functional range is 2.6V to 3.0V (optimal range 2.7V to 2.9V). How did you create that voltage ? How did you connect the SDA and SCL to the Arduino ? You should use a level shifter to connect the 2.8V I2C bus of the sensor to the 5V I2C bus of the Arduino Uno.
You may not connect a Arduino output pin (which is 5V when set HIGH) to the sensor.

Is it allowed to use "GPIO01-CEO" to enable the chip ? I can't read that in the datasheet. According to the datasheet the "GPIO0" can be used to set the chip in standby mode.

I am trying to use vl6180x distance sensor and Arduino UNO board for individual sensor doing individual distance sensing. This sensor follows the i2c protocol. Since for the same type of sensor, i2c protocol says that they would all have the same address. I am thinking about using the chip enable pin(GPIO00) on the sensor chip to toggle sensor when do the distance measuring.

I am able to update the address of the sensor group now. But I think to obtain individual results from different sensors on serial monitor of Arduino. Right now I can only do one time setup sensor thing (like I couldn't update and toggle around different sensors). Once I started to do that, the results from serial monitor were just wrong. Any advice that I can continue toggle around the sensor and make them work from utilize the GPIO00 pin?

Any help would be appreciated!

#include <Wire.h>
#include <VL6180X.h>
#define Address1 0x20
#define Address2 0x22
#define Address3 0x24

VL6180X sensor;

int pin2 = 2;
int pin3 = 3;
int pin4 = 4;


void setup()
{
  Serial.begin(9600);
  Wire.begin();
  pinMode(pin2,OUTPUT);
  pinMode(pin3,OUTPUT);
  pinMode(pin4,OUTPUT);

  digitalWrite(pin2,HIGH);
  digitalWrite(pin3,HIGH);
  digitalWrite(pin4,HIGH);

  sensor.init();
  sensor.configureDefault();
  sensor.writeReg(VL6180X::SYSRANGE__MAX_CONVERGENCE_TIME, 30);
  sensor.writeReg16Bit(VL6180X::SYSALS__INTEGRATION_PERIOD, 50);
  sensor.writeReg16Bit(VL6180X::INTERLEAVED_MODE__ENABLE,0);
  sensor.setTimeout(500);
  sensor.stopContinuous();
  delay(300);
  sensor.startInterleavedContinuous(100);

}
void loop()
{
//       hello1();
//       delay(1000);

       hello2();
       delay(1000);
//
//       hello3();
//       delay(1000);
//  int input = random(1,4);
//  Serial.println(input);
//  if (input == 1){
//     sensor.setAddress(0x52);
//     Serial.println(sensor.readReg(0x212),HEX);
//     hello1();
//     delay(300);
//     sensor.writeReg(0x212,0x52);
//  }
// 
//  else if (input == 2){
//    sensor.setAddress(0x52);
//    Serial.println(sensor.readReg(0x212),HEX);
//    hello2();
//    delay(300);
//    sensor.writeReg(0x212,0x52);
//  }
//
//
//  else if (input == 3) {
//     sensor.setAddress(0x52);
//     Serial.println(sensor.readReg(0x212),HEX);
//     hello3();
//     delay(300);
//     sensor.writeReg(0x212,0x52);
//  }

}
void hello1(){
    sensor.setAddress(0x29);
    Serial.println(sensor.readReg(0x212),HEX);
    sensor.setAddress(Address1);
//  Wire.beginTransmission(Address1);
//  int error = Wire.endTransmission();
//  Serial.println(error);

    sensor.writeReg(0x212,Address1);
    Serial.println(sensor.readReg(0x212),HEX);
    Serial.println();

    digitalWrite(pin2,HIGH);
    digitalWrite(pin3,LOW);
    digitalWrite(pin4,LOW);

    Serial.print("Ambient 1: ");
    Serial.print(sensor.readAmbientContinuous());
    if (sensor.timeoutOccurred()) { Serial.print(" TIMEOUT"); }

    Serial.print("\tRange 1: ");
    Serial.print(sensor.readRangeContinuousMillimeters());
    if (sensor.timeoutOccurred()) { Serial.print(" TIMEOUT"); }

    Serial.println();
    sensor.writeReg(0x212,0x52);
    digitalWrite(pin2,HIGH);
    digitalWrite(pin3,HIGH);
    digitalWrite(pin4,HIGH);
}

void hello2(){
    sensor.setAddress(0x52);
    Serial.println(sensor.readReg(0x212),HEX);
    sensor.setAddress(Address2);
//  Wire.beginTransmission(Address2);
//  int error = Wire.endTransmission();
//  Serial.println(error);

    sensor.writeReg(0x212,Address2);
    Serial.println(sensor.readReg(0x212),HEX);
    Serial.println();

    digitalWrite(pin2,LOW);
    digitalWrite(pin3,HIGH);
    digitalWrite(pin4,LOW);

    Serial.print("Ambient 2: ");
    Serial.print(sensor.readAmbientContinuous());
    if (sensor.timeoutOccurred()) { Serial.print(" TIMEOUT"); }

    Serial.print("\tRange 2: ");
    Serial.print(sensor.readRangeContinuousMillimeters());
    if (sensor.timeoutOccurred()) { Serial.print(" TIMEOUT"); }

    Serial.println();
    sensor.writeReg(0x212,0x52);
//    digitalWrite(pin2,HIGH);
//    digitalWrite(pin3,HIGH);
//    digitalWrite(pin4,HIGH);


}

void hello3(){
    sensor.setAddress(0x52);
    Serial.println(sensor.readReg(0x212),HEX);
    sensor.setAddress(Address3);
    sensor.writeReg(0x212,Address3);
    Serial.println(sensor.readReg(0x212),HEX);
    Serial.println();

    digitalWrite(pin2,LOW);
    digitalWrite(pin3,LOW);
    digitalWrite(pin4,HIGH);

    Serial.print("Ambient 3: ");
    Serial.print(sensor.readAmbientContinuous());
    if (sensor.timeoutOccurred()) { Serial.print(" TIMEOUT"); }

    Serial.print("\tRange 3: ");
    Serial.print(sensor.readRangeContinuousMillimeters());
    if (sensor.timeoutOccurred()) { Serial.print(" TIMEOUT"); }

    Serial.println();
    sensor.writeReg(0x212,0x52);
//    digitalWrite(pin2,HIGH);
//    digitalWrite(pin3,HIGH);
//    digitalWrite(pin4,HIGH);
}

I have similar problem with connecting more than one of this sensors - anyone knows how to change their i2c address?
thx