hi I am following this project
I have connected everything up as shown in the drawing but when I upload the code and power it up the display reads "error. check connections"
I am unsure where to go from here
I am also using an Arduino UNO not a MEGA
connections are
Arduino 5v--VIN bmp280
Arduino GND--GND bmp280
Arduino A5--SCL bmp280
Arduino A4--SDA bmp280
How are You powering the UNO? Which pin and what voltage?
jim-p
May 11, 2024, 8:19am
3
Are you using the BME280 or the BMP280?
They have different I2C addresses
BME280 is 0x76
BMP280 is 0x77
Change
bme.begin(0x76);
to
bme.begin(0x77);
I am powering the uno through USB
just did a I2C scan and it came up with device found at 0x76 witch the code for the project is already set at and the sensor I am using says BME/BMP280
jim-p
May 11, 2024, 8:49am
6
coolantcooled:
BME/BMP280
It can't be both.
So if the scanner found 0x76 then your code should work.
Post you code here so we can see what you are doing.
In the IDE, under the EDIT menu click on Copy for Forum and paste your code here.
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>
#include <LiquidCrystal.h>
float temperature;
float humidity;
float pressure;
#define ALTITUDE 216.0 // Altitude in Sparta, Greece
Adafruit_BME280 bme; // I2C
LiquidCrystal lcd(8,9,4,5,6,7);
void setup(void) {
lcd.begin(16, 2);
lcd.print("Reading sensor");
bool status;
// default settings
status = bme.begin(0x76); //The I2C address of the sensor I use is 0x76
if (!status) {
lcd.clear();
lcd.print("Error. Check");
lcd.setCursor(0,1);
lcd.print("connections");
while (1);
}
}
void loop() {
delay(2000);
getPressure();
getHumidity();
getTemperature();
lcd.clear();
//Printing Temperature
String temperatureString = String(temperature,1);
lcd.print("T:");
lcd.print(temperatureString);
lcd.print((char)223);
lcd.print("C ");
//Printing Humidity
String humidityString = String(humidity,0);
lcd.print("H: ");
lcd.print(humidityString);
lcd.print("%");
//Printing Pressure
lcd.setCursor(0,1);
lcd.print("P: ");
String pressureString = String(pressure,2);
lcd.print(pressureString);
lcd.print(" hPa");
}
float getTemperature()
{
temperature = bme.readTemperature();
}
float getHumidity()
{
humidity = bme.readHumidity();
}
float getPressure()
{
pressure = bme.readPressure();
pressure = bme.seaLevelForAltitude(ALTITUDE,pressure);
pressure = pressure/100.0F;
}
jim-p
May 11, 2024, 9:14am
8
I can't see anything wrong.
Put a Serial.print("ERROR") in your code where it checks status and comment out the LCD setup lines and prints. Then see if you still get the error
jim-p
May 11, 2024, 9:18am
9
Try the Adafruit bme280test.ino example
Just tried the example and it cant find the sensor either, I'm thinking maybe the sensor is broken
jim-p
May 11, 2024, 9:36am
11
But you said the scanner found it. Is that true?
yeah I ran the ic2 scanner and it said sensor found on 0x76
if I run this sensor test code it only outputs the sensor readings as 0.00
/**************************************************************************
Tests the getPressure functions
**************************************************************************/
#include <BMP280.h>
BMP280 bmp280;
void setup()
{
Serial.begin(9600);
delay(10);
Serial.println("BMP280 example");
Wire.begin(); //Join I2C bus
bmp280.begin();
}
void loop()
{
//Get pressure value
uint32_t pressure = bmp280.getPressure();
float temperature = bmp280.getTemperature();
//Print the results
Serial.print("Temperature: ");
Serial.print(temperature);
Serial.print("°C \t");
Serial.print("Pressure: ");
Serial.print(pressure);
Serial.println("Pa");
delay(2000);
}
jim-p
May 11, 2024, 9:49am
14
You said you ran the test code and it did NOT find the sensor
You are confusing me
Sorry I meant to say the adafruit test code came up with error check wiring
So I ran a test code from another library for the bme280 and it just outputs
Pressure = 0.00 temperature = 0.00
jim-p
May 11, 2024, 10:07am
16
That code does not check to see if the BMP280 is present so it does not help.
Use the Adafruit test program but set the address to 0x76
bme.begin(0x76);
sorry I haven't had the chance to have another shot at it ill let you know when I do