Hello people!
I have connected sim900a Module with Arduino using proper circuitry. The module works fine when I place a call to any number, but every time I need to send text messages through the module I face an error as shown in the picture attached below. Please help me as I have run out of ideas.
This is the code that I have been running
#include <SoftwareSerial.h>
SoftwareSerial SIM900A(2,3);
void setup()
{
SIM900A.begin(115200); // Setting the baud rate of GSM Module
Serial.begin(115200); // Setting the baud rate of Serial Monitor (Arduino)
Serial.println ("SIM900A Ready");
delay(100);
Serial.println ("Type s to send message or r to receive message");
}
void loop()
{
if (Serial.available()>0)
switch(Serial.read())
{
case 's':
SendMessage();
break;
case 'r':
RecieveMessage();
break;
}
if (SIM900A.available()>0)
Serial.write(SIM900A.read());
}
void SendMessage()
{
Serial.println ("Sending Message");
SIM900A.write("AT+CMGF=1"); //Sets the GSM Module in Text Mode
delay(2000);
Serial.println ("Set SMS Number");
SIM900A.write("AT+CMGS=\"+number\"\r"); //Mobile phone number to send message
delay(2000);
Serial.println ("Set SMS Content");
SIM900A.write("Good morning, how are you doing?");// Messsage content
delay(2000);
Serial.println ("Finish");
SIM900A.write(26);// ASCII code of CTRL+Z
delay(2000);
Serial.println ("Message has been sent ->SMS Selesai dikirim");
}
void RecieveMessage()
{
Serial.println ("SIM900A Membaca SMS");
delay (1000);
SIM900A.write("AT+CNMI=2,2,0,0,0"); // AT Command to receive a live SMS
delay(1000);
Serial.write ("Unread Message done");
}
Your topic has been moved to a more suitable location on the forum. Installation and Troubleshooting is not for problems with (nor for advice on) your project.
No way can you use Software Serial at that baud rate... try 19200.
If the SIM900A does not auto-detect the baud rate you will also need to ensure that is set to a matching baud rate, by issuing the appropriate AT command.