BME280 node not sleeping



  • Hello,
    I've build my first node with NodeManager, code is at end of post; it looks like it's not sleeping, it worn out a pair of AA in 24h.
    There's a strange half-lit LED on it: what did I do wrong? Same node with a standard hand-written sketch is working as usual.
    Thanks all!

    // General settings
    #define SKETCH_NAME "GarageLibrarySensor"
    #define SKETCH_VERSION "0.1"
    #define MY_BAUD_RATE 9600
    #define MY_NODE_ID 2
    
    #define MY_SPLASH_SCREEN_DISABLED
    #define MY_SIGNAL_REPORT_ENABLED
    
    // NRF24 radio settings
    #define MY_RADIO_NRF24
    //set how long to wait for transport ready in milliseconds
    
    // Optimizations when running on 2032 Coin Cell. Also set nodeManager.setSleepBetweenSend(500) and run the board at 1Mhz
    #define MY_TRANSPORT_UPLINK_CHECK_DISABLED
    #define MY_TRANSPORT_WAIT_READY_MS  5000
    #define MY_SLEEP_TRANSPORT_RECONNECT_TIMEOUT_MS 2000
    //#define MY_PARENT_NODE_ID 0
    //#define MY_PARENT_NODE_IS_STATIC
    
    #define NODEMANAGER_DEBUG ON
    
    #define NODEMANAGER_SLEEP ON
    #define NODEMANAGER_OTA_CONFIGURATION OFF
    #define NODEMANAGER_CONDITIONAL_REPORT ON
    #define NODEMANAGER_POWER_MANAGER ON  
    
    #define NODEMANAGER_SENSOR_BOSCH_LITE ON
    
    #include <MySensors_NodeManager.h>
    
    // Sensors
    // Battery Level (default child_id 201)
    #include <sensors/SensorBattery.h>
    SensorBattery battery;
    
    // Radio Signal Quality (default child_id 202)
    #include <sensors/SensorSignal.h>
    SensorSignal signal;
    
    
    #include <sensors/SensorBME280.h>
    //#define CHILD_ID_AMBIENT 1
    SensorBME280 ambient;
    
    // before
    void before() {
      /**********************************
         Configure your sensors
       **********************************/
      // let controller know ambient pressure sensor reports in hPa
      ambient.children.get(3)->setUnitPrefix("hPa");
       
      // send unit prefixes to controller (i.e. V, A, hPa, %, etc.)
      nodeManager.setSendUnitPrefix(true);
    
      // report ambient measurements every 1h
      ambient.setReportIntervalMinutes(60);
    
      // report battery level every 60 minutes
      battery.setReportIntervalMinutes(720);
    
      // report radio signal level every 4h
      signal.setReportIntervalMinutes(1440);
    
      // only a pseudo SR_TX_RSSI and SR_UPLINK_QUALITY are available for NRF24
      // radio. All other methods return as INVALID.
      signal.setSignalCommand(SR_UPLINK_QUALITY);
    
      // call NodeManager before routine
      nodeManager.before();
    }
    
    // presentation
    void presentation() {
      // call NodeManager presentation routine
      nodeManager.presentation();
    }
    
    // setup
    void setup() {
      // call NodeManager setup routine
      nodeManager.setup();
    }
    
    // loop
    void loop() {
      // call NodeManager loop routine
      nodeManager.loop();
    }
    
    #if NODEMANAGER_RECEIVE == ON
    // receive
    void receive(const MyMessage &message) {
      // call NodeManager receive routine
      nodeManager.receive(message);
    }
    #endif
    
    #if NODEMANAGER_TIME == ON
    // receiveTime
    void receiveTime(unsigned long ts) {
      // call NodeManager receiveTime routine
      nodeManager.receiveTime(ts);
    }
    #endif
    
    


  • Hi @ghiglie I'm still beginning in all this, but I think you need to call nodeManager.setSleepMinutes(minutes) otherwise the node will still awake.



  • @bbastos said in BME280 node not sleeping:

    Hi @ghiglie I'm still beginning in all this, but I think you need to call nodeManager.setSleepMinutes(minutes) otherwise the node will still awake.

    Oh... I feel so dumb! Thanks @bbastos , I didn't ... know it. I don't know why, maybe on the solder/flash/test/upload frenzy I read that part of documentation. So, as usual, I'll RTFM and report back. Thanks again!!!



  • So, new message to get up a notification with my full working sketch. I'm so satisfied!
    Putting a BME280 in a garage is an overkill, but I couldn't get a decent measure from the DHTs I have. I added a PIR to it, just for a minor convenience.
    With next node I'll explore OTA features - flash and configuration.

    // General settings
    #define SKETCH_NAME "GarageLibrary"
    #define SKETCH_VERSION "2.0"
    #define MY_BAUD_RATE 9600
    #define MY_NODE_ID 2
    
    #define MY_RADIO_NRF24
    #define MY_SIGNAL_REPORT_ENABLED
    
    #define MY_SPLASH_SCREEN_DISABLED
    
    //#define MY_TRANSPORT_UPLINK_CHECK_DISABLED
    #define MY_TRANSPORT_WAIT_READY_MS  5000
    #define MY_SLEEP_TRANSPORT_RECONNECT_TIMEOUT_MS 2000
    //#define MY_PARENT_NODE_ID 0
    //#define MY_PARENT_NODE_IS_STATIC
    
    #define NODEMANAGER_DEBUG ON //
    #define NODEMANAGER_DEBUG_VERBOSE OFF
    #define NODEMANAGER_SLEEP ON //
    #define NODEMANAGER_RECEIVE OFF
    #define NODEMANAGER_POWER_MANAGER OFF
    #define NODEMANAGER_CONDITIONAL_REPORT ON //
    #define NODEMANAGER_INTERRUPTS ON //
    #define NODEMANAGER_EEPROM OFF
    #define NODEMANAGER_TIME OFF
    #define NODEMANAGER_RTC OFF
    #define NODEMANAGER_SD OFF
    #define NODEMANAGER_HOOKING OFF
    #define NODEMANAGER_OTA_CONFIGURATION OFF
    #define NODEMANAGER_SERIAL_INPUT OFF
    
    // disable Forecast on BME280 - not working with OTA conf Off!
    #define NODEMANAGER_SENSOR_BOSCH_LITE ON
    
    #include <MySensors_NodeManager.h>
    
    // BME280
    #include <sensors/SensorBME280.h>
    #define BME280_ADDRESS (0x77)
    //#define CHILD_ID_AMBIENT 1
    SensorBME280 ambient;
    
    // PIR on D3 (optional build, PIN_PD3 is defined in MiniCore)
    #include <sensors/SensorMotion.h>
    SensorMotion pir(PIN_PD3);
    
    // Battery Level (default child_id 201)
    #include <sensors/SensorBattery.h>
    SensorBattery battery;
    
    // Radio Signal Quality (default child_id 202)
    #include <sensors/SensorSignal.h>
    SensorSignal signal;
    
    // before
    void before() {
      
      // let controller know ambient pressure sensor reports in hPa
      ambient.children.get(3)->setUnitPrefix("hPa");
       
      // send unit prefixes to controller (i.e. V, A, hPa, %, etc.)
      nodeManager.setSendUnitPrefix(true);
    
      // battery level - BOD set to 1.8V, 2xAA = 3V max
      battery.setMinVoltage(1.8);
      battery.setMaxVoltage(3.0);
    
      // sleep cycle
      nodeManager.setSleepMinutes(60);
      // 500ms to let the transport send all buffer before sleeping.
      nodeManager.setSleepBetweenSend(500);
      
      // report freq for ambient measurements
      ambient.setReportIntervalMinutes(60);
    
      // report freq for battery
      battery.setReportIntervalDays(1);
    
      // report freq for radio signal - pseudo SR_TX_RSSI and SR_UPLINK_QUALITY are available for NRF24
      signal.setReportIntervalDays(1);
      signal.setSignalCommand(SR_UPLINK_QUALITY);
    
      // call NodeManager before routine
      nodeManager.before();
    }
    
    // presentation
    void presentation() {
      // call NodeManager presentation routine
      nodeManager.presentation();
    }
    
    // setup
    void setup() {
      // call NodeManager setup routine
      nodeManager.setup();
    }
    
    // loop
    void loop() {
      // call NodeManager loop routine
      nodeManager.loop();
    }
    
    #if NODEMANAGER_RECEIVE == ON
    // receive
    void receive(const MyMessage &message) {
      // call NodeManager receive routine
      nodeManager.receive(message);
    }
    #endif
    
    #if NODEMANAGER_TIME == ON
    // receiveTime
    void receiveTime(unsigned long ts) {
      // call NodeManager receiveTime routine
      nodeManager.receiveTime(ts);
    }
    #endif
    


  • @ghiglie said in BME280 node not sleeping:

    So, new message to get up a notification with my full working sketch. I'm so satisfied!
    Putting a BME280 in a garage is an overkill, but I couldn't get a decent measure from the DHTs I have. I added a PIR to it, just for a minor convenience.
    With next node I'll explore OTA features - flash and configuration.

    // General settings
    #define SKETCH_NAME "GarageLibrary"
    #define SKETCH_VERSION "2.0"
    #define MY_BAUD_RATE 9600
    #define MY_NODE_ID 2
    
    #define MY_RADIO_NRF24
    #define MY_SIGNAL_REPORT_ENABLED
    
    #define MY_SPLASH_SCREEN_DISABLED
    
    //#define MY_TRANSPORT_UPLINK_CHECK_DISABLED
    #define MY_TRANSPORT_WAIT_READY_MS  5000
    #define MY_SLEEP_TRANSPORT_RECONNECT_TIMEOUT_MS 2000
    //#define MY_PARENT_NODE_ID 0
    //#define MY_PARENT_NODE_IS_STATIC
    
    #define NODEMANAGER_DEBUG ON //
    #define NODEMANAGER_DEBUG_VERBOSE OFF
    #define NODEMANAGER_SLEEP ON //
    #define NODEMANAGER_RECEIVE OFF
    #define NODEMANAGER_POWER_MANAGER OFF
    #define NODEMANAGER_CONDITIONAL_REPORT ON //
    #define NODEMANAGER_INTERRUPTS ON //
    #define NODEMANAGER_EEPROM OFF
    #define NODEMANAGER_TIME OFF
    #define NODEMANAGER_RTC OFF
    #define NODEMANAGER_SD OFF
    #define NODEMANAGER_HOOKING OFF
    #define NODEMANAGER_OTA_CONFIGURATION OFF
    #define NODEMANAGER_SERIAL_INPUT OFF
    
    // disable Forecast on BME280 - not working with OTA conf Off!
    #define NODEMANAGER_SENSOR_BOSCH_LITE ON
    
    #include <MySensors_NodeManager.h>
    
    // BME280
    #include <sensors/SensorBME280.h>
    #define BME280_ADDRESS (0x77)
    //#define CHILD_ID_AMBIENT 1
    SensorBME280 ambient;
    
    // PIR on D3 (optional build, PIN_PD3 is defined in MiniCore)
    #include <sensors/SensorMotion.h>
    SensorMotion pir(PIN_PD3);
    
    // Battery Level (default child_id 201)
    #include <sensors/SensorBattery.h>
    SensorBattery battery;
    
    // Radio Signal Quality (default child_id 202)
    #include <sensors/SensorSignal.h>
    SensorSignal signal;
    
    // before
    void before() {
      
      // let controller know ambient pressure sensor reports in hPa
      ambient.children.get(3)->setUnitPrefix("hPa");
       
      // send unit prefixes to controller (i.e. V, A, hPa, %, etc.)
      nodeManager.setSendUnitPrefix(true);
    
      // battery level - BOD set to 1.8V, 2xAA = 3V max
      battery.setMinVoltage(1.8);
      battery.setMaxVoltage(3.0);
    
      // sleep cycle
      nodeManager.setSleepMinutes(60);
      // 500ms to let the transport send all buffer before sleeping.
      nodeManager.setSleepBetweenSend(500);
      
      // report freq for ambient measurements
      ambient.setReportIntervalMinutes(60);
    
      // report freq for battery
      battery.setReportIntervalDays(1);
    
      // report freq for radio signal - pseudo SR_TX_RSSI and SR_UPLINK_QUALITY are available for NRF24
      signal.setReportIntervalDays(1);
      signal.setSignalCommand(SR_UPLINK_QUALITY);
    
      // call NodeManager before routine
      nodeManager.before();
    }
    
    // presentation
    void presentation() {
      // call NodeManager presentation routine
      nodeManager.presentation();
    }
    
    // setup
    void setup() {
      // call NodeManager setup routine
      nodeManager.setup();
    }
    
    // loop
    void loop() {
      // call NodeManager loop routine
      nodeManager.loop();
    }
    
    #if NODEMANAGER_RECEIVE == ON
    // receive
    void receive(const MyMessage &message) {
      // call NodeManager receive routine
      nodeManager.receive(message);
    }
    #endif
    
    #if NODEMANAGER_TIME == ON
    // receiveTime
    void receiveTime(unsigned long ts) {
      // call NodeManager receiveTime routine
      nodeManager.receiveTime(ts);
    }
    #endif
    

    Nice! Do you mind sharing a picture of your node? I've just assembled my first battery node using arduino pro mini and somehow it's working 😂
    I'm a beginner in electronics and would like to compare, see if I did mess up something.



  • Here it is:
    asd asd

    I'm using NModule with SMD nRF module - I was planning to use a CR2023 to downsize it, but I ended using this 2xAA battery holder.

    I'm a n00b too - I can say I started learning with MySensors' building motivation.
    I had a respectable cemetery:
    asd
    Mostly have corrupt booloader (update via programmer with antenna still powered) or incorrect fuses (batch production done wrong way!), but a pair got a nice polarity inversion on VCC... 😄 😄 😄 😄



  • Thank you! Ohh that's pretty complex for my super noob skills 😁

    I'm on the same vibe, using mysensors to start learning about electronics and automation. My first node is still on breadboard, but alive even after desoldering led and volt. reg. 😁:

    WhatsApp Image 2020-06-16 at 18.47.39.jpeg



  • That's not a bad test bed!

    I'm having some "headaches" still. The PIR isn't sending the V_TRIPPED 0 , so I know when there's moving but not when it stops - I can manage it via HomeAssistant anyway.



  • @ghiglie said in BME280 node not sleeping:

    That's not a bad test bed!

    I'm having some "headaches" still. The PIR isn't sending the V_TRIPPED 0 , so I know when there's moving but not when it stops - I can manage it via HomeAssistant anyway.

    I'm afraid I'll not be helpful now. Have you tried to update nodemanager library? I'm using the development branch from github.



  • @bbastos said in BME280 node not sleeping:

    @ghiglie said in BME280 node not sleeping:

    That's not a bad test bed!

    I'm having some "headaches" still. The PIR isn't sending the V_TRIPPED 0 , so I know when there's moving but not when it stops - I can manage it via HomeAssistant anyway.

    I'm afraid I'll not be helpful now. Have you tried to update nodemanager library? I'm using the development branch from github.

    No probs, it's the PIR itself, not reporting back the "0" status. I'll manage it via HA!


Log in to reply
 

Suggested Topics

  • 2
  • 16
  • 2
  • 8
  • 11
  • 1

0
Online

11.2k
Users

11.1k
Topics

112.5k
Posts