When I connect the BME280 sensor to Arduino, it keeps freezing.

For Adafruit customers who seek help with microcontrollers

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

When I connect the BME280 sensor to Arduino, it keeps freezing.

Post by MakerScientist »

At first, I thought it was because I was using Arduino Nano and changed to Arduino Mega, but the BME280 sensor does not measure the correct value after about 24 hours. Have similar problems like this been reported? I want to count and check all possible cases.

User avatar
adafruit_support_bill
 
Posts: 88037
Joined: Sat Feb 07, 2009 10:11 am

Re: When I connect the BME280 sensor to Arduino, it keeps freezing.

Post by adafruit_support_bill »

Please post the code you are using and some photos showing all your soldering and connections.

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

Re: When I connect the BME280 sensor to Arduino, it keeps freezing.

Post by MakerScientist »

Code: Select all

#include "settings.h"
#define limitT 25

float temperature;
unsigned long counter;

void setup()   {
Serial.begin(9600);
delay(250);
Serial.println("BANNED");
pinMode(8, OUTPUT);

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

void loop() {

temperature=bme.readTemperature();

if (temperature>limitT) {digitalWrite(8, 1);}
else {digitalWrite(8, 0);}

Serial.println(temperature);
delay(1000);
}

Code: Select all

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

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

#define BME_SCK 13
#define BME_MISO 12
#define BME_MOSI 11
#define BME_CS 10

#define SEALEVELPRESSURE_HPA (1013.25)

Adafruit_BME280 bme;

unsigned long delayTime;

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

Re: When I connect the BME280 sensor to Arduino, it keeps freezing.

Post by MakerScientist »

Image
Attachments
KakaoTalk_20230404_152045302_01.jpg
KakaoTalk_20230404_152045302_01.jpg (147.25 KiB) Viewed 999 times
KakaoTalk_20230404_152045302.jpg
KakaoTalk_20230404_152045302.jpg (139.06 KiB) Viewed 999 times
Last edited by MakerScientist on Tue Apr 04, 2023 2:25 am, edited 1 time in total.

User avatar
adafruit_support_bill
 
Posts: 88037
Joined: Sat Feb 07, 2009 10:11 am

Re: When I connect the BME280 sensor to Arduino, it keeps freezing.

Post by adafruit_support_bill »

We can't follow the connections in your photos and the wiring does not appear to follow any usual color coding conventions. (For low-voltage DC wiring, black = GND and red = V+)

In any case, your code appears to be using i2c communication. So the freezing you report is most likely cause by a problem with the i2c bus. This can be due to one or more of the following:
* a poor solder joint or loose connection.
* electrical interference
* too much bus capacitance from long cables

i2c is a short distance protocol - designed to communicate between chips on the same PCB. You can make it work over somewhat longer distances, but the quality of the cabling and connections become more important the longer you go.

Longer wires are more susceptible to interference and tend to have more bulk capacitance to slow down the signals. And just one marginal connection in the signal path can cause enough trouble to freeze the system.

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

Re: When I connect the BME280 sensor to Arduino, it keeps freezing.

Post by MakerScientist »

Like you said, I tried connecting the Arduino and the sensor again using the DuPont connector. Before that, the wrapping wire was relatively thin and long, but now it is a thick wire. And yet, problems continue to arise. The strange thing is that if I turn the Arduino off and on, it works fine again, but after about 24 hours it stops working. I made and use 2 of these devices, and the other one continues to work fine to this day. Looking for the difference today, I connected a pull-up resistor to the SDA and SCK pins on the device that works well. I'm thinking of connecting a pull-up resistor to the problematic device as well. If you have any other advice, please let me know. thank you
Attachments
KakaoTalk_20230406_171212543.jpg
KakaoTalk_20230406_171212543.jpg (159.33 KiB) Viewed 979 times

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

Re: When I connect the BME280 sensor to Arduino, it keeps freezing.

Post by MakerScientist »

Failed. I also repaired all the wires connecting the sensor and Arduino and connected all the pull-up resistors. However, the temperature sensor is stopped again at the workroom after one night. Another temperature sensor of the same model has been working fine for several weeks now. I've tried changing the microcontroller from Arduino Nano to Mega and I think I've done everything I can. I need new ideas. hope for help

User avatar
dastels
 
Posts: 15608
Joined: Tue Oct 20, 2015 3:22 pm

Re: When I connect the BME280 sensor to Arduino, it keeps freezing.

Post by dastels »

You don't need to add pullups, as the breakout has them already.

Please email [email protected] with a link to this thread, your order number, and request the replacement of one BME280 I2C or SPI Temperature Humidity Pressure Sensor - STEMMA QT.

Dave

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

Re: When I connect the BME280 sensor to Arduino, it keeps freezing.

Post by MakerScientist »

I have several of the same sensors. I unpacked the new sensor and replaced it with the old unit. But still after a few days the sensor stopped working. So it doesn't sound like the sensor is bad. I don't know what needs to be improved at this time. I said the other day that one of the two devices works just fine. In retrospect, I realized that I was turning off and on every day a device that was working fine. Therefore, it could not be confirmed that it works well continuously for more than 24 hours. I started to wonder if it would be possible to connect this sensor to an Arduino and keep it for more than a month. Has anyone been successful?

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

Return to “Microcontrollers”