High Power Consumption without any reason.



  • Hello Guys,

    I made a MySensor-Sensor out of an Arduino Pro Mini 3V3 8Mhz Clone a BME280 and a NRF24L01 module. During sending the data my power consumption is about 17-18mA, which is often mentioned in the forum.
    But in sleepmode there is a much higher power consumption of 4mA than I expected and also mentioned in the topics.

    Could you please give me a hint where I had to look for the high power consumption? LED and Regulator are removed.

    My Code:

    // Enable Debugging
    #define MY_DEBUG            //for MySensors connection problems
    #define PROG_DEBUG          //for code debugging
    
    // Enable and select radio type attached
    #define MY_RADIO_NRF24
    
    //MySensors Identification (necessary before MySensors.h)
    #define MY_NODE_ID 1
    
    #include <SPI.h>
    #include <MySensors.h>
    #include <Seeed_BME280.h>
    #include <Wire.h>
    
    BME280 bme280;
    
    //MySensors Sensors Identification
    #define CHILD_ID_HUM 0
    #define CHILD_ID_TEMP 1
    #define CHILD_ID_BARO 2
    #define CHILD_ID_VOLTAGE 254
    
    //For battery voltage measurement
    int BATTERY_SENSE_PIN = A0;       // select the input pin for the battery sense point
    //unsigned long SLEEP_TIME = 5*60000;   // sleep time between reads (seconds * 1000 milliseconds)
    unsigned long SLEEP_TIME = 10000;   // sleep time between reads (seconds * 1000 milliseconds)
    float VinMax = 3.23;          //VinMax calculated from VoltageDivider with 1,1V as referenz (A0);
    float VinMin = 2.6;           //VinMin is 1xCR2450 2.6V
    float VrefMulti = 0.0031543;       //calculated from VinMax/1023
    
    //R1 = 910000;      Voltage Divider R1
    //R2 = 470000;      Voltage Divider R2
    
    // Set this offset if the sensor has a permanent small offset to the real temperatures
    //#define SENSOR_TEMP_OFFSET 0
    
    bool metric = true;
    
    MyMessage msgHum(CHILD_ID_HUM, V_HUM);
    MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
    MyMessage msgBaro(CHILD_ID_BARO, V_PRESSURE);
    MyMessage msgVoltage(CHILD_ID_VOLTAGE, V_VOLTAGE);
    
    
    void presentation()  
    { 
      // Send the sketch version information to the gateway
      sendSketchInfo("BME280", "1.1");
    
      // Register all sensors to gw (they will be created as child devices)
      present(CHILD_ID_HUM, S_HUM);
      present(CHILD_ID_TEMP, S_TEMP);
      present(CHILD_ID_BARO, S_BARO);
      present(CHILD_ID_VOLTAGE, S_MULTIMETER);
    
      metric = getControllerConfig().isMetric;
    }
    
    
    void setup()
    {
      if(!bme280.init()){
        Serial.println("BME280 Could not be initialised!");
      }
      else {
        Serial.println("BME280 initialised!");
      }
      analogReference(INTERNAL);          // use the 1.1 V internal reference
        
    }
    
    
    void loop()      
    {  
      Serial.println("Waking up...");
      #ifdef PROG_DEBUG
        unsigned long StartTime = millis();
        Serial.println("------NEW READING------");
      #endif
    
      //calculate values
      int sensorValue = analogRead(BATTERY_SENSE_PIN);
      float batteryV  = sensorValue * VrefMulti;
      int Vref0 = (VinMin / VrefMulti);
      float VrefPcnt = (1023 - Vref0) / 100;
      int batteryPcnt = static_cast<int>(((batteryV-VinMin)/(VinMax-VinMin))*100);;
      //Send Battery Voltage
      send(msgVoltage.set(batteryV, 1));
    
      #ifdef PROG_DEBUG
        //Voltage-Stuff
        Serial.println("-----Voltage-Stuff-----");
        Serial.print("A0-Reading:        ");
        Serial.println(sensorValue);
        Serial.print("VinMax:            ");
        Serial.println(VinMax);
        Serial.print("VinMin:            ");
        Serial.println(VinMin);
        Serial.print("Vref0:             ");
        Serial.println(Vref0);
        Serial.print("VrefPcnt:          ");
        Serial.println(VrefPcnt);
        
        //Battery-Stuff
        Serial.print("Battery Voltage:   ");
        Serial.print(batteryV);
        Serial.println(" V");
    
        Serial.print("Battery percent1:  ");
        Serial.print(batteryPcnt);
        Serial.println(" %");
        Serial.println("-----------------------");
      #endif
        sendBatteryLevel(batteryPcnt);
        
          
      // Get temperature from BME280
      float temperature = bme280.getTemperature();
        send(msgTemp.set(temperature, 1));
      #ifdef PROG_DEBUG
        Serial.print("Temp:              ");
        Serial.print(temperature);
        Serial.println("C");
      #endif
      
      // Get humidity from BME280
      float humidity = bme280.getHumidity();
        send(msgHum.set(humidity, 1));
      #ifdef PROG_DEBUG
        Serial.print("Humidity:          ");
        Serial.print(humidity);
        Serial.println("%");
      #endif
      
      // Get pressure from BME280
      float pressure = (bme280.getPressure()/100);
      send(msgBaro.set(pressure, 1));
      #ifdef PROG_DEBUG
        Serial.print("Pressure:          ");
        Serial.print(pressure);
        Serial.println("hPa");
      #endif
      
      #ifdef PROG_DEBUG
        unsigned long CurrentTime = millis();
        unsigned long ElapsedTime = CurrentTime - StartTime;
        Serial.print("Looptime:          ");
        Serial.print(ElapsedTime);
        Serial.println("ms");
      #endif
    
      // Sleep for a while to save energy
      Serial.print("Going to sleep for (Seconds): ");
      Serial.println(SLEEP_TIME/1000);
      sleep(SLEEP_TIME); 
    }
    

    Thanks in advance.
    Tom


  • Hardware Contributor

    @DerManni - what happens when/if you unplug the sensor - same? If not, you have narrowed down the problem.

    How do you power the node?



  • @sundberg84
    I also unplugged the sensor, nothing happend to the power consumption in both states.

    The note is powered through an CP2102 USB 2.0 zu TTL UART on 3V3. Later I planned to power through an CR2450 coin cell.

    Unfortunately I cannot unplug the NRF-Module because it is soldered directly to the following shield. (https://oshpark.com/shared_projects/uXIff7XO)

    Could it be an faulty NRF-module?


  • Mod

    Try a longer sleep time then disconnect sensor like previously said and see the consumption, if it doesn't change unplug vcc of the radio module too.


Log in to reply
 

Looks like your connection to MySensors Forum was lost, please wait while we try to reconnect.