BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

Arduino uno,gps neo 6m, sim 800 cannot send data to blynk

  #define BLYNK_PRINT Serial       // Bagian ini terhubung ke server BLYNK         
  #define TINY_GSM_MODEM_SIM800    //   Agar SIM800L berfungsi
  #include <TinyGsmClient.h>       // library
  #include <BlynkSimpleSIM800.h>
  #include <SoftwareSerial.h>
  #include <SPI.h>
  #include <RH_ASK.h>
  RH_ASK driver;
  const int Pin12 = 12;
  const int Pin10 = 10;
  const int Pin5 = 5;
  const int Pin3= 3;
  int x = 0;
  int y =0;
  char auth[] = "3NC7a1Gz_jfIKnoLNAp28fSE1FCOovkF";
  char apn[]  = "indosatooredoo.com";
  char user[] = "";
  char pass[] = "";
  #include <SoftwareSerial.h>
  SoftwareSerial SerialAT(4, 5); // RX, TX
  WidgetMap myMap(V0);
  TinyGsm modem(SerialAT);
  BlynkTimer timer;
  int d=0; 
  SoftwareSerial mySerial(4, 5);
  void myTimerEvent()
  {
    rf();
    checkBlynk();
  }

  void checkBlynk(){  // called every 3 seconds by SimpleTimer

    bool isconnected = Blynk.connected();
    if (isconnected == false){
      d++; 
      delay(1000) ;   
    }
    if(d > 5){
         Blynk.begin(auth, modem, apn, user, pass);
         Serial.println("connected");
         d=0;
       }
    }

  void setup()
  { pinMode(Pin5, OUTPUT);
    pinMode(Pin3, OUTPUT);
    pinMode(Pin12, OUTPUT);
    pinMode(Pin10, OUTPUT);
    digitalWrite(Pin3, HIGH);
    Serial.begin(9600);
    if (!driver.init())
    { Serial.println("init failed");}
    SerialAT.begin(9600);
    delay(10);
    SerialAT.begin(9600);
    delay(3000);  
    Blynk.begin(auth, modem, apn, user, pass);
    timer.setInterval(1000L, myTimerEvent);
  }
  void loop()
  {  Blynk.run();
    timer.run(); 
    
  }
  void rf()
  {
     uint8_t buf[1];
    uint8_t buflen = sizeof(buf);
    if (driver.recv(buf, &buflen))
    {
      Serial.println((char*)buf);
      if (buf[0] == '1')
      { x = 0;
        digitalWrite(Pin12, HIGH);
        digitalWrite(Pin10, LOW);
        digitalWrite(Pin5, LOW);
        y=0;
        delay(100);
      }
      else if (buf[0] == '2')
      { x = 0;
        digitalWrite(Pin3, LOW);
        delay(100);
      }
    }
    digitalWrite(Pin12, LOW );
    if (Pin12 != HIGH )
    {y++;
      x++;
      delay(1000);
      if (x == 5)
      {
        //digitalWrite(Pin5, HIGH);
        digitalWrite(Pin10, HIGH);
       delay(1000);
       call();
       //
        x = 0;
        }
    }
    
  }
  void call()
  {
    SerialAT.println("ATD+ +6281243745543;"); 
    
  }

this happens when i add a function to make calls

        17:18:19.939 -> [3103] Modem init...
        17:18:20.111 -> [3333] Connecting to network...
        17:18:20.214 -> [3426] Network: INDOSAT
        17:18:20.249 -> [3427] Connecting to indosatooredoo.com ...
        17:18:25.295 -> [8498] Connected to GPRS
        17:18:25.364 -> [8570] Connecting to blynk-cloud.com:80
        17:18:26.610 -> [9815] Ready (ping: 558ms).
        17:18:31.667 -> [14852] Connecting to blynk-cloud.com:80
        17:18:33.326 -> [16516] Ready (ping: 370ms).
        17:18:38.339 -> [21553] Connecting to blynk-cloud.com:80

@MRN306 please edit your post, using the pencil icon at the bottom, and add triple backticks at the beginning and end of your code so that it displays correctly.
Triple backticks look like this:
```

Also, if you intend to post serial monitor output then this would be better copied and pasted, also with triple backticks, than posting a screenshot.

Pete.

thanks for the suggestion, i am new here

You’ve used the wrong characters, despite me giving you the correct triple backticks characters to copy and paste.

Pete.

I might be wrong, but I think that what is happening is that the Blynk library Blynk needs exclusive access to the SIM800 to maintain its connection to the Blynk server.
When you add this line:

SerialAT.println("ATD+ +6281243745543;");

it is interfering with the Blynk communication to the SIM800 across the SerialAT SoftwareSerial port and Blynk is disconnecting as a result.

I don’t believe that it’s possible to use the SIM800 for calls and data communication with Blynk at the same time, across the same serial port.

Pete.

What if I disconnect from Blynk during a phone call and then connect to Blynk again?

That should work.

Pete.

void call()
{Blynk.disconnect();
 SerialAT.println("ATD+ +6281243745543;"); 
 delay(2000);
//Blynk.notify("Device started");
//Blynk.begin(auth, modem, apn, user, pass);
 Serial.println("ok");
}

I’ve tried using the code above but it’s still the same

15:33:47.051 -> [3103] Modem init...
15:33:47.225 -> [3339] Connecting to network...
15:33:47.330 -> [3435] Network: INDOSAT
15:33:47.365 -> [3435] Connecting to indosatooredoo.com ...
15:33:51.575 -> [7667] Connected to GPRS
15:33:51.644 -> [7741] Connecting to blynk-cloud.com:80
15:33:52.889 -> [8997] Ready (ping: 591ms).
15:33:57.934 -> [14033] Connecting to blynk-cloud.com:80
15:33:59.382 -> [15466] Ready (ping: 361ms).
15:34:04.404 -> [20503] Connecting to blynk-cloud.com:80
15:34:06.145 -> [22223] Ready (ping: 370ms).
15:34:11.188 -> [27259] Connecting to blynk-cloud.com:80
15:34:13.175 -> [29258] Ready (ping: 869ms).
15:34:18.216 -> [34295] Connecting to blynk-cloud.com:80
15:34:19.854 -> [35932] Ready (ping: 557ms).
15:34:24.895 -> [40969] Connecting to blynk-cloud.com:80
15:34:26.325 -> [42398] Ready (ping: 374ms).