Cannot connect to blynk cloud with sim900

Before creating the topic

  1. Search forum for similar topics
  2. Check http://docs.blynk.cc and http://help.blynk.cc/
  3. Add details :
    • Hardware model + communication type. For example: Arduino UNO with Ethernet Shield
    • Smartphone OS (iOS or Android) + version
    • Blynk server or local server
    • Blynk Library version
    • Add your sketch code. :point_up:Code should be formatted as example below.

Simply paste your code between ``` If you don’t format your code, your topic can be deleted by moderators.

#define BLYNK_PRINT Serial
#define TINY_GSM_MODEM_SIM900
#include <TinyGsmClient.h>
#include <BlynkSimpleTinyGSM.h>
char auth[] = "4*********************************";
char apn[]  = "mobitel";
char user[] = "";
char pass[] = "";

#include <SoftwareSerial.h>
SoftwareSerial SerialAT(7, 8); // RX, TX
TinyGsm modem(SerialAT);


WidgetLED Power(V1);

void setup()
{
  Serial.begin(9600);
  delay(10);
  SerialAT.begin(9600);
  delay(3000);
  Serial.println("Initializing modem...");
  modem.restart();
  String modemInfo = modem.getModemInfo();
  Serial.print("Modem: ");
  Serial.println(modemInfo);
  Blynk.begin(auth, modem, apn, user, pass);
}

void loop()
{
  Blynk.run();
  Serial.println(Blynk.connected());
  Power.on();
  Blynk.virtualWrite(V0, 22, 3, 12, 24);
  Blynk.virtualWrite(V2, 22);
  Blynk.virtualWrite(V3, 12);
  Blynk.virtualWrite(V4, 24);
  delay(1000);
  Serial.println(Blynk.connected());
}

I’m using arduino uno with gsm 900 sheild.
Blynk Library version is 0.6.1
Smartphone OS is anrdoid and the app version is 2.27.5

Initializing modem...
Modem: SIM900 R11.0
[12774] 
    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v0.6.1 on Arduino Uno

[12890] Modem init...
[13817] Connecting to network...
[14893] Network: Mobitel
[14894] Connecting to mobitel ...
[21720] Connected to GPRS
[21989] Connecting to blynk-cloud.com:80
[24375] Redirecting to 45.55.96.146:80
[24814] Connecting to 45.55.96.146:80
[27117] Ready (ping: 866ms).
[33122] Connecting to 45.55.96.146:80
[35477] Ready (ping: 948ms).
[40918] Connecting to 45.55.96.146:80
[43202] Ready (ping: 908ms).
[49045] Connecting to 45.55.96.146:80
[51106] Ready (ping: 714ms).
[57122] Connecting to 45.55.96.146:80
[64367] Connecting to 45.55.96.146:80
[66984] Ready (ping: 952ms).
[73000] Connecting to 45.55.96.146:80
[75991] Ready (ping: 897ms).
[81126] Connecting to 45.55.96.146:80

Read this:

You’re breaking all of the rules with your void loop.

Pete.

void loop()
{
  Blynk.run();
}

It is still the same

Initializing modem...
Modem: SIM900 R11.0
[13217] 
    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v0.6.1 on Arduino Uno

[13332] Modem init...
[14284] Connecting to network...
[15360] Network: Mobitel
[15361] Connecting to mobitel ...
[21243] Connected to GPRS
[21514] Connecting to blynk-cloud.com:80
[23641] Redirecting to 45.55.96.146:80
[24129] Connecting to 45.55.96.146:80
[26186] Ready (ping: 707ms).
[32203] Connecting to 45.55.96.146:80
[43506] Connecting to 45.55.96.146:80
[45939] Ready (ping: 929ms).
[51956] Connecting to 45.55.96.146:80
[56076] Connecting to 45.55.96.146:80
[58303] Ready (ping: 709ms).
[63439] Connecting to 45.55.96.146:80
[65684] Ready (ping: 809ms).
[71701] Connecting to 45.55.96.146:80
[91304] Connecting to 45.55.96.146:80
[93471] Ready (ping: 829ms).
[99494] Connecting to 45.55.96.146:80
[101752] Ready (ping: 870ms).
[107753] Connecting to 45.55.96.146:80
void setup()
{
  Serial.begin(9600);
  delay(10);
  SerialAT.begin(9600);
  delay(3000);
  Serial.println("Initializing modem...");
  modem.restart();
  String modemInfo = modem.getModemInfo();
  Serial.print("Modem: ");
  Serial.println(modemInfo);
  Blynk.begin(auth, modem, apn, user, pass);
  Serial.println("Started");
}

I think it stuck in “Blynk.begin(auth, modem, apn, user, pass);”

Initializing modem...
Modem: SIM900 R11.0
[19333] 
    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v0.6.1 on Arduino Uno

[19448] Modem init...
[20423] Connecting to network...
[20715] Network: Mobitel
[20715] Connecting to mobitel ...
[26170] Connected to GPRS
[26440] Connecting to blynk-cloud.com:80
[28633] Redirecting to 45.55.96.146:80
[29077] Connecting to 45.55.96.146:80
[31115] Ready (ping: 707ms).
[38308] Connecting to 45.55.96.146:80
[41138] Ready (ping: 911ms).
[47154] Connecting to 45.55.96.146:80
[72766] Connecting to 45.55.96.146:80
[75085] Ready (ping: 884ms).
[81101] Connecting to 45.55.96.146:80

It is not stuck… since it IS successfully connecting, as indicated by the Ready (ping:...) statement.

So more likely something else is causing a disconnection… Power brownout, Blocking code, Cell provider…???

Since it can’t seem to get to your first serial print and there seems to be a around 5-7 seconds or so between reconnections, I suspect a power brownout as the connection ramps up.

I’m using a power supply to power the sim900 module.
When reconnecting it gives 0.5amps

Did you ever resolve this? I am running into the same issue…