SIM800L Module - Cry for help

Good Morning/Evening,

I am at my wits end right now. I thought it a good idea to buy one of those cheap as chips SIM800l modules off eBay for a project Im working on. However, after literally hours of tinkering, I still cannot get it to work. I am using very basic code to get the AT commands to work at least, which has provided mixed results.

Most commands work ok, however, connecting to a network has been driving me up the wall. Before I go any further, I am using a 2G network (O2-UK). I have tried two sims, both on the same network in another module I bought (the small one with the 5v to 4v regulator on board), and this one automatically connects to the network no problem (however I am getting a NO CARRIER error when I try to ATD a number). This small board (the red one you commonly find on ebay for a few £/$) has been connected up to a 4v regulator with a max 3A throughput so voltage is not the issue here. Both Sim cards work, and have been tested, but I just cannot get this board to connect. I even tried using the AT+COPS method to manually assign it to a network but its just a no-go.

Can anyone give me a run-down of how to get these boards working? I swear it will be the death of me if I keep running into issues.

Kind Regards

Justin

  1. Try to connect with this code and tell us the result:

#include <SoftwareSerial.h>
#include <Wire.h>

SoftwareSerial gprs(5, 4); // RX, TX Pins
String apn = "internet.t-mobile"; //APN
String apn_u = "t-mobile"; //APN-Username
String apn_p = "tm"; //APN-Password
String pin = "";

String url = "http://..."; //URL for HTTP-POST-REQUEST
String serial = "1234";

void setup() {
Serial.begin(9600);
gprs.begin(9600);
delay(10000);
gprs.listen();
//deactivatePin();
gsm_connect();
}

void loop() {
String gpsParam = "";

gsm_sendhttp(gpsParam); //Start the GSM-Modul and start the transmisson

delay(60000); //Wait one minute

}

/* GPRS*/
bool gsm_connect() {
//Print GSM Status an the Serial Output;
ATCommand("AT", 4000, false);

//ATCommand("AT+CPIN?", 100,false);
ATCommand("AT+SAPBR=3,1,Contype,GPRS", 100, false);
ATCommand("AT+SAPBR=3,1,APN," + apn, 100, false);
ATCommand("AT+SAPBR=3,1,USER," + apn_u, 100, false);
ATCommand("AT+SAPBR=3,1,PWD," + apn_p, 100, false);

ATCommand("AT+COPS?", 1000, false); // Show all visible Provider
ATCommand("AT+CBAND?", 1000, false); // Show current Band
//ATCommand("AT+CBAND=ALL_BAND", 1000, false);
ATCommand("AT+CSQ", 1000, false); // Check Signal strength
ATCommand("AT+COPS?", 100, false);
ATCommand("AT+CLCK="PN", 2", 100, false); // check if sim800 is locked.
ATCommand("AT+IPR?", 100, false); //Check Baudrate. For me Autobaud is not working. Only Baud 9600
//ATCommand("AT+IPR=9600", 100, false); //Check Baudrate 0 = Autobaud

ATCommand("AT+SAPBR=1,1", 1000, false);
String res = ATCommand("AT+SAPBR=2,1", 1000, false);
if (res.indexOf("0.0.0.0") > -1) {
ATCommand("AT+CREG=2", 4000, false);
gsm_connect();
}
return true;
}

bool gsm_sendhttp(String params) {
int tries = 0;
while (ATCommand("AT+HTTPINIT", 100, false) == "ERROR" && tries < 5) {
gsm_connect();
tries++;
delay(1000);
}
if (tries >= 5) {
return false;
}
ATCommand("AT+HTTPPARA=CID,1", 100, false);
ATCommand("AT+HTTPPARA=URL," + url, 100, false);
ATCommand("AT+HTTPPARA=CONTENT,application/x-www-form-urlencoded", 100, false);
ATCommand("AT+HTTPDATA=192,10000", 100, false);
ATCommand("params=" + params, 10000, true);
ATCommand("AT+HTTPACTION=1", 5000, false);
ATCommand("AT+HTTPREAD", 100, false);
ATCommand("AT+HTTPTERM", 100, false);
return true;
}
String ATCommand(String cmd, unsigned long wait, bool printInline) {
if (printInline) { gprs.print(cmd); }
else { gprs.println(cmd); }
String res = "";
res = gprs.readString();
Serial.print(res);

delay(wait);
return res;
}

void deactivatePin() {
ATCommand("AT+CPIN="" + pin + """, 4000, false);
ATCommand("AT+CLCK="SC",0,"" + pin + """, 4000, false);
ATCommand("AT+CPIN?", 4000, false);

}

1 Like

Thanks!!

AT

OK
AT+SAPBR=3,1,Contype,GPRS

OK
AT+SAPBR=3,1,APN,internet.t-mobile

OK
AT+SAPBR=3,1,USER,t-mobile

OK
AT+SAPBR=3,1,PWD,tm

OK
AT+COPS?

+COPS: 0,0,"AVEA"

OK
AT+CBAND?

+CBAND: DCS_MODE,ALL_BAND

OK
AT+CSQ

+CSQ: 17,0

OK
AT+COPS?

+COPS: 0,0,"AVEA"

OK
AT+CLCK="PN", 2

+CLCK: 0

OK
AT+IPR?

+IPR: 0

OK
AT+SAPBR=1,1

ERROR
AT+SAPBR=2,1

+SAPBR: 1,3,"0.0.0.0"

OK
AT+CREG=2

OK
AT

OK
AT+SAPBR=3,1,Contype,GPRS

OK
AT+SAPBR=3,1,APN,internet.t-mobile

OK
AT+SAPBR=3,1,USER,t-mobile

OK
AT+SAPBR=3,1,PWD,tm

OK
AT+COPS?

+COPS: 0,0,"AVEA"

OK
AT+CBAND?

+CBAND: DCS_MODE,ALL_BAND

OK
AT+CSQ

+CSQ: 17,0

OK
AT+COPS?

+COPS: 0,0,"AVEA"

OK
AT+CLCK="PN", 2

+CLCK: 0

OK
AT+IPR?

+IPR: 0

OK
AT+SAPBR=1,1

+CREG: 1,"898B","9E86"

ERROR

+CREG: 1,"898B","A495"
AT+HTTPINIT

OK
AT+HTTPPARA=CID,1

OK
AT+HTTPPARA=URL,http://...

OK
AT+HTTPPARA=CONTENT,application/x-www-form-urlencoded

OK
AT+HTTPDATA=192,10000

DOWNLOAD

OK
AT+HTTPACTION=1

OK

+HTTPACTION: 1,601,0
AT+HTTPREAD

OK
AT+HTTPTERM

OK