In theory this code should work. Is there an issue with our sensor? Do we need to buy a new one? I also don't really understand where the 44330.00 is coming from with the altitude.
In theory this code should work. Is there an issue with our sensor? Do we need to buy a new one? I also don't really understand where the 44330.00 is coming from with the altitude.
In theory this code should work. Is there an issue with our sensor? I also don't really understand where the 44330.00 is coming from with the altitude.
Why is my BME280 sensor returning 0 for all data values?
My BME280 is returning 0 for temperature in Celsius, 0% humidity, 0.00 pressure (hPa) and 44330.00m for altitude. I am connecting it with I2C on a Raspberry Pi Pico and everyone on the team has checked the wiring so we are relatively certain that it is not an issue. We are using the test code from the AdaFruit BME280 Page.
#include <Wire.h> #include <Adafruit_Sensor.h> #include <Adafruit_BME280.h> #include <SPI.h> #define BME_SCK 18 #define BME_MISO 19 #define BME_MOSI 23 #define BME_CS 5 #define SEALEVELPRESSURE_HPA (1013.25) Adafruit_BME280 bme; // I2C (default pins for Raspberry Pi Pico: GPIO 4 (SDA), GPIO 5(SCL) /* Adafruit_BME280 bme(BME_CS); // hardware SPI Adafruit_BME280 bme(BME_CS, BME_MOSI, BME_MISO, BME_SCK); // software SPI */ unsigned long delayTime; void setup() { Serial.begin(9600); Serial.println("BME280 with Raspberry Pi Pico"); Wire.setSDA(4); Wire.setSCL(5); Wire.begin(); bool status; // default settings // (you can also pass in a Wire library object like &Wire2) status = bme.begin(0x77); //I have tried using 77, 76(default), 80, and blank if (!status) { Serial.println("Could not find a valid BME280 sensor, check wiring!"); } delayTime = 1000; Serial.println(); } void loop() { printValues(); delay(delayTime); } void printValues() { Serial.print("Temperature = "); Serial.print(bme.readTemperature()); Serial.println(" *C"); // Convert temperature to Fahrenheit /*Serial.print("Temperature (fahrenheit) = "); Serial.print(1.8 * bme.readTemperature() + 32); Serial.println(" *F");*/ Serial.print("Pressure = "); Serial.print(bme.readPressure() / 100.0F); Serial.println(" hPa"); Serial.print("Altitude = "); Serial.print(bme.readAltitude(SEALEVELPRESSURE_HPA)); Serial.println(" m"); Serial.print("Humidity = "); Serial.print(bme.readHumidity()); Serial.println(" %"); Serial.println(); } In theory this code should work. Is there an issue with our sensor? Do we need to buy a new one? I also don't really understand where the 44330.00 is coming from with the altitude.
This is what it's returning: Temperature = 0.00 *C Pressure = 0.00 hPa Altitude = 44330.00 m Humidity = 0.00 %