1

I am trying to do a small project with SIM800L with Wemos d1 mini. It is a DTMF based project. The problem here is, every time I make a call the d1 mini is getting reset. This is my first project with d1 mini. For the past few days I have googled, trying to find a solution. But I failed. I will be very grateful if you can provide the solution.

I am getting these errors in the serial monitor:

 ets Jan  8 2013,rst cause:4, boot mode:(3,7)

wdt reset load 0x4010f000, len 3460, room 16 tail 4 chksum 0xcc load 0x3fff20b8, len 40, room 4 tail 4 chksum 0xc9 csum 0xc9 v00043b40 ~ld

I am using Arduino IDE. Version: 1.8.8

Here is my project code.

#include <SoftwareSerial.h>

#define rxPin D3 #define txPin D4 SoftwareSerial sim800L(rxPin, txPin);

#define RELAY_1 D7 #define RELAY_2 D8 boolean relay1_state = false; boolean relay2_state = false;

//stores incomming data from sim800l String buff; String dtmf_cmd; boolean is_call = false; String ownerNumber = "xxxxxxxxxxxxxxx";

void setup() { pinMode(RELAY_1, OUTPUT); pinMode(RELAY_2, OUTPUT);

//Begin serial communication with (Serial Monitor) Serial.begin(115200);

//Begin serial communication with (SIM800L) sim800L.begin(9600); Serial.println("Begin serial communication with (SIM800L)"); delay(500);

sim800L.println("AT"); //send AT delay(500);

sim800L.println("AT+DDET=1"); //Enable DTMF delay(500);

sim800L.println("AT+CLIP=1"); // Enable CallerID delay(500); }

void loop() { while (sim800L.available()) { buff = sim800L.readString(); Serial.println("Raw: " + buff);

if (is_call == true) {
  if (int index = buff.indexOf(&quot;+DTMF:&quot;) &gt; -1 ) {
    index = buff.indexOf(&quot;:&quot;);
    dtmf_cmd = buff.substring(index + 1, buff.length());
    dtmf_cmd.trim();
    Serial.println(&quot;dtmf_cmd: &quot; + dtmf_cmd);
    doAction();
  }
  if (buff.indexOf(&quot;NO CARRIER&quot;) &gt; -1) {
    sim800L.println(&quot;ATH&quot;);
    is_call = false;
  }
}
if (buff.indexOf(&quot;RING&quot;) &gt; -1) {

  // Now check the caller number
  if (buff.indexOf(&quot;+CLIP:&quot;)) {
    unsigned int index, index1;

    index = buff.indexOf(&quot;\&quot;&quot;);
    index1 = buff.indexOf(&quot;\&quot;&quot;, index + 1);

    String temp = buff.substring(index + 2, index1);
    temp.trim();

    if (ownerNumber == &quot;+&quot; + temp) {
      Serial.println(&quot;Number matched&quot;);
      delay(2000);
      sim800L.println(&quot;ATA&quot;);
      is_call = true;
    } else {
      Serial.println(&quot;Number not matched&quot;);
    }
  }
}

}

while (Serial.available()) { sim800L.println(Serial.readString()); } }

void doAction() { if (dtmf_cmd == "1") { relay1_state = !relay1_state; digitalWrite(RELAY_1, relay1_state); if (relay1_state == true) { Serial.println("Relay 1 has been ON"); } else { Serial.println("Relay 1 has been OFF"); } } else if (dtmf_cmd == "2") { relay2_state = !relay2_state; digitalWrite(RELAY_2, relay2_state); if (relay2_state == true) { Serial.println("Relay 2 has been ON"); } else { Serial.println("Relay 2 has been OFF"); } } }

The settings that the Arduino ID currently has

S.k.joy
  • 11
  • 2

0 Answers0