HI,I am using sim800l EVB v2 with my arduino UNO. I can call to a number successfully,but at command not responding.So i am unable to send sms.
Is there any way?My sim800l is blinking @3sec means it has network & i can call to a number.when i call from my mobile to sim used gsm module ,i can also hear ringing on my phone.The Only problem is I cant interact and unable to send SMS.
Here is the code.
#include <SoftwareSerial.h>
//Create software serial object to communicate with SIM800L
SoftwareSerial mySerial( 2,3); //SIM800L Tx & Rx is connected to Arduino #2 & #3
void setup()
{
//Begin serial communication with Arduino and Arduino IDE (Serial Monitor)
Serial.begin(9600);
//Begin serial communication with Arduino and SIM800L
mySerial.begin(9600);
Serial.println("Initializing...");
delay(1000);
mySerial.println("AT"); //Once the handshake test is successful, i t will back to OK
updateSerial();
mySerial.println("ATD+ +91xxxxxxxxxx;"); //
updateSerial();
delay(60000); // wait for 20 seconds...
mySerial.println("ATH"); //hang up
updateSerial();
mySerial.println("AT+CMGF=1"); // Configuring TEXT mode
updateSerial();
mySerial.println("AT+CMGS=\"+91xxxxxxxxxx\"");//change ZZ with country code and xxxxxxxxxxx with phone number to sms
updateSerial();
mySerial.print("Last Minute Engineers | lastminuteengineers.com"); //text content
updateSerial();
mySerial.write(26);
}
void loop()
{
}
void updateSerial()
{
delay(500);
while (Serial.available())
{
mySerial.write(Serial.read());//Forward what Serial received to Software Serial Port
}
while(mySerial.available())
{
Serial.write(mySerial.read());//Forward what Software Serial received to Serial Port
}
}
Thanks For Reply.
It works , but like a blind way ,cause I cant see the responses.And after adding this line before sending sms "AT+CNMI=2,2,0,0,0" and giving delay about 1000ms ,msg sent successfully.Now what to do to see the AT command responses?
You need to be continually reading the serial buffer coming in from the modem. This code needs to be running all the time... you should remove the delay(500) from the updateSerial routine.
#include <SoftwareSerial.h>
//Create software serial object to communicate with SIM800L
SoftwareSerial mySerial( 2,3); //SIM800L Tx & Rx is connected to Arduino #2 & #3
void setup()
{
//Begin serial communication with Arduino and Arduino IDE (Serial Monitor)
Serial.begin(9600);
//Begin serial communication with Arduino and SIM800L
mySerial.begin(9600);
Serial.println("Initializing...");
delay(1000);
mySerial.println("AT"); //Once the handshake test is successful, i t will back to OK
updateSerial();
mySerial.println("AT+CMGF=1"); // Configuring TEXT mode
updateSerial();
mySerial.println("AT+CNMI=2,2,0,0,0"); // Configuring TEXT mode
updateSerial();
mySerial.println("AT+CMGS=\"+ZZxxxxxxxxxx\"");//change ZZ with country code and xxxxxxxxxxx with phone number to sms
updateSerial();
delay(1000);
mySerial.print("Hello There"); //text content
updateSerial();
mySerial.write(26);
void loop()
{
}
void updateSerial()
{
delay(500);
while (Serial.available())
{
mySerial.write(Serial.read());//Forward what Serial received to Software Serial Port
}
while(mySerial.available())
{
Serial.write(mySerial.read());//Forward what Software Serial received to Serial Port
}
}
#include <SoftwareSerial.h>
//Create software serial object to communicate with SIM800L
SoftwareSerial mySerial(2, 3); //SIM800L Tx & Rx is connected to Arduino #2 & #3
void setup()
{
//Begin serial communication with Arduino and Arduino IDE (Serial Monitor)
Serial.begin(9600);
//Begin serial communication with Arduino and SIM800L
mySerial.begin(9600);
delay(500);
Serial.println("Initializing...");
mySerial.println("AT"); //Once the handshake test is successful, i t will back to OK
delay(50);
updateSerial();
mySerial.println("AT+CMGF=1"); // Configuring TEXT mode
delay(50);
updateSerial();
mySerial.println("AT+CNMI=2,2,0,0,0"); // Configuring TEXT mode
delay(50);
updateSerial();
mySerial.println("AT+CMGS=\"+zzxxxxxxxxx\"");//change ZZ with country code and xxxxxxxxxxx with phone number to sms
delay(50);
updateSerial();
mySerial.print("Hello There"); //text content
mySerial.write(26);
delay(50);
updateSerial();
}
void loop()
{
updateSerial();
}
void updateSerial()
{
while (Serial.available())
{
mySerial.write(Serial.read());//Forward what Serial received to Software Serial Port
}
while (mySerial.available())
{
Serial.write(mySerial.read());//Forward what Software Serial received to Serial Port
}
}
Once this code runs you can still query (send AT commands to) the modem from the serial monitor.
Nothing printed on output. Now I can't send SMS also. I tried with my previous code also.
Only i can make call using
mySerial.println("ATD+ +zzxxxxxxxxxxx;"); // change ZZ with country code and xxxxxxxxxxx with phone number to dial
updateSerial();
delay(10000); // wait for 20 seconds...
mySerial.println("ATH"); //hang up
updateSerial();
How to fix the problem.Only calling works and that is also like blindly cause i don't get any response. Update
After 2/3,times presing arduino reset button some times messge sent.What is the problem.This doesn't happen for call then why this happened with sms.I think this can be fixed if i get the response..
Is this baud rate related problem?
I'm having the same issue. Except that My code is empty. I seem to be stuck in the ">" prompt even after entering the text message until I reconnect the GSM hat.
Are you trying to send the message from the Serial Monitor?
The text message needs to be terminated with Control-Z (Char 26). You can't send this character from the monitor, so easiest is to just use another character (like '*')... then replace the * with Char 26 before sending to the modem.
while (Serial.available())
{
char c = Serial.read();
if (c == '*')
mySerial.write(26); // Send Control Z
else
mySerial.write(c); //Forward what Serial received to Software Serial Port
}