arduino-libraries / gsm Goto Github PK
View Code? Open in Web Editor NEWGSM Library for Arduino
Home Page: http://arduino.cc/
GSM Library for Arduino
Home Page: http://arduino.cc/
can we use this library for GSM SIM900A module?
Maybe offering/recommending a 3G shield could do the trick. Or even a LoRa shield, for instance. A think 4G shield is overkill (as this: https://www.cooking-hacks.com/4g-gps-3g-gprs-gsm-gps-lte-wcdma-hspa-shield-for-arduino)
Have you thought about this?
Thanks.
From @amcewen on August 16, 2015 17:26
Part of the problem is the line https://github.com/arduino/Arduino/blob/master/libraries/GSM/src/GSM3ShieldV1ClientProvider.cpp#L248, which returns 0 when there's no data available.
However, there's also (from code inspection) a problem in the multi-byte version of GSMClient::read because that also assumes that read() returning 0 indicates no data left.
And the problem propagates all the way down to GSM3CircularBuffer::read which also returns 0 if there's no data available.
The problem there is that GSM3CircularBuffer::read returns a char, so there's nowhere that an error can be signalled, so presumably it would need to be reworked to return an int instead.
Copied from original issue: arduino/Arduino#3690
Hi,
This code:
`
// libraries
#include <GSM.h>
// PIN Number
#define PINNUMBER "2355"
// initialize the library instance
GSM provider; // include a 'true' parameter to enable debugging
GSMScanner scannerNetworks;
GSMModem modem;
// Save data variables
String IMEI = "";
// serial monitor result messages
String errortext = "ERROR";
void setup() {
// initialize serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
Serial.println("GSM networks scanner");
scannerNetworks.begin();
// connection state
boolean notConnected = true;
// Start GSM shield
// If your SIM has PIN, pass it as a parameter of begin() in quotes
while (notConnected) {
if (provider.begin(PINNUMBER) == GSM_READY) {
notConnected = false;
} else {
Serial.println("Not connected");
delay(1000);
}
}
// get modem parameters
// IMEI, modem unique identifier
Serial.print("Modem IMEI: ");
IMEI = modem.getIMEI();
IMEI.replace("\n", "");
if (IMEI != NULL) {
Serial.println(IMEI);
}
}
void loop() {
// scan for existing networks, displays a list of networks
Serial.println("Scanning available networks. May take some seconds.");
Serial.println(scannerNetworks.readNetworks());
// currently connected carrier
Serial.print("Current carrier: ");
Serial.println(scannerNetworks.getCurrentCarrier());
// returns strength and ber
// signal strength in 0-31 scale. 31 means power > 51dBm
// BER is the Bit Error Rate. 0-7 scale. 99=not detectable
Serial.print("Signal Strength: ");
Serial.print(scannerNetworks.getSignalStrength());
Serial.println(" [0-31]");
}`
return:
GSM networks scanner
Modem IMEI: 0
Current carrier: 0
Signal Strength: [0-31]
Scanning available networks. May take some seconds.
I have a bridge with pin 2 and 10..
The product(s) are retired, what to do @alranel?
From @antoinedewailly on February 10, 2016 9:14
Hello,
I think I have a problem with this library.
I perfectly manage to send & receive messages into arduino with this librairy (and with AT command) but when i send messages from arduino via ethernet shield and webservice it's work with all the letters except "w" which deletes the rest of the message. exemple: i send "hello world" i receive "hello w"
Do you have an idea ?
Cordialy,
Antoine.
Copied from original issue: arduino/Arduino#4553
This lib can't receive chinese sms successfully on arduino mini pro . here is my changes.
set pdu mode in GSM3ShieldV1AccessProvider.cpp
else if(ct==5)
{
// 5: Wait IFC OK
if(theGSM3ShieldV1ModemCore.genericParse_rsp(resp))
{
//Delay for SW flow control being active.
theGSM3ShieldV1ModemCore.delayInsideInterrupt(2000);
// 9: SMS pdu Mode
theGSM3ShieldV1ModemCore.setCommandCounter(6);
theGSM3ShieldV1ModemCore.genericCommand_rq(PSTR("AT+CMGF=0"));
change the debug code
void GSM3CircularBuffer::printCharDebug(uint8_t c)
{
Serial.print(" [");Serial.print(c);Serial.print("] ");
if((c>31)&&(c<127))
Serial.print((char)c);
else if(c == 13){
Serial.print('\r');
}
else if(c == 10){
Serial.print('\n');
}else{
Serial.print('%');
Serial.print(c);
Serial.print('%');
}
}
------------------BUG------------------------------
when receive SMS.
66 62> [13]
[10]
[43] + [67] C [77] M [71] G [76] L [58] : [32] [49] 1 [44] , [49] 1 [44] , [44] , [56] 8 [56] 8 [13]
[10]
[48] 0 [56] 8 [57] 9 [49] 1 [54] 6 [56] 8 [51] 3 [49] 1 [49] 1 [48] 0 [51] 3 [48] 0 [52] 4 [55] 7 [48] 0 [53] 5 [70] F [48] 0 [50] 2 [52] 4 [49] 1 [50] 2 [65] A [48] 0 [48] 0 [49] 1 [53] 5 [54] 6 [57] 9 [53] 5 [50] 2 [49] 1 [48] 0 [53] 5 [57] 9 [52] 4 [48] 0 [49] 1 [49] 1 [54] 6 [54] 6 [56] 8 [48] 0 [48] 0 [48] 0 [56] 8 [56] 8 [49] 1 [49] 1 [49] 1 [48] 0 [50] 2 [49] 1 [50] 2 [52] 4 [49] 1 [57] 9 [53] 5 [50] 2 [51] 3 [52] 4 [50] 2 [51] 3 [48] 0 [49] 1 [48] 0 [53] 5 [70] F [65] A [69] E [55] 7 [54] 6 [68] D [70] F [51] 3 [48] 0 [49] 1 [49] 1 [48] 0 [48] 0 [51] 3 [55] 7 [48] 0 [48] 0 [51] 3 [55] 7 [48] 0 [48] 0 [51] 3 [57] 9 [48] 0 [48] 0 [51] 3 [57] 9 [70] F [70] F [48] 0 [56] 8 [48] 0 [48] 0 [51] 3 [49] 1 [48] 0 [48] 0 [34] " [48] 0
chop start head,tail=66,62
chop stop head,tail=74,62
Receive a message.
extractSubstring:
chop start head,tail=74,62
chop stop head,tail=84,62
0891683110304705F02412A00156952105940116680008811102124195234230105FAE76DF30110037003700390039FF08003100"05206949F518567096548FF09FF0C8BF74E0D89815C0677ED4FE19A8C8BC17801900F97327ED94ED64EBA3002
sms text has a bug after 103 string ,such as ".
the correct string is below:
0891683110304705F02412A00156952105940116680008811102124195234230105FAE76DF30110037003700390039FF08003100405206949F518567096548FF09FF0C8BF74E0D89815C0677ED4FE19A8C8BC17801900F97327ED94ED64EBA3002
At least on Uno compiled on Windows, the software serial sends only half the characters, so the modem never responds. (e.g. ATsends only A)
I found that just getting GSM3ShieldV1DirectModemProvider::write() to return the value from GSM3ShieldV1ModemCore.write() solves the issue.
Perhaps some optimizing is done by the compiler which results in it not working?
See around line 75 of GSM3ShieldV1DirectModemProvider.cpp:
//Write to the modem by means of SoftSerial
size_t GSM3ShieldV1DirectModemProvider::write(uint8_t c)
{
return theGSM3ShieldV1ModemCore.write(c);
}
Hi,
GSM library can't handle messages with underscore '_' in message body. '_' is 95 dec (0x5F hex) in ASCII code and 17 dec (0x11 hex). When message with underscore encoded as 0x11 is tried to be sent it actually gets treated as special character, so resulting message has some garbage in place of underline. I think problem lays in GSM3SoftSerial implementation
size_t GSM3SoftSerial::write(uint8_t c)
{
if (_tx_delay == 0)
return 0;
// Characters to be escaped under XON/XOFF control with Quectel
if(c==0x11)
{
this->finalWrite(0x77);
return this->finalWrite(0xEE);
}
if(c==0x13)
{
this->finalWrite(0x77);
return this->finalWrite(0xEC);
}
if(c==0x77)
{
this->finalWrite(0x77);
return this->finalWrite(0x88);
}
return this->finalWrite(c);
}
Br
From @brezinapeto on February 25, 2016 14:28
Please read communication with Quectel :
Currently I work with Arduino GSM Shield with QUECTEL M10 chip. I use standard GSM library (https://www.arduino.cc/en/Reference/GSM) for communication with this shield.
From this point of view it is little bit hard to have some AT log file.I use M10 as TCP Server.
What I can assume from that GSM library is that after start of the server object :
AT+QILOCIP (then parse received IP)
AT+QILPORT=”TCP”,81
AT+QISERVERAnd after some time I want to change port number then I call function from object which will call:
(delay for 1 sec)
+++
(delay for 1 sec)
AT+QICLOSE
And call another function for begin of the new object with different port number 82:
AT+QILOCIP (then parse received IP)
AT+QILPORT=”TCP”,82
AT+QISERVERResult is, that I still receive messages from port 81 and nothing from 82.
Currently I particularly solve my problem but it is not what I really want.
Regards,
Peter Brezina
Here is answer from Quectel:
So your command sequence should be like below;
What I can assume from that GSM library is that after start of the server object :
AT+QILOCIP (then parse received IP)
AT+QILPORT=”TCP”,81
AT+QISERVERAnd after some time I want to change port number then I call function from object which will call:
(delay for 1 sec)
+++
(delay for 1 sec)
*_AT+QISRVC=2
*_AT+QICLOSE
……………….. //you should get “CLOSE OK”
AT+QISSTAT //query the current Server Status
.................. //you should get “ERROR” responseAnd call another function for begin of the new object with different port number 82:
AT+QILOCIP (then parse received IP)
AT+QILPORT=”TCP”,82
AT+QISERVER
AT+QISSTAT // you should get “S: LISTENNING” response
AT+QILPORT? // you should get “TCP: 82”At this point client should reconnect to the Server which runs on the module by specifying the new port number as 82.
Looking forward to your reply. Thanks !
Best Regards,
Mehmet Cihangir Field Application Engineer
Copied from original issue: arduino/Arduino#4612
From @SerxioSierra on November 3, 2015 22:9
I have noticed that the GsmWebClient example
http://arduino.cc/en/Tutorial/GSMExamplesWebClient
stopped working properly since Arduino IDE v.1.5.7. I have been doing tests and the problem is that the logo is not shown properly in the serial monitor window. Sometimes appears a part of the logo (some characteres) and noticed that the horizontal scroll bar is moving constantly to the right, so the logo is not shown and not completed. The disconnecting message is not shown, it seems to be in a loop writing spaces on the log.
Tests has been done using the newest Arduino GSM Shield v2 and different IDE versions including the lastest today v.1.6.6. All cases the Windows versions (in fact 8.1) and using 9600 bauds for the connection.
However using Arduino v.1.5.6-r2 that example works fine. So maybe the reason is in the GSM libraries included since v1.5.7.
Two SIMS used for the tests and in all cases with GPRS connectivity available.
Best Regads
Copied from original issue: arduino/Arduino#4071
Hello,
I have an application where I make webservice calls every 10 seconds, the first call occurs without problems, however in the following calls I receive error -2.
Any idea what might be going on?
Any examples of multiple calls?
!!! Open problem in the wrong project. !!!
Moved from arduino/Arduino#7420 by @Thor2018
Hello everyone,
I have lot's of problems with three new original Arduino GSM Shields v2. Everyone does not functioning correctly because the GSM Library is incorrect. You don't belive me?
Google GSM Shield Problems! I can't understand why the hell you sell products which don't function correctly! I have spent more than 300$ on, so it seems, not functioning stuff!
Also the Arduino Forum can't help me!
After i tested one of the original Arduino GSM Shields v2 with the Original Mega2560, everything worked fine (Sending and Receiving SMS).
But today suddenly the GSM Modul stucks at the command "ReceiveSMS" or "GsmScanNetworks" from the Example Sketches!
I already tried and have done:
I also tried out something with AT commands like the Sketch below. Then i get after i typed in AT the following answer
So do you know any further steps to can solve this problem? I can't understand why they selling products (GSM Shield's) which are not working. Especially they are really expensive!
I'm thankful for every answer!
Best regards, Thorsten
#include <SoftwareSerial.h>
#include <string.h>
char incoming_char = 0;
SoftwareSerial cell(10, 3);
void setup()
{
// Initialize serial ports for communication.
Serial.begin(9600);
// Reset
Serial.println("Start Reset");
pinMode(7, OUTPUT);
digitalWrite(7, HIGH);
delay(12000);
digitalWrite(7, LOW);
delay(1000);
Serial.println("End Reset");
cell.begin(9600);
Serial.println("Enter your AT commands (with CR & NL)...");
}
void loop()
{
if (cell.available() > 0)
{
incoming_char = cell.read();
if ((incoming_char >= ' ') && (incoming_char <= 'z'))
Serial.print(incoming_char);
else
{
Serial.print("%");
Serial.print((int) incoming_char);
Serial.print("%");
if (incoming_char == 10)
Serial.println();
}
}
if (Serial.available() > 0)
{
incoming_char = Serial.read();
cell.print(incoming_char);
}
}
I'm using Rx3 and Tx3 with AT commands on software Serial (with MEGA 2560)
But although GSM library uses softwareSerial... it does not work.
I've changed the GSM3IO and GSM3SoftSerial like this...
#elif defined(AVR_ATmega2560) || defined(AVR_ATmega1280)
#define __TXPIN__ 14
#define __RXPIN__ 15
#define __RXINT__ 4
Any ideas ???
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.