TTGO ESP32 LoRa-SX1276 SIM800 stopped working SOLVED!

Hey guys,

I was working on project to keep tracking few long distance location temperature, that's why i needed (Lora+nano+temp sensor) for slave module. And also there's master(TTGO+SIM800+LoRa)
LoRa is working on SPI, here are the pins used for LoRa:

#define ss 15
#define rst 12
#define dio0 2

void setup()
{
    LoRa.setPins(ss, rst, dio0); // set CS, reset, IRQ pin
}

TTGO are getting temperatures from other modules through LoRa and if temperature rises SIM800 sends me a message with temperature.

But i had a problem then i was trying to initialize lora, SIM800 instantly stops working. Hard for me to figure it out.

I figured out another way, how to work around system in simplier way(4 days of research by my self...) and get keep working.
In my case modem in TTGO stops working then lora initializes begin function.
So i thought why not just disable Lora somehow, send a message and enable LoRa again.

For example i'm using this https://randomnerdtutorials.com/ttgo-lora32-sx1276-arduino-ide/

So firstly i putted this code part into function:

void initModem() {
  // Set modem reset, enable, power pins
  pinMode(MODEM_PWKEY, OUTPUT);
  pinMode(MODEM_RST, OUTPUT);
  pinMode(MODEM_POWER_ON, OUTPUT);
  digitalWrite(MODEM_PWKEY, LOW);
  digitalWrite(MODEM_RST, HIGH);
  digitalWrite(MODEM_POWER_ON, HIGH);

  // Set GSM module baud rate and UART pins
  SerialAT.begin(115200, SERIAL_8N1, MODEM_RX, MODEM_TX);
  delay(3000);

  // Restart SIM800 module, it takes quite some time
  // To skip it, call init() instead of restart()
  SerialMon.println("Initializing modem...");
  modem.restart();
  // use modem.init() if you don't need the complete restart

  // Unlock your SIM card with a PIN if needed
  if (strlen(simPIN) && modem.getSimStatus() != 3 ) {
    modem.simUnlock(simPIN);
  }
}

And another one part with lora begin:

void loraBegin() {
  if (!LoRa.begin(433E6)) {
    SerialMon.println("Starting LoRa failed!");
  } else {
    LoRa.setSyncWord(0xF3);
    SerialMon.println("LoRa init succeeded.");
  }
}

Then i want to send a message i'm doing this:

  LoRa.end(); // It switches off SPI communication between LoRa and ESP32
  initModem(); // Turning modem on, with function
  if (modem.sendSMS(SMS_TARGET, text)) {
    SerialMon.println(text);
  }
  else {
    SerialMon.println("SMS failed to send");
  }
  loraBegin(); //Starting LoRa Again

That's it, hope it will help for somebody.
Maybe this is stupid way to do this but for me it's working :slight_smile:

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.