Sim900 and arduino mega

Greetings everyone
I am a newbie here so please forgive any mistakes.
I have recently purchase a Gsm sim900 shield from the following page

http://www.geeetech.com/wiki/index.php/Arduino_GPRS_Shield

and i am not able to make it communicate with my arduino mega board…
I upload the following code that the page provides

//Serial Relay - Arduino will patch a 
//serial link between the computer and the GPRS Shield
//at 19200 bps 8-N-1
//Computer is connected to Hardware UART
//GPRS Shield is connected to the Software UART 
#include <SoftwareSerial.h>
SoftwareSerial GPRS(7, 8);
unsigned char buffer[64]; // buffer array for data recieve over serial port
int count=0;     // counter for buffer array 
void setup()
{
 GPRS.begin(19200);               // the GPRS baud rate   
 Serial.begin(19200);             // the Serial port of Arduino baud rate.
}
void loop()
{
 if (GPRS.available())              // if date is comming from softwareserial port ==> data is comming from gprs shield
 {
   while(GPRS.available())          // reading data into char array 
   {
     buffer[count++]=GPRS.read();     // writing data into array
     if(count == 64)break;
 }
   Serial.write(buffer,count);            // if no data transmission ends, write buffer to hardware serial port
   clearBufferArray();              // call clearBufferArray function to clear the storaged data from the array
   count = 0;                       // set counter of while loop to zero
 }
 if (Serial.available())            // if data is available on hardwareserial port ==> data is comming from PC or notebook
   GPRS.write(Serial.read());       // write it to the GPRS shield
}
void clearBufferArray()              // function to clear buffer array
{
 for (int i=0; i<count;i++)
   { buffer[i]=NULL;}                  // clear all index of array with command NULL
}

and at the serial terminal were i should see the followings

+CFUN: 1
+CPIN: READY
Call Ready

i see NOTHING

is it possible the shield that i bought is not compatible with a mega board,
or the code is missing something?
I also had a look at the softwareserial library but i don’t thing i should change anything there.
Please any suggestions are welcome
thanks in advance.

Suggest you put a Serial.println("Hello World"); or similar at the end of setup() so that you can confirm your sketch is running and you have established serial comms with it.

Also check the pin numbers of the Mega board to see whether the pins you are using for SoftwareSerial are actually the same ones your shield is trying to use. I know the analog pins are numbered differently but I don't know about the digital pins.

Hi peter I added the line you suggested and i can see in deed the message at the terminal, so i'm guessing that the sketch is running. also both pins are in the right position, i'm running out of ideas, What am i doing wrong ?

I have a similar GPRS Shield from SeeedStudio and I fixed it:

you need to modify your program and schematic. 1)Program:SoftwareSerial GPRS(7,8)----SoftwareSerial GPRS(10,11); 2)You need connect pin-7 to pin-10(pin-8 to pin-11) by jumper wire.Because of not all pins on the Mega and Mega 2560 support change interrupts.

https://docs.google.com/drawings/d/1klbSv2Rl4_DlogHlE7_u069hVXnxwSq7gGnid456zrA/edit?pli=1

you need to modify your program and schematic. 1)Program:SoftwareSerial GPRS(7,8)----SoftwareSerial GPRS(10,11); 2)You need connect pin-7 to pin-10(pin-8 to pin-11) by jumper wire.Because of not all pins on the Mega and Mega 2560 support change interrupts.

On the other hand, with 4 hardware serial ports, why are you using software serial at all?

solanoan you fix it! i cannot thank you enough. it works.

Hi PaulS the reason is that i am not that familiar with arduino and coding yet, i know that it needs a lot of studying, and i am on it, if you could refer me to an example about hardware serial connection i would be very greatful

thank you both very much

if you could refer me to an example about hardware serial connection i would be very greatful

The pins for the hardware serial ports are clearly labeled on the Mega. Pick a pair with matching numbers, like TX2 and RX2. Then, remove the #include of the SoftwareSerial header file, and replace all occurrences of GPRS with SerialN, where N matches the TXN and RXN values.

Hi everyone,

This page of the forum helped me a lot. I also have arduino mega 2560 and GSM SIM 900. I could see HELLO WORLD using your code on serial terminal. But i am not getting

+CFUN: 1 +CPIN: READY Call Ready

on the serial terminal

I saw the pin mapping given by solanoan but i am confused with it. Can u elaborate about the pin connection between arduino and modem? Please reply as soon as possible.

hi again everyone

i was wondering if there was a way to read an sms from the above mentioned shield without using any libraries

since it is impossible for me to make the mega, shield and GSM_Shield.h to coop.

i looked all over the net but i could not find a helpful example. pls help

thanks in advance