No output, GSM module not responding

I've been trying to interface a GSM 900 module with an Arduino Duemilanove using the following code. The GSM module is working perfectly in hyper terminal and I've checked that the TX, RX and GND connections are proper as well. However, when I try to connect it to the Arduino board, I get no response, even if I set the delay to 10 seconds. Could it be a code problem? Here's the code.

void setup()
{
Serial.begin(9600); //Baud rate of the GSM/GPRS Module
Serial.println("AT\r");
delay(1000);
Serial.println("AT+CMGF=1\r");
delay(1000);
Serial.println("AT+CMGS="+918551981433"\r"); //Number to which you want to send the sms
delay(1000);
Serial.print("Gas project in action!\r"); //The text of the message to be sent
delay(1000);
Serial.write(0x1A);
delay(1000);
}
void loop()
{
}

If that's all of your code then how do you communicate with the shield?

Try the link in my signature might give you more help.

There's no delay before the first string is sent, perhaps the GSM module takes longer to
bootup than the Arduino?

hello if i can help I don't know much about coding but this is the sketch i used to get messages from the arduino

#include <SoftwareSerial.h>
SoftwareSerial SIM900(7, 8);

void setup()
{
  SIM900.begin(19200);
  SIM900power();  
  delay(20000);  // give time to log on to network. 
}

void SIM900power()
// software equivalent of pressing the GSM shield "power" button
{
  digitalWrite(9, HIGH);
  delay(1000);
  digitalWrite(9, LOW);
  delay(5000);
}

void sendSMS()
{
  SIM900.print("AT+CMGF=1\r");                                                        // AT command to send SMS message
  delay(100);
  SIM900.println("AT + CMGS = \"+1xxxxxxxxxx\"");                                     // recipient's mobile number, in international format
  delay(100);
  SIM900.println("Hello, world. This is a text message from an Arduino Uno.");        // message to send
  delay(100);
  SIM900.println((char)26);                       // End AT command with a ^Z, ASCII code 26
  delay(100); 
  SIM900.println();
  delay(5000);                                     // give module time to send SMS
  SIM900power();                                   // turn off module
}

void loop()
{
  sendSMS();
  do {} while (1);
}

hope this helps it help me out a lot.

Now I'm trying this code, only difference from earlier code is that its not using default Rx Tx pins. Why should this work when that can't? By the way, even this doesn't seem to work with my module. Also, the code posted above isn't working.

#include <SoftwareSerial.h>

SoftwareSerial SIM900(7, 8);

String outMessage = "Hello world!";
String incomingNumber = "+918297940415";

void setup()
{
  SIM900.begin(19200); 
  
  SIM900.print("AT+CMGF=1\r");
  delay(100);
  SIM900.println("AT + CMGS = \"" + incomingNumber +"\"");
  delay(100);
  SIM900.println(outMessage);
  delay(100);
  SIM900.println((char)26);//ctrl+z
  delay(5000);
}

void loop()
{
}

Can we have a link to the SIM900 shield / board that you are using please?

I'm assuming that you are using the popular one, and based on that how long does it take the net led to indicate that it has a signal? Try it a few times to get an average and then put a delay after the Serial.begin command. If you run the sketch as is then it doesn't give the SIM900 time to acquire a network lock before trying to send the message.

Yep,I'm using Campus Component SIM 900 module,here is the link to it.

http://www.google.co.in/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&ved=0CCcQFjAA&url=http%3A%2F%2Fwww.campuscomponent.com%2Fmedia%2Fdownload%2FGSM%2520Module.pdf&ei=0wpYU-6iPIz7rAfBmoDgAg&usg=AFQjCNGGvkmOPTBvb-l_Gj762M4KmwVloA&bvm=bv.65177938,d.bmk

Typical! I've not come across that one before and unfortunately with it using the RS232 interface I'm not really able to help any further.

All I can suggest is getting a copy of Serial Relay installed on your Arduino and try swapping Rx/Tx over and trying different baud rates to the SIM900 (SIM900.begin). Give it enough time to get a network lock and then send an AT command and see if it responds. Once you find the magic combination load your own code and take it from there! Simple! :wink:

Thanks Dannable ,that code worked,I just had to change my module with another ditto one. No clue what's wrong with mine.
Also,I had to print "AT" before moving onto "AT+CMGF=1".

Dannable, I've got your code uploaded to my uno with a seeedstudio v2 GPRS shield. It's not responding to AT commands at all. Any idea on how to troubleshoot? Thanks for the help.