Problem with stabilize two device I2C - LCD with BME680 sensor

Hi Everyone!

This is my first post in arduino forum. I'm not programist or informatikier, only I'd like to make aparatus to measure temperature, humadity, gas resistation in air. In this situation I used BME680 sensor, LCD 16,2 with I2C and Arduino Uno. Very simply connections and everythings work, but only since 10s to 10 minutes. After this time my measured results is freeze on LCD in light off backlight.
I read about this problem - 2 device I2C. I read about two methods. Simply - set the interrupt as a short timer, e.g. 1 ms and if it isn't get correct answer at that time, it is out of the "while" loop.
Advenced - doing all I2C support at interrupts + some error handling as I2C communication fails.
But for me this two methods is difficult... I try used differend source and codes but after this time still freeze results in station. I connected LCD without I2C only with digitals pin 2,3,4,5,6 and 7 - you know about this conncetions, and the same problem. In next step I'd like to save all measuerd on microSD but with this I have experience. But with this I don't have new idea...
I know for you is very simply problem, but not for me. Please repair my code to station.
Thanks you

This is my code:

#include <Wire.h>
#include <SPI.h>
#include <Adafruit_Sensor.h>
#include "Adafruit_BME680.h"
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27,16,2);

#define SEALEVELPRESSURE_HPA (1013.25)

#define BMP680_I2C_ADDRESS 0x76
Adafruit_BME680 bme; // I2C

void setup() {

lcd.begin(16,2);
lcd.init();
lcd.backlight();
lcd.setCursor(0,0);
lcd.print("Weather station");
delay(3000);

if (!bme.begin(0x76))
{
  Serial.println("Could not find a valid BME680 sensor, check wiring!");
  while (1);
}

// Set up oversampling and filter initialization
bme.setTemperatureOversampling(BME680_OS_8X);
bme.setHumidityOversampling(BME680_OS_2X);
bme.setPressureOversampling(BME680_OS_4X);
bme.setIIRFilterSize(BME680_FILTER_SIZE_3);
bme.setGasHeater(320, 150); // 320*C for 150 ms

}

void loop() {
 if (! bme.performReading())
{
  Serial.println("Failed to perform reading");
  return;
}
 lcd.setCursor(0,0);
 lcd.print("Temperature =");
 lcd.print(bme.temperature);
 lcd.print((char)223);
 lcd.print("C");
 lcd.setCursor(0,1);
 lcd.print("Pressure = ");
 lcd.print(bme.pressure / 100.0);
 lcd.print("hPa");
   delay(3000);
 lcd.clear();
 lcd.setCursor(0,0);
 lcd.print("Humidity = ");
 lcd.print(bme.humidity);
 lcd.print(" %");
 lcd.setCursor(0,1);
 lcd.print("Gas = ");
 lcd.print(bme.gas_resistance / 1000.0);
 lcd.print(" KOhms");  
  delay(3000);
}

More interrupts are definitively not a solution for your problem.

My guess is a hardware problem.

Post (to this forum and not any of the temporary storage sites!) a sharp picture of your setup where all connections are visible!

Thanks you for your ask to my quastion.

I sent two photos: 1 - arduino good work and 2 - after 10 sek freeze. To sensor BME680 I give power supply 3,3V and to LCD - 5V. I nothing corrected from first post, but I observe new stage. I tested code to Serial with and without LCD. I have the same results - this is 3 photo. In one time regular mesured but after 20 sec is stoped or one time for e.x. 10 results see commend: "Failed to perform reading ". I think with sensor is problem. But I have 3 the same sensors and I observe the same problem.

photo 1 - Bez-nazwy-2 hosted at ImgBB — ImgBB
photo 2 - Bez-nazwy-3 hosted at ImgBB — ImgBB
photo 3 - Bez-nazwy-4 hosted at ImgBB — ImgBB

Post pictures to this forum. We don't open pictures from temporary storage servers.

Try to change LiquidCrystal_I2C library. I've wrote one - GitHub - enjoyneering/LiquidCrystal_I2C: This is an Arduino library for HD44780 LCD display, operated in 4 bit mode over I2C bus with 8-bit I/O expander PCF8574