Lilygo Tsim doesn't start on their own?

Hi again, so I wanna know if somebody have encounter this problem, Im using a lilygo tsim7000g (works on a ESP32), and when reading conected to the pc is all good, but when I disconnect and turn on the device alone doesnt make any readings and I dont know why. Then I connect a powerbank to the port that I use with the pc and start doing the readings of gps, so I dont actually know if conecting or giving power in that port actives all, or If I need like active the lilygo to start working (the lilygo has also an adapt to add a battery and is already there) So i think that could be the problem, but I dont really know how to start that


//PMS
#include "BLINKER_PMSX003ST.h"

#define RX2 32  // To sensor TXD
#define TX2 33  // To sensor RXD

HardwareSerial pmsSerial(2);  // UART1/Serial1 pins 16,17

BLINKER_PMSX003ST pms;

//CO
#include "DFRobot_MICS.h"
float COO = 2;
#define Mics_I2C_ADDRESS 0x75
DFRobot_MICS_I2C mics(&Wire, Mics_I2C_ADDRESS);
#define ADC_PIN A0
#define POWER_PIN 10

//CO2
#include <DFRobot_ENS160.h>
#include "DFRobot_BME280.h"
#define SEA_LEVEL_PRESSURE 1015.0f
#define ADDRESS_1 0x53
#define ENS160_ADDRESS ADDRESS_1
#define ADDRESS_2 0x76
#define BME_ADDRESS ADDRESS_2
DFRobot_ENS160_I2C ENS160(&Wire, /*i2cAddr*/ ENS160_ADDRESS);
typedef DFRobot_BME280_IIC BME;  // ******** use abbreviations instead of full names ********
BME bme(&Wire, BME_ADDRESS);     // select TwoWire peripheral and set sensor address

// show last sensor operate status
void printLastOperateStatus(BME::eStatus_t eStatus) {
  switch (eStatus) {
    case BME::eStatusOK: Serial.println("everything ok"); break;
    case BME::eStatusErr: Serial.println("unknow error"); break;
    case BME::eStatusErrDeviceNotDetected: Serial.println("device not detected"); break;
    case BME::eStatusErrParameter: Serial.println("parameter error"); break;
    default: Serial.println("unknow status"); break;
  }
}

//O2
#include "DFRobot_OzoneSensor.h"
#define COLLECT_NUMBER 20
#define Ozone_IICAddress 0x73
DFRobot_OzoneSensor Ozone;

//pantalla sd
#include <SPI.h>
#include <SD.h>
#include <Arduino.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SH110X.h>
#define SD_CS 13
#define SPI_MOSI 15
#define SPI_MISO 2
#define SPI_SCK 14

#define i2c_Address 0x3C
#define SCREEN_WIDTH 128  // OLED display width, in pixels
#define SCREEN_HEIGHT 64  // OLED display height, in pixels
#define OLED_RESET -1     //   QT-PY / XIAO
Adafruit_SH1106G display = Adafruit_SH1106G(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
File carpeta;

//GPS

//Define Serial1 Name
#define SIM7000 Serial1

//Define GSM Model
#define TINY_GSM_MODEM_SIM7000

// See all AT commands, if wanted
#define DUMP_AT_COMMANDS


#include <TinyGsmClient.h>

#include <Ticker.h>

#ifdef DUMP_AT_COMMANDS
#include <StreamDebugger.h>
StreamDebugger debugger(SIM7000, Serial);
TinyGsm modem(debugger);
#else
TinyGsm modem(SIM7000);
#endif


#define UART_BAUD 9600
#define PIN_DTR 25
#define PIN_TX 27
#define PIN_RX 26
#define PWR_PIN 4
#define LED_PIN 12

//Variables
int gnss_run_status = 0;
int fix_status = 0;
int year = 0;
int month = 0;
int day = 0;
int hour = 0;
int minutes = 0;
float secondWithSS = 0;
float lat = 0;
float lon = 0;
float msl_alt = 0;
float speed_over_ground = 0;
float course_over_ground = 0;
bool reserved1 = 0;
int fix_mode = 0;
int hdop = 0;
int pdop = 0;
int vdop = 0;
bool reserved2 = 0;
int gnss_satellites_used = 0;
int gps_satellites_used = 0;
int glonass_satellites_used = 0;
bool reserved3 = 0;
int c_n0_max = 0;
float hpa = 0;
float vpa = 0;

void enableGPS(void) {
  // Set SIM7000G GPIO4 LOW ,turn on GPS power
  // CMD:AT+SGPIO=0,4,1,1
  // Only in version 20200415 is there a function to control GPS power
  modem.sendAT("+SGPIO=0,4,1,1");
  if (modem.waitResponse(10000L) != 1) {
    DBG(" SGPIO=0,4,1,1 false ");
  }
  modem.enableGPS();
}

void disableGPS(void) {
  // Set SIM7000G GPIO4 LOW ,turn off GPS power
  // CMD:AT+SGPIO=0,4,1,0
  // Only in version 20200415 is there a function to control GPS power
  modem.sendAT("+SGPIO=0,4,1,0");
  if (modem.waitResponse(10000L) != 1) {
    DBG(" SGPIO=0,4,1,0 false ");
  }
  modem.disableGPS();
}

void modemPowerOn() {
  pinMode(PWR_PIN, OUTPUT);
  digitalWrite(PWR_PIN, LOW);
  delay(1000);  //Datasheet Ton mintues = 1S
  digitalWrite(PWR_PIN, HIGH);
}

void modemPowerOff() {
  pinMode(PWR_PIN, OUTPUT);
  digitalWrite(PWR_PIN, LOW);
  delay(1500);  //Datasheet Ton mintues = 1.2S
  digitalWrite(PWR_PIN, HIGH);
}


void modemRestart() {
  modemPowerOff();
  delay(1000);
  modemPowerOn();
}

void setup() {

  //PMS
  Serial.begin(9600);
  Serial.println("\nStart");

  pmsSerial.begin(9600, SERIAL_8N1, RX2, TX2);
  pms.begin(pmsSerial);
  //pms.wakeUp();
  pms.setMode(ACTIVE);

  //CO
  while (!Serial)
    ;
  while (!mics.begin()) {
    Serial.println("NO Deivces !");
    delay(1000);
  }
  Serial.println("Device connected successfully !");
  uint8_t mode = mics.getPowerState();
  if (mode == SLEEP_MODE) {
    mics.wakeUpMode();
    Serial.println("wake up sensor success!");
  } else {
    Serial.println("The sensor is wake up mode");
  }
  delay(5000);

  //CO2
  bme.reset();
  Serial.println("bme read data test");
  while (bme.begin() != BME::eStatusOK) {
    Serial.println("bme begin faild");
    printLastOperateStatus(bme.lastOperateStatus);
    delay(2000);
  }
  Serial.println("bme begin success");
  delay(100);
  // Init the sensor
  while (NO_ERR != ENS160.begin()) {
    Serial.println("Communication with device failed, please check connection");
    delay(3000);
  }
  ENS160.setPWRMode(ENS160_STANDARD_MODE);
  ENS160.setTempAndHum(/*temperature=*/bme.getTemperature(), /*humidity=*/bme.getHumidity());
  delay(5000);

  //OZONO
  while (!Ozone.begin(Ozone_IICAddress)) {
    Serial.println("I2c device number error !");
    delay(1000);
  }
  Serial.println("I2c connect success !");
  Ozone.setModes(MEASURE_MODE_PASSIVE);
  delay(5000);

  //pantalla led
  SPI.begin(SPI_SCK, SPI_MISO, SPI_MOSI, SD_CS);

  Serial.println("starting");
  if (!SD.begin(SD_CS, SPI)) {
    Serial.println("Card Mount Failed");
    return;
  }
  uint8_t cardType = SD.cardType();
  if (cardType == CARD_NONE) {
    Serial.println("No SD card attached");
    return;
  }
  //card details
  uint64_t cardSize = SD.cardSize() / (1024 * 1024);
  Serial.printf("SD Card Size: %lluMB\n", cardSize);
  Serial.println("-----");

  delay(250);  // wait for the OLED to power up

  carpeta = SD.open("/test.txt", FILE_APPEND);
  if (carpeta) {
    carpeta.println("Hello worlIJ4!");
    carpeta.flush();
    carpeta.close();
  } else {
    Serial.println("error opening test.txt");
  }


  display.begin(i2c_Address, true);  // Address 0x3C default
                                     //display.setContrast (0); // dim display

  display.display();
  delay(2000);

  // Clear the buffer.
  display.clearDisplay();


  // text display tests
  display.setTextSize(1);
  display.setTextColor(SH110X_WHITE);
  display.setCursor(0, 0);
  display.println("Failure is NOT option");
  display.setTextColor(SH110X_BLACK, SH110X_WHITE);  // 'inverted' text
  display.println(3.141592);
  display.setTextSize(2);
  display.setTextColor(SH110X_WHITE);
  display.print("0x");
  display.println(0xDEADBEEF, HEX);
  display.display();
  delay(2000);
  display.clearDisplay();

  //GPS

  delay(10);

  modemPowerOn();

  SIM7000.begin(UART_BAUD, SERIAL_8N1, PIN_RX, PIN_TX);

  Serial.println("/**********************************************************/");
  Serial.println("To initialize the network test, please make sure your GPS");
  Serial.println("antenna has been connected to the GPS port on the board.");
  Serial.println("/**********************************************************/\n\n");

  delay(10000);

  if (!modem.testAT()) {
    Serial.println("Failed to restart modem, attempting to continue without restarting");
    modemRestart();
    return;
  }

  Serial.println("Start positioning . Make sure to locate outdoors.");
  Serial.println("The blue indicator light flashes to indicate positioning.");

  enableGPS();
}
void loop() {

  //PMS
  pms.request();
  delay(500);
  if (!pms.read()) {
    return;
  }


  float PMS1 = pms.getPmCf1(1.0);
  float PMS25 = pms.getPmCf1(2.5);
  float PMS10 = pms.getPmCf1(10);
  float forml = pms.getForm();
  float temper = pms.getTemp();
  float humid = pms.getHumi();

  delay(500);

  //GASES
  int16_t red_data = 0;

  red_data = mics.getADCData(RED_MODE);
  if (red_data > 3.4f) {
    COO = 0.0;
  } else if (red_data < 0.01) {
    COO = 1000.0;
  } else {
    COO = 4.2 / pow(red_data, 1.2);
  }

  delay(500);

  //CO2
  float temp = bme.getTemperature();
  uint32_t press = bme.getPressure();
  float alti = bme.calAltitude(SEA_LEVEL_PRESSURE, press);
  float humi = bme.getHumidity();

  uint8_t Status = ENS160.getENS160Status();
  Serial.print("Sensor operating status : ");
  Serial.println(Status);

  uint8_t AQI = ENS160.getAQI();
  Serial.print("Air quality index : ");
  Serial.println(AQI);


  uint16_t TVOC = ENS160.getTVOC();
  Serial.print("Concentration of total volatile organic compounds : ");
  Serial.print(TVOC);
  Serial.println(" ppb");

  uint16_t ECO2 = ENS160.getECO2();
  Serial.print("Carbon dioxide equivalent concentration : ");
  Serial.print(ECO2);
  Serial.println(" ppm");
  Serial.println();

  delay(500);

  //OZONO
  uint16_t ozoneConcentration = Ozone.readOzoneData(COLLECT_NUMBER);
  Serial.print("Ozone concentration is ");
  Serial.print(ozoneConcentration);
  Serial.println(" PPB.");
  delay(500);

  //GPS
  String gps_raw = modem.getGPSraw();

  if (gps_raw != "") {
    gnss_run_status = splitter(gps_raw, ',', 0).toInt();
    fix_status = splitter(gps_raw, ',', 1).toInt();
    String date = splitter(gps_raw, ',', 2);  //yyyyMMddhhmm ss.sss
    year = date.substring(0, 4).toInt();
    month = date.substring(4, 6).toInt();
    day = date.substring(6, 8).toInt();
    hour = date.substring(8, 10).toInt();
    minutes = date.substring(10, 12).toInt();
    secondWithSS = date.substring(12, 18).toFloat();
    lat = splitter(gps_raw, ',', 3).toFloat();                 //±dd.dddddd
    lon = splitter(gps_raw, ',', 4).toFloat();                 //±ddd.dddddd
    msl_alt = splitter(gps_raw, ',', 5).toFloat();             //meters
    speed_over_ground = splitter(gps_raw, ',', 6).toFloat();   //Km/hour
    course_over_ground = splitter(gps_raw, ',', 7).toFloat();  //degrees
    fix_mode = splitter(gps_raw, ',', 8).toInt();
    reserved1 = splitter(gps_raw, ',', 9).toInt();
    hdop = splitter(gps_raw, ',', 10).toInt();
    pdop = splitter(gps_raw, ',', 11).toInt();
    vdop = splitter(gps_raw, ',', 12).toInt();
    reserved2 = splitter(gps_raw, ',', 13).toInt();
    gnss_satellites_used = splitter(gps_raw, ',', 14).toInt();
    gps_satellites_used = splitter(gps_raw, ',', 15).toInt();
    glonass_satellites_used = splitter(gps_raw, ',', 16).toInt();
    reserved3 = splitter(gps_raw, ',', 17).toInt();
    c_n0_max = splitter(gps_raw, ',', 18).toInt();  //dBHz
    hpa = splitter(gps_raw, ',', 19).toFloat();     //meters
    vpa = splitter(gps_raw, ',', 20).toFloat();     //meters
  }
  delay(500);

  //pantalla led
  carpeta = SD.open("/test.txt", FILE_APPEND);
  if (carpeta) {
    carpeta.print(ozoneConcentration);
    carpeta.print(",");
    carpeta.print(TVOC);
    carpeta.print(",");
    carpeta.print(ECO2);
    carpeta.print(",");
    carpeta.print(COO);
    carpeta.print(",");
    carpeta.print(PMS1);
    carpeta.print(",");
    carpeta.print(PMS25);
    carpeta.print(",");
    carpeta.print(PMS10);
    carpeta.print(",");
    carpeta.print(forml);
    carpeta.print(",");
    carpeta.print(temp);
    carpeta.print(",");
    carpeta.print(humid);
    carpeta.print(",");
    carpeta.print(lat, 6);
    carpeta.print(",");
    carpeta.print(lon, 6);
    carpeta.print(",");
    carpeta.print(msl_alt, 6);
    carpeta.print(",");
    carpeta.print(year);
    carpeta.print(",");
    carpeta.print(month);
    carpeta.print(",");
    carpeta.print(day);
    carpeta.print(",");
    carpeta.print(hour);
    carpeta.print(",");
    carpeta.print(minutes);
    carpeta.print(",");
    carpeta.print(secondWithSS);
    carpeta.println(" ");
    delay(500);
    carpeta.flush();

    carpeta.close();
  } 
  else {
    Serial.println("error opening test.txt");
  }
  Serial.println(hour);
  Serial.println(minutes);
  Serial.println(secondWithSS);

  display.clearDisplay();

  display.setTextSize(2);
  display.setTextColor(SH110X_WHITE);
  display.setCursor(0, 0);
  // Display static text
  display.println(hour);
  display.println(minutes);
  display.println(secondWithSS);
  display.display();

}

String splitter(String data, char separator, int index) {
  int stringData = 0;
  String dataPart = "";

  for (int i = 0; i < data.length(); i++) {

    if (data[i] == separator) {

      stringData++;
    } else if (stringData == index) {

      dataPart.concat(data[i]);
    } else if (stringData > index) {

      return dataPart;
      break;
    }
  }

  return dataPart;
}

When You "disconnect" where does the power come from?

From a batery in the back, but to really start it i need to conect a powerbank in the USB port, so i don't know if there is a command like to turn on the lilygo on their own

What battery? Connected to what pin?
Please post schematics and stop posting words.