Connect GPRS Failed with SIM 800A and Arduino nano

Hi, I am trying to connect Blynk using SIM800A GSM module and Arduino Nano.
When I connect it to my Arduino nano the module is connecting to the network but failing to connect GPRS(Attach).


The code used is as follows,

#define BLYNK_PRINT Serial

// Select your modem:
#define TINY_GSM_MODEM_SIM800
//#define TINY_GSM_MODEM_SIM900
//#define TINY_GSM_MODEM_M590
//#define TINY_GSM_MODEM_A6

// Default heartbeat interval for GSM is 60
// If you want override this value, uncomment and set this option:
#define BLYNK_HEARTBEAT 13

#include <TinyGsmClient.h>
#include <BlynkSimpleSIM800.h>
#include <SoftwareSerial.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
//char auth[] = "ec94b3014e95489b9b499b5806cf5143";
char auth[] ="4085d73ab4cd4189818e330f734656b1";
// Your GPRS credentials
// Leave empty, if missing user or pass
char apn[]  = "bsnlnet";
//char apn[]  = "internet";
//char apn[]  = "portalnmms";
char user[] = "";
char pass[] = "";

//// Hardware Serial on Mega, Leonardo, Micro
//#define SerialAT Serial1

// or Software Serial on Uno, Nano
//#include <SoftwareSerial.h>
SoftwareSerial SerialAT(10, 11); // RX, TX

TinyGsm modem(SerialAT);

void setup()
{
  // Debug console
  Serial.begin(9600);

  delay(10);

  // Set GSM module baud rate
  SerialAT.begin(38400);
  delay(3000);

  // Restart takes quite some time
  // To skip it, call init() instead of restart()
  Serial.println("Initializing modem...");
  modem.restart();
  Serial.println("Restart Over...........");
  // Unlock your SIM card with a PIN
  //modem.simUnlock("1234");
 String modemInfo = modem.getModemInfo();
 Serial.print("Modem: ");
 Serial.println(modemInfo);
  Blynk.begin(auth, modem, apn, user, pass);
}

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

I had to fix your post as you had not properly formatted your posted code, as required in the Welcome Topic and in the directions you needed to delete when posting your topic.

Blynk%20-%20FTFC

SoftwareSerial works best at 9600 BAUD

Thank you for Fixing the format of code.
I will check with 9600 baud rate but it is finding network also connecting to network with baud rate of 38400.
The problem is in attaching the GPRS only.

Hard to tell… apn is correct? User/pass usually not needed but check your case. The same sim card works fine with GPRS mode on another modem/cell phone? (check modem’s network settings) The 38400 works with SSerial, but on my experience it is “a roof” for Atmega 328 (Arduino). One step down should be safer.

Yes same simcard works fine with GPRS Mode on another cell phone, APN used is also correct.
Is there any problem with Atmega 328?

One USART and too slow for fast SSerial. You can try with more capable MEGA and it’s hardware USART’s. But I was using GSM long time ago with SS baud rate 33600 and it was fine. My recent “design” was using hardware serial though.
All that said, I think your problem is not SS related.

I have sim800l and Atmega 328 programs running.

#define BLYNK_PRINT Serial

#define TINY_GSM_MODEM_SIM800

#include <TinyGsmClient.h>
#include <BlynkSimpleSIM800.h>

BlynkTimer timer;

char auth[] = "";
char apn[]  = "";
char user[] = "";
char pass[] = "";

#include <SoftwareSerial.h>
SoftwareSerial SerialAT(2, 4); // RX, TX

TinyGsm modem(SerialAT);

void setup()
{

  Serial.begin(9600);

  delay(10);

  SerialAT.begin(9600);

  Serial.println("Initializing modem...");

  modem.restart();
  modem.init();

  Blynk.begin(auth, modem, apn, user, pass);
}

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

}
1 Like

OK… I will try with other arduino board.

I have also used same code… In my case it is not working…
which blynk version have you used?

Tried version 2.27.4; 2.27.5; 2.27.6 at all works. Arduino Pro Mini 328.

I am asking Blynk Library Version…
I have tried Blynk v0.5.4 and v0.6.1 with Arduino Nano Both are not working…
and tiny GSM++ library v0.6.2 , which is not working in my case.

I use this library.
v0.6.1.zip

Have you tried SIM card in another device? Maybe a phone or usb dongle modem? To confirm it is working.

Even if the SIM works in another device doesn’t necessarily mean much. This topic makes an interesting read:

Pete.

2 Likes

I also wonder if the SIM card truly is 2G/GPRS.

In the UK I can’t find any 2G SIM cards as I looked at using sim800 for another project and it appears these only work on 2G, not 3G/4G.

Yes it is working…

SIM CARD supports 2G and working on GPRS i checked it

Ah not that then.
Was worth checking though.

Did you read the topic I posted above?

Pete.

2 Likes

Have you tried turning on all your debugging?
Please post your serial debugging (set up in IDE)
Lets have a look at those LWIP and IP client debugs.

In my case Vodacom SA issue above, I determinded that it was my Cellular operator dropping PCH IP packets on my HTTP login process.
I just got another providers SIM and all good.

P

1 Like