I2C interface HCLA pressure sensors (Value doesn't change)

Hello people!!

I am in a bit need of a support yet again!!

Well I am just writing an I2C interface for communicating and reading digital pressure values from HCLA02X5EB (amplified pressure sensors range) sensor from SensorTechnics (First-Sensors) using ARDUINO UNO board.

I am attaching the used sketch for the communication I have been able to develop using the help from the forums.

Now the problem is.. That the sensor is constantly showing a fixed pressure value on the Serial monitor.. Even if I blow air into the port the value does not change.. I have also tried changing the sensors with brand new... but the problem persist...

As given in the I2C application note (http://www.first-sensor.com/cms/upload/appnotes/AN_I2C-Bus_HMI_HDI_HCLA_HCA_SSI_E_11155.pdf), I have also checked the analog output of the sensor.. But surprisingly it shows also a fixed value of 2.23-2.25 V

This voltage, according to the datasheet (http://www.first-sensor.com/cms/upload/datasheets/DS_Standard-HCLA_E_11629.pdf), is the default zero-offset

What is it going wrong here...

Please help!!

Deeply appreciate your support! :slight_smile: :slight_smile:

Regards

Pramit

I am totally confused about the reason for this problem

Pressure_sensor_check.ino (1.59 KB)

Please post your code within code tags (</> above the smileys). Many people on the forum will not download attached code. The reason can be that they have a phone or tablet that can't run the IDE to view your code. For me, I just don't want another folder in my sketchbook which will be created if I download the code to view in my IDE.

Have you ran an I2C scanner to verify the address of and communication with your sensor?

Ahh ok...

Thanks so much for the insight... :slight_smile: Here is the code

#include <Wire.h>

float pressure_diff = 0;
int P_counts_diff;        // 16bit value
float sensitivity_p_diff = 0;
byte byte_MSB;
byte byte_LSB;
#define P_min_diff -25       // min. for the differential pressure sensor
#define P_max_diff 25     // max. for the differential pressure sensor
#define press_sensor 0x78
#define Out_min 1638     // min. counts for the sensors (same for both sensors)
#define Out_max 27852 // max. counts for the sensors (same for both sensors)


void setup(){
  Serial.begin(9600);
 // delay(1000);
  Wire.begin();
}

float read_press (){
    // initiate measurement
  Wire.beginTransmission(press_sensor);
  Wire.write(0);
  Wire.available();
  int Ack = Wire.read(); // receive a byte
  Wire.endTransmission(); 
  delay(1000); //This particular delay is the delay between the displayed values (in msec)...

  // READ DATA from here on
  Wire.beginTransmission(press_sensor);
  Wire.requestFrom(press_sensor,2);  //Reade 1 byte
  Wire.available();
  byte_MSB = Wire.read(); // receive most significant byte
  byte_LSB = Wire.read(); // receive least significant byte
  P_counts_diff = ((int)byte_MSB << 8) | byte_LSB; // Putting both bytes together
  sensitivity_p_diff = (Out_max - Out_min)/(P_max_diff - P_min_diff); // calculate the differential pressure sensors sensitivity
  pressure_diff = (P_counts_diff - Out_min)/sensitivity_p_diff + P_min_diff;   // calculate the differential pressure in [mbar]
  return pressure_diff;
  Wire.endTransmission();
}

void loop(){
  float Differential_pressure = read_press();
  Serial.print("pressure in mBar : ");
  Serial.println(Differential_pressure);
}

Yes I have run the I2C scanner... And there is a peculiar thing I have noticed that it shows two addresses for the same sensor.. 0x78 (which is default) and another which is programmed...

This other address is somehow fishy.. because if I open a new sensor, it should work on the default address only...

Any comments?

Pramit

Test this:



#include <Wire.h>

float pressure_diff = 0;
int P_counts_diff;        // 16bit value
float sensitivity_p_diff = 0;
word byte_MSB;
byte byte_LSB;
#define P_min_diff -12.5       // min. for the differential pressure sensor
#define P_max_diff 12.5     // max. for the differential pressure sensor
#define press_sensor 0x78
#define Out_min 1638     // min. counts for the sensors (same for both sensors)
#define Out_max 27852 // max. counts for the sensors (same for both sensors)


void setup(){
  Serial.begin(9600);
 // delay(1000);
  Wire.begin();
}

float read_press (){
    // initiate measurement
  /*wire.beginTransmission(press_sensor);
  Wire.write(0);
  Wire.available();
  int Ack = Wire.read(); // receive a byte
  Wire.endTransmission();*/ 
  delay(1000); //This particular delay is the delay between the displayed values (in msec)...

  // READ DATA from here on
  Wire.beginTransmission(press_sensor);
  Wire.requestFrom(press_sensor,2);  //Reade 1 byte
  Wire.available();
  byte_MSB = Wire.read(); // receive most significant byte
  byte_LSB = Wire.read(); // receive least significant byte
  P_counts_diff = 0;
  P_counts_diff = ((int)(byte_MSB << 8 | byte_LSB)); // Putting both bytes together
  //Serial.print(P_max_diff - P_min_diff);
  sensitivity_p_diff = (Out_max - Out_min)/(P_max_diff - P_min_diff); // calculate the differential pressure sensors sensitivity
  pressure_diff = (P_counts_diff - Out_min)/sensitivity_p_diff + P_min_diff;   // calculate the differential pressure in [mbar]
  return pressure_diff;
  Wire.endTransmission();
}

void loop(){
  float Differential_pressure = read_press();
  Serial.print("pressure in mBar : ");
  Serial.println(Differential_pressure);
}