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. Hardware
  3. BME280 How to use it outdoors

BME280 How to use it outdoors

Scheduled Pinned Locked Moved Hardware
36 Posts 9 Posters 29.6k Views 10 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.
  • AWIA AWI

    @karl261 Is the photo upside down? It is probably bad luck but you you should take care that the box is well ventilated. Most commercial housings look like the one below. The ventilation makes sure that there is limited condensation. When a closed box (or one with only a small hole inside) cools down in high humidity there will likely be condensation which is not good for the sensor.

    So, my advice would be to dril some more holes and protect it agains rain. Also cover the holes with some fabric (i.e fiberglass) to protect it against insects.

    0_1474476662149_upload-55749161-dbba-4941-bbfe-c38322980283

    karl261K Offline
    karl261K Offline
    karl261
    wrote on last edited by
    #3

    @AWI No, it's standing on a table on the photo...

    Hm.... I did not find any moisture in the box. So you think I need plenty of more holes? Hm, the sensor was directly behind the hole. On the picture one cannot see the sensor.

    Rain normally cannot reach the box. But ok, I could think of something more special.

    The housing on your photo, where can you buy it?

    Another thing: if I protect the holes against insects, what would I use? Because I don't want to measure wet tissue or so. So it would be some synthetics. Or a fine mesh of something. But in this moment I have no idea...

    Thanks for the advice!

    1 Reply Last reply
    0
    • karl261K Offline
      karl261K Offline
      karl261
      wrote on last edited by
      #4

      0_1474479329532_image.jpg

      R 1 Reply Last reply
      0
      • karl261K karl261

        0_1474479329532_image.jpg

        R Offline
        R Offline
        r-nox
        wrote on last edited by
        #5

        @karl261

        You can use window screen from the hardware store.

        karl261K 1 Reply Last reply
        0
        • R r-nox

          @karl261

          You can use window screen from the hardware store.

          karl261K Offline
          karl261K Offline
          karl261
          wrote on last edited by
          #6

          @r-nox window screen? What is that? Do you have a link?

          Ah, now I know: these anti insect meshes, one puts in front of the window... They should be good...

          Now the box is full of 2 mm holes...

          0_1474479958895_image.jpg

          1 Reply Last reply
          0
          • R Offline
            R Offline
            r-nox
            wrote on last edited by
            #7

            Your fine then.

            Window screen is a mesh material that doesn't absorb water. It is sometimes made from metal.

            karl261K 1 Reply Last reply
            0
            • R Offline
              R Offline
              r-nox
              wrote on last edited by
              #8

              Here's a link

              http://www.affordablewindowscreens.com/products/custom-window-screens.html?page=shop.product_details&flypage=vmj_naru.tpl&product_id=40&category_id=1

              karl261K 1 Reply Last reply
              0
              • R r-nox

                Your fine then.

                Window screen is a mesh material that doesn't absorb water. It is sometimes made from metal.

                karl261K Offline
                karl261K Offline
                karl261
                wrote on last edited by
                #9

                @r-nox ok, thanks. I try to google it. Somehow I can't picture the material.

                @AWI Maybe it has to do with the box. Hm. Because I had another node out there, same sensor, and it was just hanging in the bird house protected against rain. And it still works fine. Still, there was no sign of any moisture in the box...

                1 Reply Last reply
                0
                • R r-nox

                  Here's a link

                  http://www.affordablewindowscreens.com/products/custom-window-screens.html?page=shop.product_details&flypage=vmj_naru.tpl&product_id=40&category_id=1

                  karl261K Offline
                  karl261K Offline
                  karl261
                  wrote on last edited by
                  #10

                  @r-nox ok, thanks. It is exactly what I was talking about. Insect protection! :smiley:

                  1 Reply Last reply
                  0
                  • karl261K Offline
                    karl261K Offline
                    karl261
                    wrote on last edited by
                    #11

                    Why are all my photos upside down? That's weird. They display right on the tablet, but on the PC in FireFox they are upside down...

                    1 Reply Last reply
                    0
                    • karl261K Offline
                      karl261K Offline
                      karl261
                      wrote on last edited by
                      #12

                      By the way: This is the sketch I use. It is made for a 1 MHz Atmega328p. If anyone has some code suggestions... :-)

                      I use a board that looks like this:

                      0_1474539330333_Clipboard01.jpg

                      /* Sketch with Si7021 and battery monitoring.
                      by m26872, 20151109 
                      modified for BME280 by karl261 using Sparkfun library
                      */
                      
                      // Enable and select radio type attached
                      // MIN, LOW, HIGH, MAX
                      #define MY_RADIO_NRF24
                      #define MY_RF24_PA_LEVEL RF24_PA_LOW
                      #define MY_PARENT_NODE_ID 99
                      #define MY_PARENT_NODE_IS_STATIC
                      #define MY_NODE_ID 6
                      //#define MY_DEBUG
                      
                      #define MY_BAUD_RATE 9600
                      
                      
                      #include <MySensors.h>  
                      #include <Wire.h>  //This library allows you to communicate with I2C / TWI devices. 
                      #include <SPI.h>
                      #include <RunningAverage.h>
                      
                      #include <SparkFunBME280.h>
                      
                      
                      
                      //#define DEBUG   // local debug
                      
                      #ifdef DEBUG
                      #define DEBUG_SERIAL(x) Serial.begin(x)
                      #define DEBUG_PRINT(x) Serial.print(x)
                      #define DEBUG_PRINTLN(x) Serial.println(x)
                      #else
                      #define DEBUG_SERIAL(x)
                      #define DEBUG_PRINT(x) 
                      #define DEBUG_PRINTLN(x) 
                      #endif
                      
                      // #define NODE_ID 132             // <<<<<<<<<<<<<<<<<<<<<<<<<<<   Enter Node_ID
                      #define CHILD_ID_HUM 0
                      #define CHILD_ID_TEMP 1
                      #define CHILD_ID_PRES 2
                      #define SLEEP_TIME 15000 // 15s for DEBUG
                      //#define SLEEP_TIME 300000   // 5 min
                      #define FORCE_TRANSMIT_CYCLE 36  // 5min*12=1/hour, 5min*36=1/3hour 
                      #define BATTERY_REPORT_CYCLE 2880   // Once per 5min   =>   12*24*7 = 2016 (one report/week)
                      #define VMIN 1900
                      #define VMAX 3300
                      #define HUMI_TRANSMIT_THRESHOLD 3.0  // THRESHOLD tells how much the value should have changed since last time it was transmitted.
                      #define TEMP_TRANSMIT_THRESHOLD 0.5
                      #define PRES_TRANSMIT_THRESHOLD 1.0
                      #define AVERAGES 2
                      
                      int batteryReportCounter = BATTERY_REPORT_CYCLE - 1;  // to make it report the first time.
                      int measureCount = 0;
                      float lastTemperature = -100;
                      float lastPressure = -100;
                      int lastHumidity = -100;
                      
                      RunningAverage raHum(AVERAGES);
                      //SI7021 humiditySensor;
                      BME280 mySensor;
                      
                      
                      // MyMessage to controler
                      MyMessage msgTemp(CHILD_ID_TEMP,V_TEMP); // Initialize temperature message
                      MyMessage msgHum(CHILD_ID_HUM,V_HUM);
                      MyMessage msgPres(CHILD_ID_PRES,V_PRESSURE);
                      
                      void presentation()
                      {
                        // Send the sketch version information to the gateway and Controller
                        sendSketchInfo("OUTSIDE P&T&H", "1.2");
                        present(CHILD_ID_TEMP, S_TEMP);
                        present(CHILD_ID_PRES, S_BARO);
                        present(CHILD_ID_HUM, S_HUM);  
                        DEBUG_PRINT("Node and "); DEBUG_PRINTLN("3 children presented.");
                      }
                      
                      void setup() {
                        DEBUG_SERIAL(9600);    // <<<<<<<<<<<<<<<<<<<<<<<<<< Note BAUD_RATE in MySensors.h
                        DEBUG_PRINTLN("Serial started");
                        
                        DEBUG_PRINT("Voltage: ");
                        DEBUG_PRINT(readVcc()); 
                        DEBUG_PRINTLN(" mV");
                      /*
                        delay(500);
                        DEBUG_PRINT("Internal temp: ");
                        DEBUG_PRINT(GetInternalTemp()); // Probably not calibrated. Just to print something.
                        DEBUG_PRINTLN(" *C");
                      */  
                      
                        mySensor.settings.commInterface = I2C_MODE;
                        mySensor.settings.I2CAddress = 0x77;
                      
                        //runMode can be:
                        //  0, Sleep mode
                        //  1 or 2, Forced mode
                        //  3, Normal mode
                        mySensor.settings.runMode = 1;
                        mySensor.settings.filter = 0;
                        mySensor.settings.tempOverSample = 1;
                        mySensor.settings.pressOverSample = 1;
                        mySensor.settings.humidOverSample = 1;
                        
                        delay(500); // Allow time for radio if power used as reset
                      
                        if (!mySensor.begin())
                         {
                          Serial.println("BME init failed!");
                          while (1);
                         }
                        else Serial.println("BME init success!");
                        
                        raHum.clear();
                        
                      }
                      
                      void loop() { 
                      
                        measureCount ++;
                        batteryReportCounter ++;
                        bool forceTransmit = false;
                        
                        if (measureCount > FORCE_TRANSMIT_CYCLE) {
                          forceTransmit = true; 
                        }
                        mySensor.begin();
                        sendTempHumidityMeasurements(forceTransmit);
                      /*
                        // Read and print internal temp
                        float temperature0 = static_cast<float>(static_cast<int>((GetInternalTemp()+0.5) * 10.)) / 10.;
                        DEBUG_PRINT("Internal Temp: "); DEBUG_PRINT(temperature0); DEBUG_PRINTLN(" *C");        
                      */
                        // Check battery
                        if (batteryReportCounter >= BATTERY_REPORT_CYCLE) {
                          long batteryVolt = readVcc();
                          DEBUG_PRINT("Battery voltage: "); DEBUG_PRINT(batteryVolt); DEBUG_PRINTLN(" mV");
                          uint8_t batteryPcnt = constrain(map(batteryVolt,VMIN,VMAX,0,100),0,255);   
                          DEBUG_PRINT("Battery percent: "); DEBUG_PRINT(batteryPcnt); DEBUG_PRINTLN(" %");
                          sendBatteryLevel(batteryPcnt);
                          batteryReportCounter = 0;
                        }
                        
                        sleep(SLEEP_TIME);
                      //if(isTransportOK()){
                      //    sleep(SLEEP_TIME);  // transport is OK, node can sleep
                      //  } 
                      //  else {
                      //    wait(5000); // transport is not operational, allow the transport layer to fix this
                      //  }
                      }
                      
                      // function for reading Vcc by reading 1.1V reference against AVcc. Based from http://provideyourown.com/2012/secret-arduino-voltmeter-measure-battery-voltage/
                      // To calibrate reading replace 1125300L with scale_constant = internal1.1Ref * 1023 * 1000, where internal1.1Ref = 1.1 * Vcc1 (per voltmeter) / Vcc2 (per readVcc() function) 
                      long readVcc() {
                        // set the reference to Vcc and the measurement to the internal 1.1V reference
                        ADMUX = _BV(REFS0) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1);
                        delay(2); // Wait for Vref to settle
                        ADCSRA |= _BV(ADSC); // Start conversion
                        while (bit_is_set(ADCSRA,ADSC)); // measuring
                        uint8_t low  = ADCL; // must read ADCL first - it then locks ADCH  
                        uint8_t high = ADCH; // unlocks both
                        long result = (high<<8) | low;
                        result = 1178053L / result; // Calculate Vcc (in mV); 1125300 = 1.1*1023*1000
                        //Node 6 = 1178053L
                        return result; // Vcc in millivolts
                      }
                      // function for reading internal temp. From http://playground.arduino.cc/Main/InternalTemperatureSensor 
                      double GetInternalTemp(void) {  // (Both double and float are 4 byte in most arduino implementation)
                        unsigned int wADC;
                        double t;
                        // The internal temperature has to be used with the internal reference of 1.1V. Channel 8 can not be selected with the analogRead function yet.
                        ADMUX = (_BV(REFS1) | _BV(REFS0) | _BV(MUX3));   // Set the internal reference and mux.
                        ADCSRA |= _BV(ADEN);  // enable the ADC
                        delay(20);            // wait for voltages to become stable.
                        ADCSRA |= _BV(ADSC);  // Start the ADC
                        while (bit_is_set(ADCSRA,ADSC));   // Detect end-of-conversion
                        wADC = ADCW;   // Reading register "ADCW" takes care of how to read ADCL and ADCH.
                        t = (wADC - 88.0 ) / 1.0;   // The default offset is 324.31.
                        return (t);   // The returned temperature in degrees Celcius.
                      }
                      
                      /*********************************************
                       * * Sends temperature and humidity from Si7021 sensor
                       * Parameters
                       * - force : Forces transmission of a value (even if it's the same as previous measurement)
                       *********************************************/
                      void sendTempHumidityMeasurements(bool force) {
                        bool tx = force;
                      
                        float temperature = mySensor.readTempC();
                        DEBUG_PRINT("T: ");DEBUG_PRINTLN(temperature);
                        float diffTemp = abs(lastTemperature - temperature);
                        DEBUG_PRINT(F("TempDiff :"));DEBUG_PRINTLN(diffTemp);
                        if (diffTemp > TEMP_TRANSMIT_THRESHOLD || tx) {
                          send(msgTemp.set(temperature,1));
                          lastTemperature = temperature;
                          measureCount = 0;
                          DEBUG_PRINTLN("T sent!");
                        }
                        
                        int humidity = mySensor.readFloatHumidity();
                        DEBUG_PRINT("H: ");DEBUG_PRINTLN(humidity);
                        raHum.addValue(humidity);
                        humidity = raHum.getAverage();  // MA sample imply reasonable fast sample frequency
                        float diffHum = abs(lastHumidity - humidity);  
                        DEBUG_PRINT(F("HumDiff  :"));DEBUG_PRINTLN(diffHum); 
                        if (diffHum > HUMI_TRANSMIT_THRESHOLD || tx) {
                          send(msgHum.set(humidity));
                          lastHumidity = humidity;
                          measureCount = 0;
                          DEBUG_PRINTLN("H sent!");
                        }
                      
                        float pressure = mySensor.readFloatPressure()/100.0;
                        DEBUG_PRINT("P: ");DEBUG_PRINTLN(pressure);
                        float diffPress = abs(lastPressure - pressure);
                        DEBUG_PRINT(F("PressDiff :"));DEBUG_PRINTLN(diffPress);
                        if (diffPress > PRES_TRANSMIT_THRESHOLD || tx) {
                          send(msgPres.set(pressure,1));
                          lastPressure = pressure;
                          measureCount = 0;
                          DEBUG_PRINTLN("P sent!");
                        }
                      
                      }
                      
                      1 Reply Last reply
                      0
                      • karl261K Offline
                        karl261K Offline
                        karl261
                        wrote on last edited by
                        #13

                        Well, I guess then I will change the BME280 to a new one and see how it goes. Let's see how long it lasts. If it is made for weather monitoring, it should withstand normal weather conditions if not exposed to rain???

                        1 Reply Last reply
                        0
                        • karl261K Offline
                          karl261K Offline
                          karl261
                          wrote on last edited by karl261
                          #14

                          Ok, I changed the BME280. Now it is better.

                          I like this sensor, I have right now 3 of them running next to each other:

                          T    20.8        21.2       21.1
                          H    60%         60%        60%
                          P    1015.3      1015.0     1014.9
                          

                          Isn't that great? Now let's see how long the outdoor sensor lasts. I don't know what else to improve...

                          R 1 Reply Last reply
                          0
                          • karl261K karl261

                            Ok, I changed the BME280. Now it is better.

                            I like this sensor, I have right now 3 of them running next to each other:

                            T    20.8        21.2       21.1
                            H    60%         60%        60%
                            P    1015.3      1015.0     1014.9
                            

                            Isn't that great? Now let's see how long the outdoor sensor lasts. I don't know what else to improve...

                            R Offline
                            R Offline
                            r-nox
                            wrote on last edited by
                            #15

                            @karl261 hopefully a longer time.

                            1 Reply Last reply
                            0
                            • karl261K Offline
                              karl261K Offline
                              karl261
                              wrote on last edited by
                              #16

                              It does not look that it was much longer time. But instead like the sensor before, the current one is now showing values between 0-22% humidity. T seems to be fine. That is SO disappointing. It seems that these things are not suitable for outdoor use. Lasted only a month...

                              Buuuuh.

                              1 Reply Last reply
                              0
                              • R Offline
                                R Offline
                                r-nox
                                wrote on last edited by
                                #17

                                Seems short lived...

                                1 Reply Last reply
                                0
                                • Nca78N Offline
                                  Nca78N Offline
                                  Nca78
                                  Hardware Contributor
                                  wrote on last edited by
                                  #18

                                  :( Sounds bad :(
                                  Next step for you is to try with a SHT21 with the protective film it might get a better chance than the BME280...

                                  1 Reply Last reply
                                  0
                                  • karl261K Offline
                                    karl261K Offline
                                    karl261
                                    wrote on last edited by karl261
                                    #19

                                    @r-nox Somehow, doesn't it? A bit too short for my taste. It should not see any rain, I wonder what is killing it. Or, how I can protect it even better.

                                    @Nca78 I had a SI7021 with protective foil before, but it was not very accurate. Actually it was quite far off, that's why I started to look for something more accurate.

                                    When I look around online there seems to be some connection/confusion with the SI7021 and SHT21. But I did not really understand it. Does anybody know more about it?

                                    EDIT: Hm, seems to be two different sensors, but the board is always the same. So I would need to check to really get a SHT21 and with a protective cover...

                                    EDIT2: I do not seem to find any SHT21 with protective cover...

                                    1 Reply Last reply
                                    0
                                    • R Offline
                                      R Offline
                                      r-nox
                                      wrote on last edited by
                                      #20

                                      Are you over working it? Is that even possible?

                                      karl261K 1 Reply Last reply
                                      0
                                      • R r-nox

                                        Are you over working it? Is that even possible?

                                        karl261K Offline
                                        karl261K Offline
                                        karl261
                                        wrote on last edited by
                                        #21

                                        @r-nox You mean too many readings per time unit?

                                        1 Reply Last reply
                                        0
                                        • R Offline
                                          R Offline
                                          r-nox
                                          wrote on last edited by
                                          #22

                                          That's my line of thought.

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


                                          19

                                          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