Arduino Nano doesn't consume enough power to keep portable power bank on.

wolframore:
Does it stay on if you leave the LED on and not blinking?

If it doesn’t work maybe you need 2 LED and raise the current to 50 mA

Worse comes to worse plug it into USB and put the switch on the cable.

Ya i had it with the led continuously on and it still didn't work. But everything is good if i supply the power into the 5V pin, it stays on indefinitely.

And ya, i'll probably go with making a switch in the usb cable, because as you saw in another thread, i get better sound that way (unless i upgrade to a 8ohm speaker)

@groundFungus and OP

I have now successfully tested using USB pwr supplies. For my needs I used a 200 Ohm resistor connected between Vcc, +5V, on the UNO and D3.
Pulsing D3 low makes the board consume enough current to ceep the board running. I tested 2 different pwr packs. Even the most sencitive pwr pack works well at a duty cycle of 1%. I attach my code below.
Lock at setup and the very beginning of loop().

#include<arduino.h>
#include <SMT172.h>

//I2C for LCD
//boolean debug = false;

#include <SoftwareSerial.h>

#include <Wire.h>
#include <hd44780.h>
#include <hd44780ioClass/hd44780_I2Cexp.h>

//#define BACKLIGHT_PIN     13

hd44780_I2Cexp mylcd; // declare lcd object: auto locate & config exapander chip

// LCD geometry
#define LCD_COLS 16
#define LCD_ROWS 2

// The TinyGPS++ object

uint32_t LastSensorUpdate;
unsigned long sec_1_diff_measure_time;
unsigned long sec_10_diff_measure_time;
unsigned long minute_1_diff_measure_time;
unsigned long minute_10_diff_measure_time;
float sec_1_diff_measure_data = -1.1;
float sec_10_diff_measure_data = -1.1;
float minute_1_diff_measure_data = -1.1;
float minute_10_diff_measure_data = -1.1;


//The setup function is called once at startup of the sketch
void setup() {
  unsigned long tmp_millis;
  pinMode(8, INPUT_PULLUP);
  pinMode(12, OUTPUT);
  pinMode(3, OUTPUT);
  digitalWrite(3, LOW);
  Serial.begin(115200);
  Serial.println(F("Demo sketch SMT172"));

  //	The following code fragment sets up phase-correct PWM on pins 3 and 11 (Timer 2).
  //	The waveform generation mode bits WGM are set to to 001 for phase-correct PWM.
  //	The other bits are the same as for fast PWM.

  //  pinMode(3, OUTPUT);
  //  pinMode(11, OUTPUT);
  TCCR2A = _BV(COM2A1) | _BV(COM2B1) | _BV(WGM20);
  // TCCR2B = _BV(CS22); // Output frequency: 16 MHz / 64 / 255 / 2 =  490.196 Hz
  TCCR2B = _BV(CS21); // Output frequency: 16 MHz /  8 / 255 / 2 = 3921.569 Hz
  OCR2A = 237; // Output A duty cycle: 237 / 255 = 92.94%	= 129.58 C	on pin 11
  OCR2B = 28;	 // Output B duty cycle:  28 / 255 = 10.98%	= -45.06 C	on pin 3

  //Send temp via I2C to LCD
  int status;

  status = mylcd.begin(LCD_COLS, LCD_ROWS);
  if (status) // non zero status means it was unsuccesful
  {
    status = -status; // convert negative status value to positive number

    // begin() failed so blink error code using the onboard LED if possible
    hd44780::fatalError(status); // does not return
  }
  mylcd.clear();
  // initalization was successful, the backlight should be on now

  // Print start message to the LCD
  mylcd.print("Started");
  sec_1_diff_measure_time = tmp_millis + 1000;
  sec_10_diff_measure_time =    tmp_millis + 10000;
  minute_1_diff_measure_time =  tmp_millis + 60000;
  minute_10_diff_measure_time = tmp_millis + 600000;
  //  mylcd.setCursor(12, 2); mylcd.print(minute_1_diff_measure_time / 1000);
}

// The loop function is called in an endless loop
void loop()
{
  float tmp_temp;
  unsigned long mill_tmp;
  if ((millis() % 100) > 98)
    digitalWrite(3, LOW);
  else
    digitalWrite(3, HIGH);

  // read the sensor every 250 millisecond
  if ((unsigned long) (millis() - LastSensorUpdate) >= 500)
  {
    LastSensorUpdate = millis();

    SMT172::startTemperature(0.002);

repeat:
    switch (SMT172::getStatus()) {
      case 0: goto repeat; // O Dijkstra, be merciful onto me, for I have sinned against you :)
      case 1:
        //		    Serial.print(F("Measuring time   [ms]: "));
        //				Serial.println(SMT172::getTime() * 1e3, 2); // convert to milliseconds
        //				Serial.print(F("Sensor frequency [Hz]: "));
        //				Serial.println(SMT172::getFrequency(), 2);
        //				Serial.print(F("Duty cycle        [%]: "));
        //				Serial.println(SMT172::getDutyCycle() * 100, 2);

        tmp_temp = SMT172::getTemperature();
        mill_tmp = millis();

        //        Serial.print(F("Temperature       [C]: "));
        //        Serial.println(tmp_temp, 2);

        mylcd.setCursor(0, 0);
        mylcd.print(tmp_temp, 2);
        //        mylcd.print(F(" [C]"));
        mylcd.print(" [C]");

        /*        if (tmp_temp > 30.0 )
                {
                  Serial.println(tmp_temp);
                  mylcd.setCursor(0, 0);
                  mylcd.print(F("Err. [C]: "));
                  mylcd.print(tmp_temp, 4);
                }
        */
        if (sec_1_diff_measure_data < 0.0)//Initiate
        {
          sec_1_diff_measure_data = tmp_temp;
          sec_10_diff_measure_data = tmp_temp;
          minute_1_diff_measure_data = tmp_temp;
          minute_10_diff_measure_data = tmp_temp;
          sec_1_diff_measure_time = mill_tmp + 1000;
          sec_10_diff_measure_time = mill_tmp + 10000;
          minute_1_diff_measure_time = mill_tmp + 60000;
          minute_10_diff_measure_time = mill_tmp + 600000;
        }
        else
        {
          if (mill_tmp > sec_1_diff_measure_time )
          {
            //        Serial.print("1  Sec value "); Serial.print(tmp_temp);Serial .print(" ");Serial.println(mill_tmp/1000);
            sec_1_diff_measure_time = mill_tmp + 1 * 1000;//Set next measure time
            mylcd.setCursor(10, 0); mylcd.print("      ");
            mylcd.setCursor(10, 0); mylcd.print(tmp_temp - sec_1_diff_measure_data, 2); // mylcd.print(" ");
            sec_1_diff_measure_data = tmp_temp;
          }

          if (mill_tmp > sec_10_diff_measure_time )
          {
            Serial.print("10 Sec value "); Serial.print(tmp_temp); Serial .print(" "); Serial.println(mill_tmp / 1000);
            sec_10_diff_measure_time = mill_tmp + 10 * 1000;//Set next measure time
            mylcd.setCursor(0, 1); mylcd.print("      ");
            mylcd.setCursor(0, 1); mylcd.print(tmp_temp - sec_10_diff_measure_data, 2);// mylcd.print(" ");
            sec_10_diff_measure_data = tmp_temp;
          }
          if (mill_tmp > minute_1_diff_measure_time )
          {
            Serial.print("1  Min value "); Serial.print(tmp_temp); Serial .print(" "); Serial.println(mill_tmp / 1000);
            minute_1_diff_measure_time = mill_tmp + 60000;//Set next measure time
            mylcd.setCursor(6, 1);  mylcd.print("      ");
            mylcd.setCursor(6, 1); mylcd.print(tmp_temp - minute_1_diff_measure_data, 2);// mylcd.print(" ");
            minute_1_diff_measure_data = tmp_temp;
          }
          if (mill_tmp > minute_10_diff_measure_time )
          {
            Serial.print("10 Min value "); Serial.print(tmp_temp); Serial .print(" "); Serial.println(mill_tmp / 1000);
            minute_10_diff_measure_time = mill_tmp + 600000;//Set next measure time
            mylcd.setCursor(12, 1);  mylcd.print("    ");
            mylcd.setCursor(12, 1); mylcd.print(tmp_temp - minute_10_diff_measure_data, 1);// mylcd.print(" ");
            minute_10_diff_measure_data = tmp_temp;
          }
        }
        //        mylcd.setCursor(0, 3); mylcd.print(mill_tmp / 1000); mylcd.print(" "); mylcd.print(minute_1_diff_measure_time / 1000);
        //        mylcd.setCursor(16, 3); mylcd.print(mill_tmp / 1000);

        //				Serial.print(F("Error            [mK]: "));
        //				Serial.println(SMT172::getError() * 1000, 2);
        //				Serial.println();
        break;
      case 2: Serial.println(F("**** Sensor disconnected ****"));
        Serial.println();
    }
//    delay(500);
  }
}

A report from my power wasting tests.
2 fully charged USB Power packs are used. In the beginning of the test it was enough to activate the 190 Ohm load at a dutycycle of 1%. After some 20 - 30 minutes the UNO died. The dutycycle was increased one more percent but the same happened. Now I am testing a 25% dutycycle to see if it will work down to a really discharged PP.

190ohm is less than 26mA when switched with a pin (that has some internal resistance).

You might have to increase the current instead of the time.
Maybe with a second resistor on a second pin.

What is the interval. Four seconds sounds about right for a powerbank that stays on 10seconds (= 2 hits).
Leo..

I've heard of some banks requiring a pulse every 2 seconds. Try different intervals.

Thanks for the tip. I can guess that different packs use different types of sencing. There is probably a difference between a high frequency running dutycycle and a low frequency one. Probably the current needs to be higher at lower freqs. My guess. Higher current might cause disturbance, noice I think.
Using high frequency but low load ought to be less noicy, but I might be wrong.
Are You there @groundFungus?

Here is my test, in the beginning of loop(), and the temperature crap.

#include<arduino.h>
#include <SMT172.h>

//I2C for LCD
//boolean debug = false;

#include <SoftwareSerial.h>

#include <Wire.h>
#include <hd44780.h>
#include <hd44780ioClass/hd44780_I2Cexp.h>

//#define BACKLIGHT_PIN     13

hd44780_I2Cexp mylcd; // declare lcd object: auto locate & config exapander chip

// LCD geometry
#define LCD_COLS 16
#define LCD_ROWS 2

// The TinyGPS++ object

uint32_t LastSensorUpdate;
unsigned long sec_1_diff_measure_time;
unsigned long sec_10_diff_measure_time;
unsigned long minute_1_diff_measure_time;
unsigned long minute_10_diff_measure_time;
float sec_1_diff_measure_data = -1.1;
float sec_10_diff_measure_data = -1.1;
float minute_1_diff_measure_data = -1.1;
float minute_10_diff_measure_data = -1.1;


//The setup function is called once at startup of the sketch
void setup() {
  unsigned long tmp_millis;
  pinMode(8, INPUT_PULLUP);
  pinMode(12, OUTPUT);
  pinMode(3, OUTPUT);
  digitalWrite(3, LOW);
  Serial.begin(115200);
  Serial.println(F("Demo sketch SMT172"));

  //	The following code fragment sets up phase-correct PWM on pins 3 and 11 (Timer 2).
  //	The waveform generation mode bits WGM are set to to 001 for phase-correct PWM.
  //	The other bits are the same as for fast PWM.

  //  pinMode(3, OUTPUT);
  //  pinMode(11, OUTPUT);
  TCCR2A = _BV(COM2A1) | _BV(COM2B1) | _BV(WGM20);
  // TCCR2B = _BV(CS22); // Output frequency: 16 MHz / 64 / 255 / 2 =  490.196 Hz
  TCCR2B = _BV(CS21); // Output frequency: 16 MHz /  8 / 255 / 2 = 3921.569 Hz
  OCR2A = 237; // Output A duty cycle: 237 / 255 = 92.94%	= 129.58 C	on pin 11
  OCR2B = 28;	 // Output B duty cycle:  28 / 255 = 10.98%	= -45.06 C	on pin 3

  //Send temp via I2C to LCD
  int status;

  status = mylcd.begin(LCD_COLS, LCD_ROWS);
  if (status) // non zero status means it was unsuccesful
  {
    status = -status; // convert negative status value to positive number

    // begin() failed so blink error code using the onboard LED if possible
    hd44780::fatalError(status); // does not return
  }
  mylcd.clear();
  // initalization was successful, the backlight should be on now

  // Print start message to the LCD
  mylcd.print("Started");
  sec_1_diff_measure_time = tmp_millis + 1000;
  sec_10_diff_measure_time =    tmp_millis + 10000;
  minute_1_diff_measure_time =  tmp_millis + 60000;
  minute_10_diff_measure_time = tmp_millis + 600000;
  //  mylcd.setCursor(12, 2); mylcd.print(minute_1_diff_measure_time / 1000);
}

// The loop function is called in an endless loop
void loop()
{
  float tmp_temp;
  unsigned long mill_tmp;
  if ((millis() % 100) > 75)
    digitalWrite(3, LOW);
  else
    digitalWrite(3, HIGH);

  // read the sensor every 250 millisecond
  if ((unsigned long) (millis() - LastSensorUpdate) >= 500)
  {
    LastSensorUpdate = millis();

    SMT172::startTemperature(0.002);

repeat:
    switch (SMT172::getStatus()) {
      case 0: goto repeat; // O Dijkstra, be merciful onto me, for I have sinned against you :)
      case 1:
        //		    Serial.print(F("Measuring time   [ms]: "));
        //				Serial.println(SMT172::getTime() * 1e3, 2); // convert to milliseconds
        //				Serial.print(F("Sensor frequency [Hz]: "));
        //				Serial.println(SMT172::getFrequency(), 2);
        //				Serial.print(F("Duty cycle        [%]: "));
        //				Serial.println(SMT172::getDutyCycle() * 100, 2);

        tmp_temp = SMT172::getTemperature();
        mill_tmp = millis();

        //        Serial.print(F("Temperature       [C]: "));
        //        Serial.println(tmp_temp, 2);

        mylcd.setCursor(0, 0);
        mylcd.print(tmp_temp, 2);
        //        mylcd.print(F(" [C]"));
        mylcd.print(" [C]");

        /*        if (tmp_temp > 30.0 )
                {
                  Serial.println(tmp_temp);
                  mylcd.setCursor(0, 0);
                  mylcd.print(F("Err. [C]: "));
                  mylcd.print(tmp_temp, 4);
                }
        */
        if (sec_1_diff_measure_data < 0.0)//Initiate
        {
          sec_1_diff_measure_data = tmp_temp;
          sec_10_diff_measure_data = tmp_temp;
          minute_1_diff_measure_data = tmp_temp;
          minute_10_diff_measure_data = tmp_temp;
          sec_1_diff_measure_time = mill_tmp + 1000;
          sec_10_diff_measure_time = mill_tmp + 10000;
          minute_1_diff_measure_time = mill_tmp + 60000;
          minute_10_diff_measure_time = mill_tmp + 600000;
        }
        else
        {
          if (mill_tmp > sec_1_diff_measure_time )
          {
            //        Serial.print("1  Sec value "); Serial.print(tmp_temp);Serial .print(" ");Serial.println(mill_tmp/1000);
            sec_1_diff_measure_time = mill_tmp + 1 * 1000;//Set next measure time
            mylcd.setCursor(10, 0); mylcd.print("      ");
            mylcd.setCursor(10, 0); mylcd.print(tmp_temp - sec_1_diff_measure_data, 2); // mylcd.print(" ");
            sec_1_diff_measure_data = tmp_temp;
          }

          if (mill_tmp > sec_10_diff_measure_time )
          {
            Serial.print("10 Sec value "); Serial.print(tmp_temp); Serial .print(" "); Serial.println(mill_tmp / 1000);
            sec_10_diff_measure_time = mill_tmp + 10 * 1000;//Set next measure time
            mylcd.setCursor(0, 1); mylcd.print("      ");
            mylcd.setCursor(0, 1); mylcd.print(tmp_temp - sec_10_diff_measure_data, 2);// mylcd.print(" ");
            sec_10_diff_measure_data = tmp_temp;
          }
          if (mill_tmp > minute_1_diff_measure_time )
          {
            Serial.print("1  Min value "); Serial.print(tmp_temp); Serial .print(" "); Serial.println(mill_tmp / 1000);
            minute_1_diff_measure_time = mill_tmp + 60000;//Set next measure time
            mylcd.setCursor(6, 1);  mylcd.print("      ");
            mylcd.setCursor(6, 1); mylcd.print(tmp_temp - minute_1_diff_measure_data, 2);// mylcd.print(" ");
            minute_1_diff_measure_data = tmp_temp;
          }
          if (mill_tmp > minute_10_diff_measure_time )
          {
            Serial.print("10 Min value "); Serial.print(tmp_temp); Serial .print(" "); Serial.println(mill_tmp / 1000);
            minute_10_diff_measure_time = mill_tmp + 600000;//Set next measure time
            mylcd.setCursor(12, 1);  mylcd.print("    ");
            mylcd.setCursor(12, 1); mylcd.print(tmp_temp - minute_10_diff_measure_data, 1);// mylcd.print(" ");
            minute_10_diff_measure_data = tmp_temp;
          }
        }
        //        mylcd.setCursor(0, 3); mylcd.print(mill_tmp / 1000); mylcd.print(" "); mylcd.print(minute_1_diff_measure_time / 1000);
        //        mylcd.setCursor(16, 3); mylcd.print(mill_tmp / 1000);

        //				Serial.print(F("Error            [mK]: "));
        //				Serial.println(SMT172::getError() * 1000, 2);
        //				Serial.println();
        break;
      case 2: Serial.println(F("**** Sensor disconnected ****"));
        Serial.println();
    }
//    delay(500);
  }
}

@Wawa. Sorry, I missed Your tip in my previous post. It would be interesting to get knowledge about the strategies used by Power pack manufactorers. Anybody having knowledge?

My strategy was to find the current that would keep the power bank on with a steady draw and then how long that current had to be drawn to keep the power bank on. The current level on on time were derived experimentally (or, more simply, trial and error).

@gF. Note my remark about the change when starting from a fully charged pack and what happened some 20 - 30 minutes later. My 190 Ohms comes from a calculation of how much more current my other application uses and it works for hours. I agree to Your idea but what do You say about an eventual change due to PP being slightly discharged? Maybe that affects the Vcc on the UNO board and then the current drawn by this extra circuitry gets lower. What do You say?

I will admit that my testing was not that thorough. I just needed a portable and rechargeable 5V power pack for a project. I found the current and time and just used those numbers with a bit of safety factor. I don't know the discharge characteristics of the power pack. I would think that the output voltage would be pretty steady until the pack is pretty discharged. And if the circuit current drops I hope my safety factor would be enough.

We are all trying the same, breaking new grounds. I also think that current is the important factor. As long as long time battory Life is not the most important Life is easier. Modelling this extra consumtion in a way like increasing the dutycycle according to running time could work, but how to tune it in?
Using different dutycycles and measuring the time until cut off might give something. Only that it will take a h-ll lot of time. Measuring/integrating current/time and comparing to the data of the pp could work. It calls for a current sensor and more code….

Don't make it too complicated.
My WeMos D1 mini runs ~36hours on a powerbank (5Ah on the case), without doing anything.
The Wemos draws ~80mA with occasional short ~300mA? peaks.

If you want a battery to last for a long time, then don't use an Uno or a powerbank.
Leo..

My UNO clone and its 2 * 16 LCD has now been running for more than 24 hours on a 5 or 6Ah pack using the code attached earlier! That is a lot more than I need for my overheat gard on the spindle motor of my micro mill. Thanks for the tip! Using USB stuff is convienent. I have plenty of chargers.

woot woot

A report of the status that probably is the final solution for me. Pulsing at a rate of 100Hz drawing 5/270 Amps, 18.5 mA, makes the power bank supply power until being realy close to empty. Look at the very beginning of loop().

#include<arduino.h>
#include <SMT172.h>

//I2C for LCD
//boolean debug = false;

//#include <SoftwareSerial.h>

#include <Wire.h>
#include <hd44780.h>
#include <hd44780ioClass/hd44780_I2Cexp.h>

//#define BACKLIGHT_PIN     13

hd44780_I2Cexp mylcd; // declare lcd object: auto locate & config exapander chip

// LCD geometry
#define LCD_COLS 16
#define LCD_ROWS 2

// The TinyGPS++ object

uint32_t LastSensorUpdate;
unsigned long sec_1_diff_measure_time;
unsigned long sec_10_diff_measure_time;
unsigned long minute_1_diff_measure_time;
unsigned long minute_10_diff_measure_time;
float sec_1_diff_measure_data = -1.1;
float sec_10_diff_measure_data = -1.1;
float minute_1_diff_measure_data = -1.1;
float minute_10_diff_measure_data = -1.1;

//The setup function is called once at startup of the sketch
void setup() {
  //  unsigned long tmp_millis = 0L;
  pinMode(8, INPUT_PULLUP);
  pinMode(12, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(6, OUTPUT);//+5 to measuring UNO
  
  digitalWrite(3, LOW);
  digitalWrite(4, LOW);
  digitalWrite(5, LOW);
  digitalWrite(6, HIGH);//+5 to measuring UNO
  Serial.begin(115200);
  Serial.println(F("Temperature sketch SMT172"));

  //	The following code fragment sets up phase-correct PWM on pins 3 and 11 (Timer 2).
  //	The waveform generation mode bits WGM are set to to 001 for phase-correct PWM.
  //	The other bits are the same as for fast PWM.

  //  pinMode(3, OUTPUT);
  //  pinMode(11, OUTPUT);
  TCCR2A = _BV(COM2A1) | _BV(COM2B1) | _BV(WGM20);
  // TCCR2B = _BV(CS22); // Output frequency: 16 MHz / 64 / 255 / 2 =  490.196 Hz
  TCCR2B = _BV(CS21); // Output frequency: 16 MHz /  8 / 255 / 2 = 3921.569 Hz
  OCR2A = 237; // Output A duty cycle: 237 / 255 = 92.94%	= 129.58 C	on pin 11
  OCR2B = 28;	 // Output B duty cycle:  28 / 255 = 10.98%	= -45.06 C	on pin 3

  //Send temp via I2C to LCD
  int status;

  status = mylcd.begin(LCD_COLS, LCD_ROWS);
  if (status) // non zero status means it was unsuccesful
  {
    status = -status; // convert negative status value to positive number

    // begin() failed so blink error code using the onboard LED if possible
    hd44780::fatalError(status); // does not return
  }
  mylcd.clear();
  // initalization was successful, the backlight should be on now

  // Print start message to the LCD
  mylcd.print("Started");
  sec_1_diff_measure_time = /*tmp_millis + */1000;
  sec_10_diff_measure_time =    /*tmp_millis + */10000;
  minute_1_diff_measure_time =  /*tmp_millis + */60000;
  minute_10_diff_measure_time = /*tmp_millis + */600000;
}

// The loop function is called in an endless loop
void loop()
{
  float tmp_temp;
  unsigned long mill_tmp;
  if ((millis() % 10) > 8)//75% > 1/4
  {//waist 5/270 Amp = 18.5 mA
    digitalWrite(3, LOW);
//    digitalWrite(4, LOW);
//    digitalWrite(5, LOW);
  }
  else
  {
    digitalWrite(3, HIGH);
//    digitalWrite(4, HIGH);
//    digitalWrite(5, HIGH);
  }
  // read the sensor every 250 millisecond
  if ((unsigned long) (millis() - LastSensorUpdate) >= 500)
  {
    LastSensorUpdate = millis();

    SMT172::startTemperature(0.002);

repeat:
    switch (SMT172::getStatus()) {
      case 0: goto repeat; // O Dijkstra, be merciful onto me, for I have sinned against you :)
      case 1:
        //		    Serial.print(F("Measuring time   [ms]: "));
        //				Serial.println(SMT172::getTime() * 1e3, 2); // convert to milliseconds
        //				Serial.print(F("Sensor frequency [Hz]: "));
        //				Serial.println(SMT172::getFrequency(), 2);
        //				Serial.print(F("Duty cycle        [%]: "));
        //				Serial.println(SMT172::getDutyCycle() * 100, 2);

        tmp_temp = SMT172::getTemperature();
        mill_tmp = millis();

        //        Serial.print(F("Temperature       [C]: "));
        //        Serial.println(tmp_temp, 2);

        mylcd.setCursor(0, 0);
        mylcd.print(tmp_temp, 2);
        //        mylcd.print(F(" [C]"));
        mylcd.print(" [C]");

        /*        if (tmp_temp > 30.0 )
                {
                  Serial.println(tmp_temp);
                  mylcd.setCursor(0, 0);
                  mylcd.print(F("Err. [C]: "));
                  mylcd.print(tmp_temp, 4);
                }
        */
        if (sec_1_diff_measure_data < 0.0)//Initiate
        {
          sec_1_diff_measure_data = tmp_temp;
          sec_10_diff_measure_data = tmp_temp;
          minute_1_diff_measure_data = tmp_temp;
          minute_10_diff_measure_data = tmp_temp;
          sec_1_diff_measure_time = mill_tmp + 1000;
          sec_10_diff_measure_time = mill_tmp + 10000;
          minute_1_diff_measure_time = mill_tmp + 60000;
          minute_10_diff_measure_time = mill_tmp + 600000;
        }
        else
        {
          if (mill_tmp > sec_1_diff_measure_time )
          {
            //        Serial.print("1  Sec value "); Serial.print(tmp_temp);Serial .print(" ");Serial.println(mill_tmp/1000);
            sec_1_diff_measure_time = mill_tmp + 1 * 1000;//Set next measure time
            mylcd.setCursor(10, 0); mylcd.print("      ");
            mylcd.setCursor(10, 0); mylcd.print(tmp_temp - sec_1_diff_measure_data, 2); // mylcd.print(" ");
            sec_1_diff_measure_data = tmp_temp;
          }

          if (mill_tmp > sec_10_diff_measure_time )
          {
            Serial.print("10 Sec value "); Serial.print(tmp_temp); Serial .print(" "); Serial.println(mill_tmp / 1000);
            sec_10_diff_measure_time = mill_tmp + 10 * 1000;//Set next measure time
            mylcd.setCursor(0, 1); mylcd.print("      ");
            mylcd.setCursor(0, 1); mylcd.print(tmp_temp - sec_10_diff_measure_data, 2);// mylcd.print(" ");
            sec_10_diff_measure_data = tmp_temp;
          }
          if (mill_tmp > minute_1_diff_measure_time )
          {
            Serial.print("1  Min value "); Serial.print(tmp_temp); Serial .print(" "); Serial.println(mill_tmp / 1000);
            minute_1_diff_measure_time = mill_tmp + 60000;//Set next measure time
            mylcd.setCursor(6, 1);  mylcd.print("      ");
            mylcd.setCursor(6, 1); mylcd.print(tmp_temp - minute_1_diff_measure_data, 2);// mylcd.print(" ");
            minute_1_diff_measure_data = tmp_temp;
          }
          if (mill_tmp > minute_10_diff_measure_time )
          {
            Serial.print("10 Min value "); Serial.print(tmp_temp); Serial .print(" "); Serial.println(mill_tmp / 1000);
            minute_10_diff_measure_time = mill_tmp + 600000;//Set next measure time
            mylcd.setCursor(12, 1);  mylcd.print("    ");
            mylcd.setCursor(12, 1); mylcd.print(tmp_temp - minute_10_diff_measure_data, 1);// mylcd.print(" ");
            minute_10_diff_measure_data = tmp_temp;
          }
        }
        //        mylcd.setCursor(0, 3); mylcd.print(mill_tmp / 1000); mylcd.print(" "); mylcd.print(minute_1_diff_measure_time / 1000);
        //        mylcd.setCursor(16, 3); mylcd.print(mill_tmp / 1000);

        //				Serial.print(F("Error            [mK]: "));
        //				Serial.println(SMT172::getError() * 1000, 2);
        //				Serial.println();
        break;
      case 2: Serial.println(F("**** Sensor disconnected ****"));
        Serial.println();
    }
    //    delay(500);
  }
}

There is incidentally already a fair amount of knowledge and research here on the topic of "power bank auto shutdown"