The bme280 sensor keeps displaying 182 degrees.

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
MakerScientist
 
Posts: 10
Joined: Wed Feb 22, 2023 2:42 am

The bme280 sensor keeps displaying 182 degrees.

Post by MakerScientist »

The bme280 sensor keeps displaying 182 degrees. Why? I am using it by connecting it to the Arduino nano, and one oled display is also connected.

Code: Select all

#include "settings.h"
#define limitT 33

float temperature;
float maxT, minT;

void setup()   {
Serial.begin(9600);
delay(250);
display.begin(i2c_Address, true);
Serial.println("3D 프린팅 챔버 항온유지장치");
pinMode(12, OUTPUT);

unsigned status;
status = bme.begin();
Serial.println(status);
if (!status) {Serial.println("온도센서 오류!");}
Serial.println("온도센서 정상");
temperature=bme.readTemperature();
maxT=temperature;
minT=temperature;
}


void loop() {
Serial.println("루프돌입!");
temperature=bme.readTemperature();

if (temperature>maxT) {maxT=temperature;}
if (temperature<minT) {minT=temperature;}

if (temperature>limitT) {digitalWrite(12, 1);}
else {digitalWrite(12, 0);}
display.clearDisplay();
display.setTextSize(1);
display.setTextColor(SH110X_WHITE);
display.setCursor(0, 0);
display.println("OPERATING!");
display.print("T: "); display.println(temperature);
display.print("MAX: "); display.println(maxT);
display.print("MIN: "); display.println(minT);
display.print("LIMIT: "); display.println(limitT);
display.print("TIME: "); display.println("inf");
display.display();
Serial.println(temperature);
delay(1000);
}


#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SH110X.h>

#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>

#define SEALEVELPRESSURE_HPA (1013.25)

Adafruit_BME280 bme;

unsigned long delayTime;

#define i2c_Address 0x3c
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
#define OLED_RESET -1   //   QT-PY / XIAO
Adafruit_SH1106G display = Adafruit_SH1106G(SCREEN_WIDTH, SCREEN_HEIGHT,
&Wire, OLED_RESET);
#define NUMFLAKES 10
#define XPOS 0
#define YPOS 1
#define DELTAY 2
Last edited by adafruit_support_carter on Wed Feb 22, 2023 1:02 pm, edited 1 time in total.
Reason: added [code] tags

User avatar
adafruit_support_carter
 
Posts: 29150
Joined: Tue Nov 29, 2016 2:45 pm

Re: The bme280 sensor keeps displaying 182 degrees.

Post by adafruit_support_carter »

Try running just the BME280 example sketch shown in the guide:
https://learn.adafruit.com/adafruit-bme ... duino-test

What values does that sketch report from the BME280?

User avatar
MakerScientist
 
Posts: 10
Joined: Wed Feb 22, 2023 2:42 am

Re: The bme280 sensor keeps displaying 182 degrees.

Post by MakerScientist »

It show 23 degree but I did not check after one day. I will try and reply. Thank you

User avatar
MakerScientist
 
Posts: 10
Joined: Wed Feb 22, 2023 2:42 am

Re: The bme280 sensor keeps displaying 182 degrees.

Post by MakerScientist »

I checked and it works fine after 24h.
Than, it looks like the sensor is not the problem.
Could you please suggest what can cause such error according to my code?

User avatar
adafruit_support_carter
 
Posts: 29150
Joined: Tue Nov 29, 2016 2:45 pm

Re: The bme280 sensor keeps displaying 182 degrees.

Post by adafruit_support_carter »

In your sketch, you are displaying the temperature on both the OLED and the Arduino Serial Monitor. Does the 128 value show up in both places?

User avatar
MakerScientist
 
Posts: 10
Joined: Wed Feb 22, 2023 2:42 am

Re: The bme280 sensor keeps displaying 182 degrees.

Post by MakerScientist »

yes both monitor shows 182 degree.
I found that nano keeps resetting.
so I think it is maybe memory issue.
I deleted OLED code, and it works fine.
I want to hear your opinion too.

User avatar
adafruit_support_carter
 
Posts: 29150
Joined: Tue Nov 29, 2016 2:45 pm

Re: The bme280 sensor keeps displaying 182 degrees.

Post by adafruit_support_carter »

Memory or some other code issue. The BME280 stand alone example works as expected. So it's not a hardware issue.

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”