💬 Atmospheric Pressure Sensor

  • So I added the My Sensors board file, added the my sensors libary through library manager, coped the adafruit library and tried to compile. Arduino: 1.8.1 (Windows 8.1), Board: "Arduino Mini, ATmega328"

    C:\Users\eddy\Documents\Arduino\bmpTest\bmpTest.ino: In function 'void setup()':

    bmpTest:95: error: 'getConfig' was not declared in this scope

     metric = getConfig().isMetric;

    exit status 1
    'getConfig' was not declared in this scope

    This report would have more information with
    "Show verbose output during compilation"
    option enabled in File -> Preferences.
    Did I miss something?

  • Okay, I changed the library to version 2.0.0 and it now compiles.

  • Mod

    @boblasure I am not sure why, but the name of getConfig was changed. See https://forum.mysensors.org/topic/5841/getconfig-was-not-declared-in-this-scope-v2-1-1-fixed/ if you want to upgrade to 2.1.1 again.

  • @Luc3as

    The forecast script is meant to be running every minute to collect the averaging data. If you run it every 5 minutes, you need to change the dividers in the script to come to a hPa/h value that actually makes sense.

  • i've got a problem, pressure always stay to 1013 mbar and i'm at 350m of altitude. Something is wrong but what ? I test the BMP180 alone and it said the good value.

  • I found some problems in code. I did make some change to be able to get value. I replace "float pressure = bmp.readSealevelPressure(ALTITUDE) / 100.0;" by "float pressure = bmp.readPressure() / 100 ;"

    I'll make a PR on GitHub when everything will be well tested. 🙂

  • Hi, i've a problem with the bmp180 with domoticz. I use raspberry pi with domoticz and mysensor v2 and nrf24 on gpio, i receive data but i think is wrong. The temperature is 31°C and pressure is 728. I put my altitude in the sketch.
    Can you help me?
    Best regards.

  • Mod

    Welcome to the MySensors community @James-Flosse !

    Could you post your sketch and debug output from the node and the gateway?

    If you haven't looked at it already, https://www.mysensors.org/build/debug#enabling-debug-logging has information on how to enable debug logging.

  • Hi @mfalkvidd. This is the debug output and my code

    2269 MCO:REG:REQ
    2277 TSF:MSG:SEND,3-3-0-0,s=255,c=3,t=26,pt=1,l=1,sg=0,ft=0,st=OK:2
    2287 TSF:MSG:READ,0-0-3,s=255,c=3,t=27,pt=1,l=1,sg=0:1
    2293 MCO:PIM:NODE REG=1
    2295 MCO:BGN:STP
    2306 MCO:BGN:INIT OK,TSP=1
    Forecast at minute 1 dP/dt = 0.00kPa/h --> unknown
    Temperature = 31.00 *C
    Pressure = 728.00 hPa
    Forecast = unknown
    2359 TSF:MSG:SEND,3-3-0-0,s=1,c=1,t=0,pt=7,l=5,sg=0,ft=0,st=OK:31.0
    2369 TSF:MSG:SEND,3-3-0-0,s=0,c=1,t=4,pt=7,l=5,sg=0,ft=0,st=OK:728
    2381 TSF:MSG:SEND,3-3-0-0,s=0,c=1,t=5,pt=0,l=7,sg=0,ft=0,st=OK:unknown
    2387 MCO:SLP:MS=60000,SMS=0,I1=255,M1=255,I2=255,M2=255
    2394 MCO:SLP:TPD
    // Enable debug prints to serial monitor
    #define MY_DEBUG 
    // Enable and select radio type attached
    #define MY_RADIO_NRF24
    //#define MY_RADIO_RFM69
    #include <SPI.h>
    #include <MySensors.h>  
    #include <Wire.h>
    #include <Adafruit_BMP085.h>
    #define BARO_CHILD 0
    #define TEMP_CHILD 1
    const float ALTITUDE = 688; // <-- adapt this value to your own location's altitude.
    // Sleep time between reads (in seconds). Do not change this value as the forecast algorithm needs a sample every minute.
    const unsigned long SLEEP_TIME = 60000; 
    const char *weather[] = { "stable", "sunny", "cloudy", "unstable", "thunderstorm", "unknown" };
    enum FORECAST
        STABLE = 0,            // "Stable Weather Pattern"
        SUNNY = 1,            // "Slowly rising Good Weather", "Clear/Sunny "
        CLOUDY = 2,            // "Slowly falling L-Pressure ", "Cloudy/Rain "
        UNSTABLE = 3,        // "Quickly rising H-Press",     "Not Stable"
        THUNDERSTORM = 4,    // "Quickly falling L-Press",    "Thunderstorm"
        UNKNOWN = 5            // "Unknown (More Time needed)
    Adafruit_BMP085 bmp = Adafruit_BMP085();      // Digital Pressure Sensor 
    float lastPressure = -1;
    float lastTemp = -1;
    int lastForecast = -1;
    const int LAST_SAMPLES_COUNT = 5;
    float lastPressureSamples[LAST_SAMPLES_COUNT];
    // this CONVERSION_FACTOR is used to convert from Pa to kPa in forecast algorithm
    // get kPa/h be dividing hPa by 10 
    #define CONVERSION_FACTOR (1.0/10.0)
    int minuteCount = 0;
    bool firstRound = true;
    // average value is used in forecast algorithm.
    float pressureAvg;
    // average after 2 hours is used as reference value for the next iteration.
    float pressureAvg2;
    float dP_dt;
    bool metric;
    MyMessage tempMsg(TEMP_CHILD, V_TEMP);
    MyMessage pressureMsg(BARO_CHILD, V_PRESSURE);
    MyMessage forecastMsg(BARO_CHILD, V_FORECAST);
    void setup() 
        if (!bmp.begin()) 
            Serial.println("Could not find a valid BMP085 sensor, check wiring!");
            while (1) {}
        metric = getControllerConfig().isMetric;
    void presentation()  {
      // Send the sketch version information to the gateway and Controller
      sendSketchInfo("Pressure Sensor", "1.1");
      // Register sensors to gw (they will be created as child devices)
      present(BARO_CHILD, S_BARO);
      present(TEMP_CHILD, S_TEMP);
    void loop() 
        float pressure = bmp.readPressure() / 100 ;
        float temperature = bmp.readTemperature();
        if (!metric) 
            // Convert to fahrenheit
            temperature = temperature * 9.0 / 5.0 + 32.0;
        int forecast = sample(pressure);
        Serial.print("Temperature = ");
        Serial.println(metric ? " *C" : " *F");
        Serial.print("Pressure = ");
        Serial.println(" hPa");
        Serial.print("Forecast = ");
        if (temperature != lastTemp) 
            send(tempMsg.set(temperature, 1));
            lastTemp = temperature;
        if (pressure != lastPressure) 
            send(pressureMsg.set(pressure, 0));
            lastPressure = pressure;
        if (forecast != lastForecast)
            lastForecast = forecast;
    float getLastPressureSamplesAverage()
        float lastPressureSamplesAverage = 0;
        for (int i = 0; i < LAST_SAMPLES_COUNT; i++)
            lastPressureSamplesAverage += lastPressureSamples[i];
        lastPressureSamplesAverage /= LAST_SAMPLES_COUNT;
        return lastPressureSamplesAverage;
    // Algorithm found here
    // http://www.freescale.com/files/sensors/doc/app_note/AN3914.pdf
    // Pressure in hPa -->  forecast done by calculating kPa/h
    int sample(float pressure)
        // Calculate the average of the last n minutes.
        int index = minuteCount % LAST_SAMPLES_COUNT;
        lastPressureSamples[index] = pressure;
        if (minuteCount > 185)
            minuteCount = 6;
        if (minuteCount == 5)
            pressureAvg = getLastPressureSamplesAverage();
        else if (minuteCount == 35)
            float lastPressureAvg = getLastPressureSamplesAverage();
            float change = (lastPressureAvg - pressureAvg) * CONVERSION_FACTOR;
            if (firstRound) // first time initial 3 hour
                dP_dt = change * 2; // note this is for t = 0.5hour
                dP_dt = change / 1.5; // divide by 1.5 as this is the difference in time from 0 value.
        else if (minuteCount == 65)
            float lastPressureAvg = getLastPressureSamplesAverage();
            float change = (lastPressureAvg - pressureAvg) * CONVERSION_FACTOR;
            if (firstRound) //first time initial 3 hour
                dP_dt = change; //note this is for t = 1 hour
                dP_dt = change / 2; //divide by 2 as this is the difference in time from 0 value
        else if (minuteCount == 95)
            float lastPressureAvg = getLastPressureSamplesAverage();
            float change = (lastPressureAvg - pressureAvg) * CONVERSION_FACTOR;
            if (firstRound) // first time initial 3 hour
                dP_dt = change / 1.5; // note this is for t = 1.5 hour
                dP_dt = change / 2.5; // divide by 2.5 as this is the difference in time from 0 value
        else if (minuteCount == 125)
            float lastPressureAvg = getLastPressureSamplesAverage();
            pressureAvg2 = lastPressureAvg; // store for later use.
            float change = (lastPressureAvg - pressureAvg) * CONVERSION_FACTOR;
            if (firstRound) // first time initial 3 hour
                dP_dt = change / 2; // note this is for t = 2 hour
                dP_dt = change / 3; // divide by 3 as this is the difference in time from 0 value
        else if (minuteCount == 155)
            float lastPressureAvg = getLastPressureSamplesAverage();
            float change = (lastPressureAvg - pressureAvg) * CONVERSION_FACTOR;
            if (firstRound) // first time initial 3 hour
                dP_dt = change / 2.5; // note this is for t = 2.5 hour
                dP_dt = change / 3.5; // divide by 3.5 as this is the difference in time from 0 value
        else if (minuteCount == 185)
            float lastPressureAvg = getLastPressureSamplesAverage();
            float change = (lastPressureAvg - pressureAvg) * CONVERSION_FACTOR;
            if (firstRound) // first time initial 3 hour
                dP_dt = change / 3; // note this is for t = 3 hour
                dP_dt = change / 4; // divide by 4 as this is the difference in time from 0 value
            pressureAvg = pressureAvg2; // Equating the pressure at 0 to the pressure at 2 hour after 3 hours have past.
            firstRound = false; // flag to let you know that this is on the past 3 hour mark. Initialized to 0 outside main loop.
        int forecast = UNKNOWN;
        if (minuteCount < 35 && firstRound) //if time is less than 35 min on the first 3 hour interval.
            forecast = UNKNOWN;
        else if (dP_dt < (-0.25))
            forecast = THUNDERSTORM;
        else if (dP_dt > 0.25)
            forecast = UNSTABLE;
        else if ((dP_dt > (-0.25)) && (dP_dt < (-0.05)))
            forecast = CLOUDY;
        else if ((dP_dt > 0.05) && (dP_dt < 0.25))
            forecast = SUNNY;
        else if ((dP_dt >(-0.05)) && (dP_dt < 0.05))
            forecast = STABLE;
            forecast = UNKNOWN;
        // uncomment when debugging
        Serial.print(F("Forecast at minute "));
        Serial.print(F(" dP/dt = "));
        Serial.print(F("kPa/h --> "));
        return forecast;
    2017-03-09 10:52:56.474 MySensors: Node: 3, Sketch Name: Pressure Sensor
    2017-03-09 10:52:56.475 MySensors: Node: 3, Sketch Version: 1.1
    2017-03-09 10:52:56.488 (GATEWAY) Temp (Temp)
    2017-03-09 10:52:56.497 (GATEWAY) General/Barometer (Baro)
    2017-03-09 10:52:56.503 (GATEWAY) General/Barometer (Baro)
    2017-03-09 10:53:40.053 MySensors: Node: 3, Sketch Name: Pressure Sensor
    2017-03-09 10:53:40.054 MySensors: Node: 3, Sketch Version: 1.1
    2017-03-09 10:53:40.067 (GATEWAY) Temp (Temp)
    2017-03-09 10:53:40.075 (GATEWAY) General/Barometer (Baro)
    2017-03-09 10:53:40.081 (GATEWAY) General/Barometer (Baro)
    2017-03-09 10:54:14.102 MySensors: Node: 3, Sketch Name: Pressure Sensor
    2017-03-09 10:54:14.104 MySensors: Node: 3, Sketch Version: 1.1
    2017-03-09 10:54:14.148 (GATEWAY) Temp (Temp)
    2017-03-09 10:54:14.162 (GATEWAY) General/Barometer (Baro)
    2017-03-09 10:54:14.172 (GATEWAY) General/Barometer (Baro)
    2017-03-09 10:54:26.662 MySensors: Node: 3, Sketch Name: Pressure Sensor
    2017-03-09 10:54:26.664 MySensors: Node: 3, Sketch Version: 1.1
    2017-03-09 10:54:26.676 (GATEWAY) Temp (Temp)
    2017-03-09 10:54:26.685 (GATEWAY) General/Barometer (Baro)
    2017-03-09 10:54:26.691 (GATEWAY) General/Barometer (Baro)
    2017-03-09 10:54:44.122 MySensors: Node: 3, Sketch Name: Pressure Sensor
    2017-03-09 10:54:44.123 MySensors: Node: 3, Sketch Version: 1.1
    2017-03-09 10:54:44.136 (GATEWAY) Temp (Temp)
    2017-03-09 10:54:44.145 (GATEWAY) General/Barometer (Baro)
    2017-03-09 10:54:44.150 (GATEWAY) General/Barometer (Baro)
    2017-03-09 10:54:50.417 MySensors: Node: 3, Sketch Name: Pressure Sensor
    2017-03-09 10:54:51.225 MySensors: Node: 3, Sketch Version: 1.1
    2017-03-09 10:54:51.227 (GATEWAY) Temp (Temp)
    2017-03-09 10:54:51.236 (GATEWAY) General/Barometer (Baro)
    2017-03-09 10:54:51.242 (GATEWAY) General/Barometer (Baro)
    2017-03-09 10:55:55.513 (GATEWAY) General/Barometer (Baro)
    2017-03-09 10:58:05.600 (GATEWAY) Temp (Temp)
    2017-03-09 10:58:05.608 (GATEWAY) General/Barometer (Baro)
    2017-03-09 10:59:10.651 (GATEWAY) Temp (Temp)
    2017-03-09 11:01:20.704 (GATEWAY) Temp (Temp)
    2017-03-09 11:02:00.701 MySensors: Node: 3, Sketch Name: Pressure Sensor
    2017-03-09 11:02:00.702 MySensors: Node: 3, Sketch Version: 1.1
    2017-03-09 11:02:00.715 (GATEWAY) Temp (Temp)
    2017-03-09 11:02:00.723 (GATEWAY) General/Barometer (Baro)
    2017-03-09 11:02:00.728 (GATEWAY) General/Barometer (Baro)
    2017-03-09 11:02:31.650 MySensors: Node: 3, Sketch Name: Pressure Sensor
    2017-03-09 11:02:31.652 MySensors: Node: 3, Sketch Version: 1.1
    2017-03-09 11:02:31.664 (GATEWAY) Temp (Temp)
    2017-03-09 11:02:31.673 (GATEWAY) General/Barometer (Baro)
    2017-03-09 11:02:31.678 (GATEWAY) General/Barometer (Baro)
    2017-03-09 11:02:38.872 MySensors: Node: 3, Sketch Name: Pressure Sensor
    2017-03-09 11:02:38.873 MySensors: Node: 3, Sketch Version: 1.1
    2017-03-09 11:02:38.886 (GATEWAY) Temp (Temp)
    2017-03-09 11:02:38.894 (GATEWAY) General/Barometer (Baro)
    2017-03-09 11:02:38.900 (GATEWAY) General/Barometer (Baro)
    2017-03-09 11:02:41.863 MySensors: Node: 3, Sketch Name: Pressure Sensor
    2017-03-09 11:02:41.864 MySensors: Node: 3, Sketch Version: 1.1
    2017-03-09 11:02:41.887 (GATEWAY) Temp (Temp)
    2017-03-09 11:02:41.895 (GATEWAY) General/Barometer (Baro)
    2017-03-09 11:02:41.901 (GATEWAY) General/Barometer (Baro)
    2017-03-09 11:02:49.208 MySensors: Node: 3, Sketch Name: Pressure Sensor
    2017-03-09 11:02:49.209 MySensors: Node: 3, Sketch Version: 1.1
    2017-03-09 11:02:49.232 (GATEWAY) Temp (Temp)
    2017-03-09 11:02:49.240 (GATEWAY) General/Barometer (Baro)
    2017-03-09 11:02:49.245 (GATEWAY) General/Barometer (Baro)
    2017-03-09 11:03:54.286 (GATEWAY) General/Barometer (Baro)
    2017-03-09 11:04:59.319 (GATEWAY) General/Barometer (Baro)
    2017-03-09 11:06:04.359 (GATEWAY) Temp (Temp)
    2017-03-09 11:06:04.368 (GATEWAY) General/Barometer (Baro)
    2017-03-09 11:06:36.109 MySensors: Node: 3, Sketch Name: Pressure Sensor
    2017-03-09 11:06:36.111 MySensors: Node: 3, Sketch Version: 1.1
    2017-03-09 11:06:36.123 (GATEWAY) Temp (Temp)
    2017-03-09 11:06:36.132 (GATEWAY) General/Barometer (Baro)
    2017-03-09 11:06:36.137 (GATEWAY) General/Barometer (Baro)

  • Mod

    The node sends the data received from the bmp180, so everything seems to be correct. Could you clarify what you expected?

  • The pressure and temperature is incorrect xD. sorry, i have 20°C in my room and the METAR of the near airport say 1016 hPa.

  • Mod

    @James-Flosse thanks 🙂
    Strange problem. Is the bmp getting stable power? Maybe it is defective? You don't happen to have another bmp to compare with?

  • Only bmp180 connected to arduino and i have test with 3 other :s

  • Hi, i'm using this sketch and I had to modify it a little bit. But i'm at work and i haven't it.

    You defined the altitude to 688 meters in you sketch, are you sure, you said you're at 1014mbars. If you're really at 700m you should be near 930mbars not 1014mbars.

  • Ok i defined the altitude by my own (225 meters) but i have the same pressure and temperature :S

  • Too bad, can you upload a basic example sketch in the library adafruit to read pressure and temperature, just to be sure there is the same behavior.

  • #include <Wire.h>
    #include <Adafruit_Sensor.h>
    #include <Adafruit_BMP085_U.h>
    Adafruit_BMP085_Unified bmp = Adafruit_BMP085_Unified(10085);
    void setup(void) 
      Serial.println("Pressure Sensor Test"); Serial.println("");
      /* Initialise the sensor */
        /* There was a problem detecting the BMP085 ... check your connections */
        Serial.print("Ooops, no BMP085 detected ... Check your wiring or I2C ADDR!");
    void loop(void) 
      /* Get a new sensor event */ 
      sensors_event_t event;
      /* Display the results (barometric pressure is measure in hPa) */
      if (event.pressure)
        /* Display atmospheric pressure in hPa */
        Serial.print("Pressure: "); Serial.print(event.pressure); Serial.println(" hPa");
        Serial.println("Sensor error");
    Pressure: 756.46 hPa
    Pressure: 756.47 hPa
    Pressure: 756.49 hPa
    Pressure: 756.44 hPa
    Pressure: 756.44 hPa
    Pressure: 756.46 hPa
    Pressure: 756.41 hPa
    Pressure: 756.44 hPa
    Pressure: 756.42 hPa
    Pressure: 756.39 hPa
    Pressure: 756.42 hPa
    Pressure: 756.44 hPa
    Pressure: 756.38 hPa
    Pressure: 756.40 hPa
    Pressure: 756.41 hPa
    Pressure: 756.38 hPa
    Pressure: 756.41 hPa
    Pressure: 756.40 hPa
    Pressure: 756.38 hPa
    Pressure: 756.40 hPa
    Pressure: 756.42 hPa
    Pressure: 756.34 hPa
    Pressure: 756.22 hPa
    Pressure: 756.33 hPa
    Pressure: 756.37 hPa
    Pressure: 756.38 hPa

    same pressure

  • Where did you buy your bmp180 ? you said the 3 you have make the same behavior ? something is wrong with the BMP sensor.

  • I bought it in banggood, but it work's before...

  • It worked for a while and now it doesn't ? no problem of power supply ? 3v3 ?

  • I supply itwith the 3.3 V output off arduino

  • I supply it with 5v, are you sure it's a 3v3 version ?

  • OK, i've no further idea to help you. But i think your sensor is dead. DId you try older or newer library to compile your project ?

  • Have you link for older library? Are you french?

  • I am and you ? I can give you the sketch which is working for me with library i used.

  • Yes ^^ . can you give me at snyp_thx at hotmail dot fr?

  • Hi!
    I had exactly the same problem until I realised I had compiled for the 8 MHz version of the Arduino Pro Mini instead of the 16 MHz version.
    Also, recently building an humidity sensor I realised there are no pull-up resistors on the SDA SDL lines, but that should be built-in if you use a break-out module.

  • Hero Member

    Which altitude did you enter, or at which sealevel do you live (in meters)?

    const float ALTITUDE = 688; // <-- adapt this value to your own location's altitude.

    The pressure of 728 hPa is a bit strange as it should be around 1000 hPa. In my eyes you threw out the code to correct the pressure depending on the sealevel of your home. See the code from my sketch:

    float pressure = bmp.seaLevelForAltitude(SEALEVEL, absolutePressure);

    Here you can download the sketch I am using:

    The forecast will be unknown for at least 30minutes, because the sensor needs that time to detect a weather trend.

  • @bgunnarb you are find the problem, i think i have arduino pro mini 3.3V but it's 5V. Thx very much it's work better now 🙂

  • Where do the pin assignments live?

  • Mod

    in the article page
    SCL A5 (analog input) Marked blue
    SDA A4 (analog input) Marked green

  • @gohan it appears as though I need SLC and SDA for the sensor it will prevent me from using a second SLC/SDA device. I was assuming that they were utilizing the analog input. My comment may be deleted as it is clearly not applicable

  • Mod

    that is I2C bus, you can collect multiple devices as long as they have different addresses

  • OH cool. I guess I have tons more to learn thank you for your help

  • The initial description on this page refers to BMP085.
    The 'Example' states it is for BMP085 with Adafruit library (linked for dowbload).
    The sketch uses a BME280 with library from Embedded Adventures.
    The Datasheet is linked for a BMP085.
    The shopping guide links to a BMP180.


  • Mod

    Sorry for not noticing your post earlier @skywatch

    The example was originally designed for BMP085. When the BMP180 became widely available, the buy link was updated to the newer version with the note "replaces the old BMP085". Both use the same library.

    At a later stage, a MySensors user suggested changes to the example sketch to use the BME sensor instead. I don't know why this change was made, but my guess is that the user liked the BME sensor better. I don't know why the change was accepted without updating the build page, but my guess is that since the commit doesn't mention the change of sensor and the amount of code changed is quite large (369 additions and 252 deletions) nobody noticed that a new sensor was used.

    I'm trying to address the sensor change in https://forum.mysensors.org/topic/9801/bmp-e-atmospheric-pressure

  • Heads-up: I've observed my sensor trying to sleep for 4 billion ms when running the sample code:

    60082 MCO:SLP:MS=4294967214,SMS=0,I1=255,M1=255,I2=255,M2=255

    That's 2^32-82. So I think there's an underflow with this line:

    unsigned long sleeptime = BME280measurementSleepTime - (quicktimecheck - previousBME280Millis);

    Not sure where exactly though. I've changed my code to simply sleep for a constant 60s.

  • @mfalkvidd I've just started to look into this sensor and the main page is still quite confusing as already stated by @skywatch

    It seems the choice at present is between the BMP280 or BME280. the latter also includes humidity.
    Maybe the title could say Temperature/Pressure/Humidity? I just ordered a replacement Si7021, not realising there was another all in one sensor available.
    It is clear that most ebay sellers are also confused and are wrongly listing BMP devices as BME.
    I found a good summary to the confusion here https://goughlui.com/2018/08/05/note-bosch-sensortec-bmp280-vs-bme280-sensor-confusion/
    Hope this helps someone - Think I'll be going for a BME280 here as it as some positive reviews https://www.ebay.co.uk/itm/Breakout-Temperature-Humidity-Barometric-Pressure-BME280-Digital-Sensor-Module/401513062540

  • I have now had my delivery of the above ebay sensor. Everything looks good. It is a BME280 and reports temp, humidity and pressure.

    I have used the sketch on the build page and it has worked without any editing. I just had to install the BME280 library as given in the example sketch. Everything is shown nicely in Domoticz.

    Interesting to note that when compiling in arduino IDE I get the following error : Low memory available, stability problems may occur.

    Wonder if there will be enough room to add my battery level monitoring code?

  • Mod

    @grumpazoid If you don't use the forecast feature, remove #define GENERATE_FORECAST. Doing that should give you much less ram usage.

  • @mfalkvidd Thanks for that. This is going to be my outside weather node running off a 12V solar charged battery. I started wi a DHT22 but it failed after a few months.

  • @mfalkvidd I've got it up and running now on the bench complete with measuring voltage. I found that removing all the serial print statements also free up a lot of memory. Thanks to all those involved for the provided code.

  • When using BME280 breakout https://lowpowerlab.com/shop/product/185 with Embedded Adventures library, life is easier if addrBME280 is set to 0x77 (it is set to 0x76 in BME280_MOD-1022.h)

  • Weird question, but has anyone dealt with thermal isolation of the BMPx8x modules?

    To increase the WAF, I have one, together with a BH1750 and an rf-nano in a small, aesthetically pleasing, 3D printed custom housing. However, the temperature is stuck at 26.2°C, which I assume is due to the radiant heat from (mostly) the Arduino and the nRF24L01+

    So I am looking for ways to keep the BMPx8x cooler, so it can correctly measure the temperature (and therefore also the pressure, as the warmer chip means the barometric adjustment will be off)...

  • Mod

    @Fear-na-Boinne how about calling sleep() between measurements? That will pus the Arduino and the nrf24 in sleep mode, where they won't generate heat.

  • @mfalkvidd Didn't think of that... I can try changing the delay() to a sleep() and see how much that impacts the temperature...

    (But I still am open to ideas to help insulate the sensor, and am now also wondering whether creating extra vent holes on both sides of the rf-nano might be a good idea, even if it means more dust can come in as well...)

  • @Fear-na-Boinne I don't know how your device / enclosure is built, but it's good practice to place environmental sensors as close to an opening in the enclosure and keep the dead volume around it as small as possible. Ideally, you'd put it in a separate chamber and move it as far away from other electronics and possible heat sources to minimize their influence to the measurements. If you're worried about dust, you could use thin cloth or something like that around the openings as a dust filter.

    That being said, the BME/P sensors tend to report too high temperatures (just google for "BME temperature too high" or something like that - you'll find tons of topics), partly due to self-heating depending on how you use it, e.g. with oversampling enabled. IIRC, using forced mode, oversampling at 0 for pressure and 1 for temperature (and humidity) and filter turned off, is the prefered way for simple weather measurements with minimal current draw according to the datasheet.

    If you have one of those 5V modules, the voltage regulator on board might give off some heat aswell.

    The "easiest" fix would be to offset the temperature reading in software by a few degrees, if the reported temperature is off by the same value over the whole relevant temperature range (assuming 15 - 30°C for room temperature in your case).

  • The min temperature has dropped significantly since using sleep(), but still the lowest I have seen is 22.8°C, when the other sensor in the room (The central heating thermostat that speaks OpenTherm) was showing a bigger variance.

    My sensors are running on the 3.3v the Arduino puts out, so no extra regulators putting out heat (ie other than the one on the Arduino board).

    I designed openings and stand-offs in the lid of the enclosure for the sensors, and the rf-nano sits at the bottom of the enclosure, but atm they share the same single chamber... Thinking of drilling a few venting holes near the rf-nano to let warm air out and cool air in...

    IIRC am not oversampling, just doing timed single samples, but I'd have to check that.
    It's currently sampling once every 10s because the enclosure also has a BH1750 lux sensor I want to sample more frequently, and they obviously run in the same sketch... 😛

  • Putting the graphs next to eachother, the graphs looked similar, and after guesstimating the difference and applying that to the sensor as a correction in Domoticz, the graphs are overlapping sufficiently to explain the differences by the difference in location (one is in the center at ~1.7m height, the other on a shelf in a corner at ~2m height) and standard deviation...
    I'll keep it like this for a while and will reevaluate at a week's interval.

    FWIW I am actually doing the basic oversampling, while doing the timed single samples.
    If it remains an issue, I could modify the code to start the sensor with reduced oversampling/accuracy setting, but for now it looks good (enough)...

Log in to reply

Suggested Topics