BME280 and Nokia LCD

The display shows only degrees, % of humidity and mmHg, but not data from BME280 (I use Arduino UNO R3). What’s wrong?

#include <Adafruit_GFX.h>
#include <Adafruit_PCD8544.h>
#include <Adafruit_BME280.h>
#include <Wire.h>

Adafruit_BME280 bme; // I2C
#define bme_ADDRESS 0x76
// SDA - A4 (D18)
// SCL - A5 (D19)

Adafruit_PCD8544 lcd = Adafruit_PCD8544(7, 6, 5, 4, 3);
// D7 - Serial clock out (CLK)
// D6 - Serial data out (DIN)
// D5 - Data/Command select (DC)
// D4 - LCD chip select (CE)
// D3 - LCD reset (RST)

float Temperature;
int Pressure, Humidity;

void setup() {
lcd.begin();
lcd.setContrast(60);
lcd.clearDisplay();
Wire.begin();
bme.begin();
delay(1000);
}
void loop(void) {
lcd.setTextSize(1);
lcd.setCursor(8,1);
lcd.print(bme.readPressure()/1.333);lcd.print(" mmHg");
lcd.setCursor(8,17);
lcd.print(bme.readTemperature(),1);
lcd.setCursor(69,14);
lcd.print((char)9);lcd.print(“C”);
lcd.setCursor(8,34);
lcd.print(bme.readHumidity());
set_text(69,34,"%",BLACK);
lcd.clearDisplay();
delay(50000);
}
void set_text(int x,int y,String text,int color){
lcd.setTextColor(color);
lcd.setCursor(x,y);
lcd.println(text);
lcd.display();
}

if you print also all values to Serial, what happens?

can you post the output?

If I put values to Serial, monitor shows zeroes (screen.jpg). When I use other sketch (BME280_I2C.ino), serial monitor shows normally (screen2.jpg), but if I try to send data to LCD, it shows nothing.

BME280_I2C.ino (5.96 KB)

"LCD shows nothing" - I meant nothing normally. No real data :slight_smile: It shows zeroes and "C", "mmHg", "%".

When I put this sketch LCD shows “adafruit flower” picture, no more.

My_BME280_I2C.ino (6.31 KB)

try swap these lines

lcd.clearDisplay();
delay(50000);

as you put everything on display, then clear it and then start a long wait.
think you have to wait before the clear...

Swaped. Result as before…

This sketch code (adapted) works well with BMP180, but with BME280 can't read data from it. :frowning:

SOLVED! There was need to change #define BME280_ADDRESS (0x77) to #define BME280_ADDRESS (0x76) in library file Adafruit_BME280.h

Here is the working sketch file. MERRY CHRISTMAS! :slight_smile:

my_bar-term-hygr_BME280.ino (1013 Bytes)

The sketch last version, with big symbols.

my_bar-term-hygr_BME280_b.ino (1009 Bytes)

Thanks for sharing the working code!

hello
I’m using a bmp280
i delete the humidity line
but i have 0.00 on presure and 0.0 on C
what shel i do?
please help
i attach my bmp sensor model

bmp280.jpg

razvan056:
hello
I'm using a bmp280
i delete the humidity line
but i have 0.00 on presure and 0.0 on C
what shel i do?
please help
i attach my bmp sensor model

I have one, like your picture. SDO line has pull-down resistor for 0x76 address , if SDO-to-Vcc(3v3) is 0x77 address. check your config.