cancel
Showing results for 
Search instead for 
Did you mean: 

lps22hb i2c interface(erorrs)

Legacy member
Not applicable

Hello, 

We want to operate the LPS22HB pressure sensor with the i2c protocol. The pin legs of the sensor are connected to the SCL - SDA 4.7k ohm pull-up resistors. Sa0/GND   Csi / 3.3  RES / GND. This is how connections are made. This way we can't get data from the sensor. What is the reason of this?

 

10 REPLIES 10
Legacy member
Not applicable
Legacy member
Not applicable
Foued_KH
ST Employee

Hello @Legacy member , 

First please make sur that your are using the correct address. You can use an oscilloscope to check SDA and SCL behavior.
Could you share the code ? 

Foued

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Legacy member
Not applicable

@Foued_KH  Thankk youu <3

All settings are used by default. The code is the library ready code written in arduino. Address 5C and all of its derivatives have been tested by changing the test from within the library. The interrupt pin is not connected anywhere, any problem occurs?


#include <Arduino_LPS22HB.h>

void setup() {
  Serial.begin(9600);
  while (!Serial);

  if (!BARO.begin()) {
    Serial.println("Failed to initialize pressure sensor!");
    while (1);
  }
}

void loop() {
  // read the sensor value
  float pressure = BARO.readPressure();

  // print the sensor value
  Serial.print("Pressure = ");
  Serial.print(pressure);
  Serial.println(" kPa");

  float temperature = BARO.readTemperature();

  // print the sensor value
  Serial.print("Temperature = ");
  Serial.print(temperature);
  Serial.println(" C");

  // print an empty line
  Serial.println();

  // wait 1 second to print again
  delay(1000);
}
Legacy member
Not applicable
Foued_KH
ST Employee

For I2C communication, 2 pins are required to interface, as this :
VDD to 3.3V DC
SCL to A5
SDA to A4
GND to common groud

Foued

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Sinoplu57
Associate

@KHALSI_Foued 

I've already done what you said, I can't get it to work.
 
Federica Bossi
ST Employee

Hi,

The I2C address for LPS22HB is 0xBA or 0xB8 according with SA0  (datasheet page 26).

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
Sinoplu57
Associate

We tried the solutions you suggested but we can't get a solution. Do you have any other suggestions?