Using PCF8575 with Arduino Uno and Humidity Sensor

Hey guys!

I am working with Arduino Uno and an I2C multiplexer (In principle I need to multiplex over 2 channels)

I just ordered a breakout board from ebay thinking the chip would be PCA9548A (8-channel) from TI. But it seemed that I instead received a breakout board with PCF8575 chip from TI… It has only the chip and on-board pull-up resistors for SDA,SCL lines connecting to Arduino

I ahve never used this chip… therefore I just needed some instant help… I am going through the datasheet but due to immense shortage of time, I am forced to ask “quick” help from you guys…

I have written this code:

#include <Wire.h>

double Temperature;
double Humidity;
#define HYT221_ADDR 0x24
#define I2C_Multip_Addr 0x24 // according to the I@C scanner, 0x24 is the address shown...
void setup(){
  Serial.begin(9600);
  Serial.println("CLEARDATA");  // PLX-DAQ command
  Serial.println("LABEL,Time,Humidity(%),Temperature(degC),Pressure1(mBar),Pressure2(mBar)"); // PLX-DAQ command
  delay(1000);
  Wire.begin(); 
}

void getchannel(){
        byte Control_Reg = 0x80; // or any other value selecting any channel
        Wire.beginTransmission(I2C_Multip_Addr);
        if (Control_Reg == 0x00){Wire.write(0x00);}
        else{
          Wire.write(Control_Reg);     //set to selected channels
        }
        Wire.endTransmission();
}
 void read_HumTemp(){
    // initiate measurement
  Wire.beginTransmission(HYT221_ADDR);
  Wire.write(0);
  Wire.available();
  int Ack = Wire.read(); // receive a byte
  Wire.endTransmission(); 
  delay(100); //This particular delay is the delay between the displayed values (in msec)...

// READ DATA from here on
  Wire.beginTransmission(HYT221_ADDR);
  Wire.requestFrom(HYT221_ADDR,4);  //Reade 1 byte
  Wire.available();
  int b1 = Wire.read(); // receive a byte
  int b2 = Wire.read(); // receive a byte
  int b3 = Wire.read(); // receive a byte
  int b4 = Wire.read(); // receive a byte
  Wire.write(0); //NACK

  // combine the bits
  int RawHumidBin = b1 << 8 | b2;
  // compound bitwise to get 14 bit measurement first two bits
  // are status/stall bit (see intro text)
  RawHumidBin =  (RawHumidBin &= 0x3FFF); 
  Humidity = 100.0/pow(2,14)*RawHumidBin;

  b4 = (b4 &= 0x3F); //Mask away 2 least sign. bits see HYT 221 doc
  int RawTempBin = b3 << 6 | b4;
  Temperature = 165.0/pow(2,14)*RawTempBin-40;

  Wire.endTransmission();
}

void loop(){
    delay(1000); //This particular delay is the delay between the displayed values (in msec)...
    getchannel();
    read_HumTemp();
Serial.print("Humidity in % :");
    Serial.print("DATA,TIME,"); // PLX-DAQ Macro command...
    Serial.print(Humidity);
    Serial.print(",") ;
    Serial.println(Temperature);
}

Here I am just addressing the chip from Arduino and then selecting a channel from the I2C multiplexer and trying to read data from Humidity Sensor… I am guessing that my code would work fine with PCA9548A but is it also good fro PCF8575 ??

What changes should I be making…

Deeply appreciate Your inputs!!

Warmest Regards

Pramit