thehapyone / barebonesim800 Goto Github PK
View Code? Open in Web Editor NEWA BareBone Arduino Library For SIM800 Modules
License: GNU General Public License v3.0
A BareBone Arduino Library For SIM800 Modules
License: GNU General Public License v3.0
First of all, thank you VERY MUCH for this wonderful lib which I've learned a lot reading the source code.
My question is how did you manage to get the flows? For example, in the following code you had to execute a series of commands to get the locations working:
this->SoftwareSerial::print (F(" AT+SAPBR=3,1,\"CONTYPE\",\"GPRS\" \r\n" ));
_buffer=_readSerial(); // set bearer parameter
this->SoftwareSerial::print (F(" AT+SAPBR=3,1,\"APN\",\"internet\" \r\n" ));
_buffer=_readSerial(); // set apn
this->SoftwareSerial::print (F(" AT+SAPBR=1,1 \r\n"));
delay(1200);
_buffer=_readSerial(); // activate bearer context
this->SoftwareSerial::print (F(" AT+SAPBR=2,1\r\n "));
delay(3000);
_buffer=_readSerial();
First enable the GPRS, second setting the APN and so one, how did you know that?
I've found a PDF where I could understand better all the commands, but not the flows.
Hello,
i try to do a http get request with an https url. In debug mode, i get the following result:
`Testing GSM module For GPRS Connectivity
Should be ready by now
AT
OK
AT+CSCS="GSM"
OK
AT+CMGF=1
OK
AT+CMGL="ALL",0
OK
Device is Attached
Connecting to APN
AT+CIPSHUT
SHUT OK
AT+CGATT=0
OK
AT+SAPBR=0,1
ERROR
AT+SAPBR=3,1,"CONTYPE","GPRS"
OK
AT+SAPBR=3,1,"APN","web.vodafone.de"
OK
AT+SAPBR=3,1,"USER",""
OK
AT+SAPBR=3,1,"PWD",""
OK
AT+SAPBR=1,1
OK
AT+CGATT=1
OK
AT+CIPMUX=0
OK
AT+CSTT="web.vodafone.de","",""
OK
AT+CIICR
OK
AT+CIFSR
100.73.30.57
Connected to Network
Making HTTP Get Request
AT+HTTPINIT
OK
AT+HTTPPARA="CID",1
OK
AT+HTTPPARA="URL",https://webapp.xxxxxxxxxxxxxx/t.php
OK
AT+HTTPACTION=0
OK
+HTTPACTION: 0,603,0
AT+HTTPREAD
OK
Received Info:
AT+HTTPREAD
OK
AT+HTTPTERM
OK
AT+CIPSHUT
SHUT OK
AT+CGATT=0
+SAPBR 1: DEACT
OK
AT+SAPBR=0,1
ERROR
`
What can i do?
Im scratching my head for few days with this one. When i do GET request it works but when I put module to sleep and then do request it doesn't.
Here is my code:
#include <BareBoneSim800.h>
BareBoneSim800 sim800("internet.bob.si"); //to declare the library with an APN
const char resource[] = "m2msupport.net/m2msupport/test.php";
const int port = 80;
void setup() {
Serial.begin(9600);
sim800.begin();
while(!Serial);
Serial.println("Testing GSM module For GPRS Connectivity");
delay(8000); // this delay is necessary, it helps the device to be ready and connect to a network
Serial.println("Should be ready by now");
bool deviceAttached = sim800.isAttached();
if (deviceAttached)
Serial.println("Device is Attached");
else
Serial.println("Not Attached");
}
void loop() {
sim800.disableSleep();
sim800.setFullMode();
// Connecting the the GPRS APN Network
Serial.println(" Connecting to APN");
bool netConnect = sim800.gprsConnect();
if(netConnect)
Serial.println("Connected to Network");
else
Serial.println("An Error Occured");
if(netConnect)
{
Serial.println("Making HTTP Get Request");
String result = sim800.sendHTTPData(resource);
Serial.println("Received Info: ");
Serial.println(result);
}
sim800.closeHTTP(); // disconnect from server
sim800.gprsDisconnect();
bool sleepActivated = sim800.enterSleepMode();
if(sleepActivated)
{
Serial.println("zzzzZZZZZZzzzzz");
delay(5000);
}
}
this is debug for first request
AT+CSCLK=0
OK
AT+CFUN=1
OK
AT+CFUN=1
OK
Connecting to APN
AT+CIPSHUT
SHUT OK
AT+CGATT=0
OK
AT+SAPBR=0,1
ERROR
AT+SAPBR=3,1,"CONTYPE","GPRS"
OK
AT+SAPBR=3,1,"APN","internet.bob.si"
OK
AT+SAPBR=3,1,"USER",""
OK
AT+SAPBR=3,1,"PWD",""
OK
AT+SAPBR=1,1
OK
AT+CGATT=1
OK
AT+CIPMUX=0
OK
AT+CSTT="internet.bob.si","",""
OK
AT+CIICR
OK
AT+CIFSR
100.65.40.9
Connected to Network
Making HTTP Get Request
AT+HTTPINIT
OK
AT+HTTPPARA="CID",1
OK
AT+HTTPPARA="URL",m2msupport.net/m2msupport/test.php
OK
AT+HTTPACTION=0
OK
+HTTPACTION: 0,200,4
AT+HTTPREAD
+HTTPREAD: 4
test
OK
Received Info:
AT+HTTPREAD
+HTTPREAD: 4
test
OK
AT+HTTPTERM
OK
AT+CIPSHUT
SHUT OK
AT+CGATT=0
+SAPBR 1: DEACT
OK
AT+SAPBR=0,1
ERROR
AT+CFUN=0
+CPIN: NOT READY
OK
AT+CSCLK=2
OK
zzzzZZZZZZzzzzz
here is the second one
AT+CSCLK=0
OK
AT+CFUN=1
+CPIN: READY
OK
SMS Ready
Call Ready
AT+CFUN=1
OK
Connecting to APN
AT+CIPSHUT
SHUT OK
AT+CGATT=0
OK
AT+SAPBR=0,1
ERROR
AT+SAPBR=3,1,"CONTYPE","GPRS"
OK
AT+SAPBR=3,1,"APN","internet.bob.si"
OK
AT+SAPBR=3,1,"USER",""
OK
AT+SAPBR=3,1,"PWD",""
OK
AT+SAPBR=1,1
OK
AT+CGATT=1
OK
AT+CIPMUX=0
OK
AT+CSTT="internet.bob.si","",""
OK
AT+CIICR
OK
AT+CIFSR
100.67.23.115
Connected to Network
Making HTTP Get Request
AT+HTTPINIT
OK
AT+HTTPPARA="CID",
Received Info:
AT+HTTPTERM
OK
AT+CIPSHUT
SHUT
AT+CFUN=0
+SAPBR
OK
FF
AT+CSCLK=0
OK
AT+CFUN=1
+CPIN:
SMS Ready
Call Ready
Any idea how to fix it ?
Hi there. First of all I love the simplicity of this library!
Here is the code that I use
#include <BareBoneSim800.h>
BareBoneSim800 sim800("internet.bob.si", "bob", "internet"); //to declare the library with an APN, UserName and Password
const char resource[] = "test.com/send.php";
const int port = 80;
void setup() {
Serial.begin(9600);
sim800.begin();
while(!Serial);
delay(8000);
}
void loop() {
bool fullMode = sim800.setFullMode();
if(fullMode)
{
// Connecting the the GPRS APN Network
Serial.println(" Connecting to APN");
bool netConnect = sim800.gprsConnect();
if(netConnect)
{
Serial.println("Making HTTP Get Request");
String result = sim800.sendHTTPData(resource);
Serial.println("Received Info: ");
Serial.println(result);
sim800.closeHTTP(); // disconnect from server
bool netDisconnect=sim800.gprsDisconnect();
sim800.flushSerial(5000);
bool sleepActivated = sim800.enterSleepMode();
Serial.println("sleeeeeeeeeep");
Serial.println(sleepActivated);
if(sleepActivated)
{
Serial.println("zzzzZZZZZZzzzzz");
delay(30000);
bool disableSleep = sim800.disableSleep();
}
}
}
}
It works fine up to when is time to put module in sleep mode. Serial print for sleepActivated returns 0 and I cant understand why? If I just connect module to network I can than put it into sleep but not after HTTP request. Any idea why?
Hi, how can i use the AT commands in this library?
HI,
Is it support HTTP Post method ?
Detection of DTMF tones - SIM800L module.
I get "OK" when I send 'AT+DDET=1,1000,1,1* ' over uart .
But it doesnt seem to detect anything afterwards.
Perhaps I am doing something wrong.
Would appreciate some feedback.
regards
Atul
ref : *SIM800 Series_AT Command Manual_V1.09
Ayo,
Good job.
It took me sleepless nights to understand the SIM800.
However, I have observation in this your BareBone library.
Check line 540 in .cpp file.
Under method sendHttpdata.
AT COMMAND for HTTP POST should ta value 1 not 0 as you indicated.
I maybe wrong anyway.
Secondly, can you give me idea, I wish to develop nonblock library to be used in rtos. But attempt s seem have not yield anything good.
Hello,
it would be nice to have the possibility to use your great library with Hardware Serial in board which have them plenty. Unfortunately it seems to be too "hardwired" to (alt)softserial.
PP
Hello,
I tried the BareBoneSim800 1.25 version library. It seems the line "char *mydataIn = strdup(tempData.c_str());" has the problem which results in NULL value for the *mydataIn pointer and the end result is "Status" value will remain 99.
For example, call to function sim800.isAttached() will always display "Not Attached" even if there was OK response from SIM800 for the "AT\r\n" command.
In my project, I was using a TFT LCD screen shield along with sim800 module, hence not able to use digital pin 8 and 9.
Is there any method to modify this by using barebonesim800.h or AltSoftSerial.h?
Hey, can someone please include the call functions. That would help me a lot for my project. Because other lib´s are not that well with sending sms.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.