Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Troubleshooting
  3. BME280 Temp/Hum sensor on battery power increasingly skips(?) operation

BME280 Temp/Hum sensor on battery power increasingly skips(?) operation

Scheduled Pinned Locked Moved Troubleshooting
22 Posts 5 Posters 7.9k Views 6 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G gogopotato

    Hi,

    I have a battery-operated temp/humidty sensor running on 2x AA batteries. Components are:

    1. Arduino Pro 3.3v clone with 47uF bulk cap (LEDs and volt regulator removed)
    2. BME280
    3. NRF24L01+ radio with 47uF bulk cap
    4. 3.3v voltage booster/regulator w/ 100uF bulk cap and 0.1uF ceramic cap

    It's set to report temp/hum every 10 minutes. Upon reset, it works flawlessly for 3 to 4 days, and then it'd start skipping an operation maybe once every a few hours (i.e. no update received). As time progresses such skips get worse, sending updates once per hour to every few hours. Eventually it'd just stop updating. Funny thing is, upon reset it'd work fine again for another few days only to get worse again following the exact same pattern described above. I'm unsure whether it's "self-resetting" I do not see the typical MySensors presentation messages when the sensor goes live again. But the smartSleep() integer counter sometimes gets reset.

    I have two other identical sensors that are each powered via a 5v wall wart, and they NEVER display this symptom. So I'm pretty sure it's related to it being battery powered.

    The battery is connected to a 3.3v voltage booster along with 100uF electrolyte bulk capacitor AND 0.1uF ceramic capacitor, as instructed by MySensors.org website. All components (Arduino, sensor, and radio) are powered by the output from the same voltage booster.

    Has anyone experience a similar issue? What could be the culprit, and what can I do to fix this?

    Thanks!

    warmaniacW Offline
    warmaniacW Offline
    warmaniac
    wrote on last edited by
    #6

    @gogopotato

    Can you please paste your sketch? I found some here but I think is outdated, readings not working properly . Thanks !

    G 2 Replies Last reply
    0
    • warmaniacW warmaniac

      @gogopotato

      Can you please paste your sketch? I found some here but I think is outdated, readings not working properly . Thanks !

      G Offline
      G Offline
      gogopotato
      wrote on last edited by
      #7

      @warmaniac Here's my code:

      // Enable and select radio type attached
      #define MY_RADIO_NRF24
      
      #define MY_NODE_ID 11
      
      //#define MY_PARENT_NODE_ID
      
      #include <SPI.h>
      #include <MySensors.h>
      #include <avr/wdt.h> //watchdog timer lib
      
      
      #include <Adafruit_Sensor.h>
      #include <Adafruit_BME280.h> // Change I2C address in Adafruit_BME280 library to "0x76" (line 32 in the library file)
      #include "Wire.h"
      
      Adafruit_BME280 bme; // I2C
      
      #define CHILD_ID_HUM 0  // RH
      #define CHILD_ID_TEMP_F 1 // temp in F
      
      
      // MyMessage to controler
      
      MyMessage msgT1(CHILD_ID_TEMP_F, V_TEMP);
      MyMessage msgH1(CHILD_ID_HUM, V_HUM);
      MyMessage msgE1(255, V_TEXT); // Debug message
      
      void presentation()
      {
        // Send the sketch version information to the gateway and Controller
        sendSketchInfo("Nursery", "1.2");
        present(CHILD_ID_TEMP_F, S_TEMP);
        present(CHILD_ID_HUM, S_HUM);
      }
      
      void setup()
      {
        startBME();
        ServerUpdate(); // for first data reading and sending to controler
      }
      
      void loop()
      {
        smartSleep(600000); // sleep for 10 mins
        ServerUpdate();
      }
      
      void startBME()
      {
        delay(1000); //just in case
        if (!bme.begin())
        {
          send(msgE1.set("BME280 INIT FAIL"));
      #ifdef MY_DEBUG
          Serial.println("BME280 initialization failed!");
      #endif
          while (1);
        }
        else
          send(msgE1.set("BME280 INIT SUCCESS"));
        delay(5000); //delay for 5 second before the 1st reading; prevents errant spike in sensor value
      #ifdef MY_DEBUG
        Serial.println("BME280 initialization success!");
      #endif
      }
      
      
      void ServerUpdate() // used to read sensor data and send it to controller
      {
        bme.begin(); //re-initialize for each reading
        double TF, TC, P, H;
        TC = bme.readTemperature(); //read temp in C
        TF = TC * 9 / 5 + 32; // convert default Celcius reading to Fahrenheit
        H = bme.readHumidity();
      
        if (TF < 0 || H == 100 || H == 0) {
          // if sensor values are in error, do nothing.
        } else {
          send(msgT1.set(TF, 1));
          send(msgH1.set(H, 1));
        }
      
      #ifdef MY_DEBUG
        Serial.print("T = \t"); Serial.print(TF, 1); Serial.print(" degF\t");
        //Serial.print("T = \t"); Serial.print(TC, 1); Serial.print(" degC\t");
        Serial.print("H = \t"); Serial.print(H, 1); Serial.print(" percent");
        //Serial.print("P = \t"); Serial.print(P, 1); Serial.print(" mBar\t");
      #endif
      }
      
      G 1 Reply Last reply
      0
      • G gogopotato

        @warmaniac Here's my code:

        // Enable and select radio type attached
        #define MY_RADIO_NRF24
        
        #define MY_NODE_ID 11
        
        //#define MY_PARENT_NODE_ID
        
        #include <SPI.h>
        #include <MySensors.h>
        #include <avr/wdt.h> //watchdog timer lib
        
        
        #include <Adafruit_Sensor.h>
        #include <Adafruit_BME280.h> // Change I2C address in Adafruit_BME280 library to "0x76" (line 32 in the library file)
        #include "Wire.h"
        
        Adafruit_BME280 bme; // I2C
        
        #define CHILD_ID_HUM 0  // RH
        #define CHILD_ID_TEMP_F 1 // temp in F
        
        
        // MyMessage to controler
        
        MyMessage msgT1(CHILD_ID_TEMP_F, V_TEMP);
        MyMessage msgH1(CHILD_ID_HUM, V_HUM);
        MyMessage msgE1(255, V_TEXT); // Debug message
        
        void presentation()
        {
          // Send the sketch version information to the gateway and Controller
          sendSketchInfo("Nursery", "1.2");
          present(CHILD_ID_TEMP_F, S_TEMP);
          present(CHILD_ID_HUM, S_HUM);
        }
        
        void setup()
        {
          startBME();
          ServerUpdate(); // for first data reading and sending to controler
        }
        
        void loop()
        {
          smartSleep(600000); // sleep for 10 mins
          ServerUpdate();
        }
        
        void startBME()
        {
          delay(1000); //just in case
          if (!bme.begin())
          {
            send(msgE1.set("BME280 INIT FAIL"));
        #ifdef MY_DEBUG
            Serial.println("BME280 initialization failed!");
        #endif
            while (1);
          }
          else
            send(msgE1.set("BME280 INIT SUCCESS"));
          delay(5000); //delay for 5 second before the 1st reading; prevents errant spike in sensor value
        #ifdef MY_DEBUG
          Serial.println("BME280 initialization success!");
        #endif
        }
        
        
        void ServerUpdate() // used to read sensor data and send it to controller
        {
          bme.begin(); //re-initialize for each reading
          double TF, TC, P, H;
          TC = bme.readTemperature(); //read temp in C
          TF = TC * 9 / 5 + 32; // convert default Celcius reading to Fahrenheit
          H = bme.readHumidity();
        
          if (TF < 0 || H == 100 || H == 0) {
            // if sensor values are in error, do nothing.
          } else {
            send(msgT1.set(TF, 1));
            send(msgH1.set(H, 1));
          }
        
        #ifdef MY_DEBUG
          Serial.print("T = \t"); Serial.print(TF, 1); Serial.print(" degF\t");
          //Serial.print("T = \t"); Serial.print(TC, 1); Serial.print(" degC\t");
          Serial.print("H = \t"); Serial.print(H, 1); Serial.print(" percent");
          //Serial.print("P = \t"); Serial.print(P, 1); Serial.print(" mBar\t");
        #endif
        }
        
        G Offline
        G Offline
        gogopotato
        wrote on last edited by gogopotato
        #8
        This post is deleted!
        1 Reply Last reply
        0
        • warmaniacW warmaniac

          @gogopotato

          Can you please paste your sketch? I found some here but I think is outdated, readings not working properly . Thanks !

          G Offline
          G Offline
          gogopotato
          wrote on last edited by gogopotato
          #9

          @warmaniac hmm now that I am reviewing my code, I have "do nothing if value is error" logic.

            if (TF < 0 || H == 100 || H == 0) {
              // if sensor values are in error, do nothing.
            } else {
              send(msgT1.set(TF, 1));
              send(msgH1.set(H, 1));
          

          Perhaps the voltage booster is causing BME280 to behave badly? But then why would it work fine for the first few days? Do you think adding a bulk capacitor to BME280 would to stabilize power hence reducing errant readings? If so how big of a capacitor would I need? The mystery continues....

          warmaniacW 1 Reply Last reply
          0
          • YveauxY Yveaux

            @gogopotato No, I removed both the LED and the regulator, so everything is driven directly from 2xAA.
            I have similar sensors (e.g. with Si7021 temp/hum sensor) which run for years on such setup.
            A steup converter will just reduce the battery lifetime due to its loss and power tends to be less stable than using batteries directly.

            G Offline
            G Offline
            gogopotato
            wrote on last edited by
            #10

            @Yveaux If step-up converter would only reduce the battery lifetime, why does Mysensors.org page suggest using one to extend battery life? I'm new to electronics so please bear with me!

            1 Reply Last reply
            0
            • G gogopotato

              @warmaniac hmm now that I am reviewing my code, I have "do nothing if value is error" logic.

                if (TF < 0 || H == 100 || H == 0) {
                  // if sensor values are in error, do nothing.
                } else {
                  send(msgT1.set(TF, 1));
                  send(msgH1.set(H, 1));
              

              Perhaps the voltage booster is causing BME280 to behave badly? But then why would it work fine for the first few days? Do you think adding a bulk capacitor to BME280 would to stabilize power hence reducing errant readings? If so how big of a capacitor would I need? The mystery continues....

              warmaniacW Offline
              warmaniacW Offline
              warmaniac
              wrote on last edited by
              #11

              @gogopotato

              I had problem that BME is inaccurate outside , I'm using BME180 and BME 280 both works great inside readings are almost same , but when I put it outside temperature is much higher than real, I compare it with ds18b20 or with my standalone weather station + local weather station , it was almost same but BME is higher about 2 degrees

              G 1 Reply Last reply
              0
              • warmaniacW warmaniac

                @gogopotato

                I had problem that BME is inaccurate outside , I'm using BME180 and BME 280 both works great inside readings are almost same , but when I put it outside temperature is much higher than real, I compare it with ds18b20 or with my standalone weather station + local weather station , it was almost same but BME is higher about 2 degrees

                G Offline
                G Offline
                gogopotato
                wrote on last edited by
                #12

                @warmaniac yeah I think my BME280 is about +2 F than real temp. Anyway, do you have any suggestions as to resolving the issue? Maybe I should just replace it with DHT22.

                warmaniacW AWIA 2 Replies Last reply
                0
                • G gogopotato

                  @warmaniac yeah I think my BME280 is about +2 F than real temp. Anyway, do you have any suggestions as to resolving the issue? Maybe I should just replace it with DHT22.

                  warmaniacW Offline
                  warmaniacW Offline
                  warmaniac
                  wrote on last edited by
                  #13

                  @gogopotato

                  I had 5 pcs of DHT 11 and 3 pcs of DHT22 and there are seriously piece of sh.. :) humidity readings was very bad only temperature okay , than if you want to measure only temperature best way is buy waterproof ds18b20 , https://www.ebay.com/itm/112029570094

                  1 Reply Last reply
                  0
                  • G gogopotato

                    @warmaniac yeah I think my BME280 is about +2 F than real temp. Anyway, do you have any suggestions as to resolving the issue? Maybe I should just replace it with DHT22.

                    AWIA Offline
                    AWIA Offline
                    AWI
                    Hero Member
                    wrote on last edited by
                    #14

                    @gogopotato Taken from the BME280 datasheet: "Temperature measured by the internal temperature sensor. This temperature value depends on the PCB temperature, sensor element self-heating and ambient temperature and is typically
                    above ambient temperature. " (does not explain very much ;-)) I have a good experience with this sensor when operated from a stable power source (3.3V ldo).
                    Some boards of the boards sold are equiped with a LDO which can cause problems if you operate under a certain voltage. 0_1490093783939_upload-e834cb72-2a47-4b77-83a1-4caa44a4d618

                    warmaniacW G 2 Replies Last reply
                    0
                    • AWIA AWI

                      @gogopotato Taken from the BME280 datasheet: "Temperature measured by the internal temperature sensor. This temperature value depends on the PCB temperature, sensor element self-heating and ambient temperature and is typically
                      above ambient temperature. " (does not explain very much ;-)) I have a good experience with this sensor when operated from a stable power source (3.3V ldo).
                      Some boards of the boards sold are equiped with a LDO which can cause problems if you operate under a certain voltage. 0_1490093783939_upload-e834cb72-2a47-4b77-83a1-4caa44a4d618

                      warmaniacW Offline
                      warmaniacW Offline
                      warmaniac
                      wrote on last edited by warmaniac
                      #15

                      @AWI

                      I had this one, is it OK ? I power it directly from 2xAA batteries, and can operate 1,71 to 3,7 volts as I saw in datasheet .Then you said that is problem of using because it has self heating problem ?

                      https://www.ebay.com/itm/152306676745

                      AWIA 2 Replies Last reply
                      0
                      • AWIA AWI

                        @gogopotato Taken from the BME280 datasheet: "Temperature measured by the internal temperature sensor. This temperature value depends on the PCB temperature, sensor element self-heating and ambient temperature and is typically
                        above ambient temperature. " (does not explain very much ;-)) I have a good experience with this sensor when operated from a stable power source (3.3V ldo).
                        Some boards of the boards sold are equiped with a LDO which can cause problems if you operate under a certain voltage. 0_1490093783939_upload-e834cb72-2a47-4b77-83a1-4caa44a4d618

                        G Offline
                        G Offline
                        gogopotato
                        wrote on last edited by
                        #16

                        @AWI This is the BME280 module I'm using, and looks like it's got an LDO built-in, am I correct? Vin is 1.8 - 5V DC. Maybe I should just bypass the voltage booster and supply power to the module directly from the battery...?

                        http://www.ebay.com/itm/131576719166

                        1 Reply Last reply
                        0
                        • warmaniacW warmaniac

                          @AWI

                          I had this one, is it OK ? I power it directly from 2xAA batteries, and can operate 1,71 to 3,7 volts as I saw in datasheet .Then you said that is problem of using because it has self heating problem ?

                          https://www.ebay.com/itm/152306676745

                          AWIA Offline
                          AWIA Offline
                          AWI
                          Hero Member
                          wrote on last edited by
                          #17

                          @warmaniac That is the one without LDO (regulator). The self heating problem is not likely to occur if you are not constantly accessing the sensor and thus warming it. The main function of the temperature sensor is compensation for barometer and humidity reading. It is a rather complicated component with a lot of different settings and adjustments.

                          warmaniacW 1 Reply Last reply
                          0
                          • AWIA AWI

                            @warmaniac That is the one without LDO (regulator). The self heating problem is not likely to occur if you are not constantly accessing the sensor and thus warming it. The main function of the temperature sensor is compensation for barometer and humidity reading. It is a rather complicated component with a lot of different settings and adjustments.

                            warmaniacW Offline
                            warmaniacW Offline
                            warmaniac
                            wrote on last edited by
                            #18

                            @AWI

                            I understand but it's mysterious thing , because indoor it works ok , but when I put it outside , readings are not correct , maybe it is not for outdoor usage :(

                            AWIA 1 Reply Last reply
                            0
                            • warmaniacW warmaniac

                              @AWI

                              I had this one, is it OK ? I power it directly from 2xAA batteries, and can operate 1,71 to 3,7 volts as I saw in datasheet .Then you said that is problem of using because it has self heating problem ?

                              https://www.ebay.com/itm/152306676745

                              AWIA Offline
                              AWIA Offline
                              AWI
                              Hero Member
                              wrote on last edited by
                              #19

                              @gogopotato And that one is with the LDO built in. You need to make sure that the sensor gets enough juice. I can't see which regulator is used but probably a 662K (XC6206) which is not likely to produce any voltage below 2.6V
                              0_1490121301284_upload-6e4a6960-44ac-4925-9540-8f69d9f2d956

                              1 Reply Last reply
                              0
                              • warmaniacW warmaniac

                                @AWI

                                I understand but it's mysterious thing , because indoor it works ok , but when I put it outside , readings are not correct , maybe it is not for outdoor usage :(

                                AWIA Offline
                                AWIA Offline
                                AWI
                                Hero Member
                                wrote on last edited by AWI
                                #20

                                @warmaniac The sensor should be perfect for outdoor usage. At least you are not alone :relieved: . This guy deserves some real credits doing the research and has some ideas on the cause in the article. (you can also take look at his wedding pictures :wedding: there)

                                conclusion:
                                0_1490122717529_upload-10bb5ab6-91ab-49db-b59e-50d393681600

                                warmaniacW 1 Reply Last reply
                                0
                                • AWIA AWI

                                  @warmaniac The sensor should be perfect for outdoor usage. At least you are not alone :relieved: . This guy deserves some real credits doing the research and has some ideas on the cause in the article. (you can also take look at his wedding pictures :wedding: there)

                                  conclusion:
                                  0_1490122717529_upload-10bb5ab6-91ab-49db-b59e-50d393681600

                                  warmaniacW Offline
                                  warmaniacW Offline
                                  warmaniac
                                  wrote on last edited by
                                  #21

                                  @AWI

                                  Thanks , I take a read after I finish in work. But I decided to use ds18b20 sealed version plus standalone humidity sensor , maybe it will be better :) Then I post some experiences. Maybe you can take a look on my photos too , I like landscapes photos , but sometimes I shooting weddings too :) www.pinak-art.com

                                  1 Reply Last reply
                                  0
                                  • S Offline
                                    S Offline
                                    Scott Wilson
                                    wrote on last edited by
                                    #22

                                    My BME280 is around 1F hotter outside than a DS18B20 outside in another project. Not a big deal but I am also researching how to keep it cool. The library I am using is this one.

                                    1 Reply Last reply
                                    0
                                    Reply
                                    • Reply as topic
                                    Log in to reply
                                    • Oldest to Newest
                                    • Newest to Oldest
                                    • Most Votes


                                    21

                                    Online

                                    11.7k

                                    Users

                                    11.2k

                                    Topics

                                    113.1k

                                    Posts


                                    Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                                    • Login

                                    • Don't have an account? Register

                                    • Login or register to search.
                                    • First post
                                      Last post
                                    0
                                    • MySensors
                                    • OpenHardware.io
                                    • Categories
                                    • Recent
                                    • Tags
                                    • Popular