• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Sim900 not working with Arduino

Thread starter #1
Recently I bought Sim900a module and Arduino Mega 2560 to run my old code for sending sms and call, but now there is a problem as I am unable to send sms or either call, my code is attached below.



#include <SoftwareSerial.h>
SoftwareSerial gsm(2,3);
void setup()
{
gsm.begin(9600); // Setting the baud rate of GSM Module
Serial.begin(9600); // Setting the baud rate of Serial Monitor (Arduino)
delay(100);
}
void loop()
{
if (Serial.available()>0)
switch(Serial.read())
{
case 's':
Send();
break;
case 'r':
Recieve();
break;
case 'S':
Send();
break;
case 'R':
Recieve();
break;
}
if (gsm.available()>0)
Serial.write(gsm.read());
}
void Send()
{
Serial.print("Sending");
gsm.println("AT+CMGF=1");
delay(1000);
gsm.println("AT+CMGS=\"+xxxxxxxxxxxx\"\r"); // Replace x with mobile number
delay(1000);
gsm.println("Hello I am GSM modem!!!");// The SMS text you want to send
delay(100);
gsm.println((char)26); // ASCII code of CTRL+Z
delay(1000);
}
void Recieve()
{
Serial.print("Receiving");
gsm.println("AT+CNMI=2,2,0,0,0"); // AT Command to receive a live SMS
delay(1000);
}
 
Thread starter #3
What modules did you originally use ?

Unlike the Sim 900, the 900A firmware is locked to Asian countries only; are you there ?
http://www.raviyp.com/embedded/174-difference-between-sim900-and-sim900a-gsm-modems
I am currently living in Pakistan, Asia and I bought the correct sim900a module as mentioned in your link from http://www.w11stop.com/simcom-gsm-sim-900a-module
my sim900a is working fine as this module has been used for other projects also. I think the problem lies either with my code or my arduino mega.
 
Thread starter #5
The code worked when i changed the software serial from(2,3) to (10,11) since Arduino Mega does not support software serial on (2,3) pins
 

Latest threads

EE World Online Articles

Loading

 
Top