Problems with getting data from pressure sensor

Hi! So I am facing a problem w getting data from a pressure sensor. Everything works except that when the data comes up, I only nan on every aspect.

I am not quite sure where the problem lies and would love to get some help on that (:

Here is the wiring:

Here is the code:

#include "Adafruit_BMP280.h"

 
Adafruit_BMP280 bmp;
 
void setup() {
    bmp.begin();
 
    Serial.begin(9600);
    Serial.println("Start of measurements");
}
 
void loop() {
    float t = bmp.readTemperature();
    float p = bmp.readPressure();
    float h = bmp.readAltitude(1012.3);
 
    Serial.print("Temperature = "); 
    Serial.print(t); 
    Serial.print(" *C"); 
 
    Serial.print("Pressure = "); 
    Serial.print(p); 
    Serial.print(" Pa"); 
 
    Serial.print("Altitude = "); 
    Serial.print(h); 
    Serial.print(" m"); 
 
    Serial.println();
    delay(2000);
}

Use this Adafruit BMP280 Library example and say what happened.

Hi, thanks for your reply! I have tried the code which you sent but I still can't seem to get any data. when using the code you suggested, the program has an error and says to check the wiring, although I think the wiring is correct...

You may have a bad pull up resistor on the board. Try adding a pull-up to SDA and SCK. Run the I2C scanner before and again after adding the resistors and let us know what you get.

Hi! Thanks for your reply! Unfortunately, it still did not work and I still keep getting nan for all my values...

You need to solder those header pins on the BMP280 breakout board.

You can't expect to get a proper connection with the pins just pushed in the holes of the PCB.

Solder Me

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