LPS28DFW arduino

Hello,

Actually i'm trying to mesure the pressure using LPS28DFW and arduino uno, but i have some problems, the i2c communication does not working.

Can help me please and thank you.

arduino code :

#include <Wire.h>
#include "SparkFun_LPS28DFW_Arduino_Library.h"

// Create a new sensor object
LPS28DFW pressureSensor;

// I2C address selection
uint8_t i2cAddress = LPS28DFW_I2C_ADDRESS_DEFAULT; // 0x5C
//uint8_t i2cAddress = LPS28DFW_I2C_ADDRESS_SECONDARY; // 0x5D

void setup()
{
// Start serial
Serial.begin(115200);
Serial.println("LPS28DFW Example 1 - Basic Readings!");

// Initialize the I2C library
Wire.begin();

// Check if sensor is connected and initialize
// Address is optional (defaults to 0x5C)
while(pressureSensor.begin(i2cAddress) != LPS28DFW_OK)
{
    // Not connected, inform user
    Serial.println("Error: LPS28DFW not connected, check wiring and I2C address!");

    // Wait a bit to see if connection is established
    delay(1000);
}

Serial.println("LPS28DFW connected!");

}

void loop()
{
// Get measurements from the sensor. This must be called before accessing
// the pressure data, otherwise it will never update
pressureSensor.getSensorData();

// Print temperature and pressure
Serial.print("Temperature (C): ");
Serial.print(pressureSensor.data.heat.deg_c);
Serial.print("\t\t");
Serial.print("Pressure (hPa): ");
Serial.println(pressureSensor.data.pressure.hpa);

// Only print every second
delay(1000);

}

Sorry I cannot follow your code and i am not familiar with your sensor. Go back and read the forum guidelines and post your code accordingly using code tags. Also post your annotated schematic and a link to your sensor that gives technical information, market place links such as azon and ae are generally useless.

Please edit your post to add code tags.

With a new I2C sensor, always test communications by running the I2C Address Scanner program, and verify that the intended code uses the same I2C address that the sensor reports.

If the scanner program fails to detect the sensor, verify the wiring and whether the required pullup resistors are present on the SDA and SCL pins.

Logic level shifters are required when connecting a 5V Arduino and a 3.3V sensor.

1 Like

Thank you for replying..
Have any idea for test program for the I2C communication ?

the sensor is the lps28dfw like in the picture with the arduino code
Example1_BasicReadings.ino (1,3 Ko)
all the time i got in the serial monitor ""LPS28DFW Example 1 - Basic Readings!"" means that the I2C communication does not work

Hello,
I'm using pressure sensor LPS28DFW like in the picture.


with the following arduino code
Example1_BasicReadings.ino (1,3 Ko)
lps28dfw
when i'm running the code, the serial monitor indicate only ""LPS28DFW Example 1 - Basic Readings!" ", no pressure value .... means thant the I2C communication does not work.
Can you help me please ?

Please do not open a duplicate threads about the same subject, it is a violation of the forum rules.

1 Like

I merged your cross-posts @mlajm.

Cross-posting is against the Arduino forum rules. The reason is that duplicate posts can waste the time of the people trying to help. Someone might spend a lot of time investigating and writing a detailed answer on one topic, without knowing that someone else already did the same in the other topic.

Repeated cross-posting can result in a suspension from the forum.

In the future, please only create one topic for each distinct subject matter. This is basic forum etiquette, as explained in the "How to get the best out of this forum" guide. It contains a lot of other useful information. Please read it.

Thanks in advance for your cooperation.

1 Like

I2C Address Scanner

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