Communicating with IComsat GPRS shield

Hello!
I have serial communication difficulties with SIM900. I’ve went trought google and many forum topics but none of them really solves my problem, so i’m hoping for your advices :slight_smile:
I am using THIS module and connecting it to Arduino MEGA. 19 pin(RX1) of Arduino i connect with moduls TX7 and Arduino 18 pin(TX1) with RX7. Below is the picture showing it.

Bigger picture

Dont worry about power, i also used 72VA power supply, it didnt worked also. Module doesnt need such current as recomennded for serial communication.
Tx from Arduino works because i can make call and send sms, but in serial port monitor i cant see no data coming from SIM900. Baud rate is 19200 for serial port monitor.

As im not sure there’s a problem in programm or hardware. I added my sketch below. Basically there is 4 cases - 2nd case calls and hangs up, in 3rd im asking is there any sms and in 4th case im asking signal quality. In 3rd and 4th case atleast something needs to be showing in serial port monitor but nothing…

I also used lines like this for data reading from SIM900, but none of them worked.

if (mySerial.available())
{
   Serial.write(mySerial.read());
}
if (mySerial.available() > 0)
{
  Serial.println(mySerial.read());
}
if(mySerial.available() >0)
  {
    incoming_char=mySerial.read(); //Get the character from the cellular serial port.
    Serial.print(incoming_char); //Print the incoming character to the terminal.
  }
}

Complete code:

#include <SoftwareSerial.h>

SoftwareSerial mySerial(19, 18);  //Arduino 18 pin(TX1) and 19 pin(RX1)

int LED = 13;

void setup()
{
pinMode(LED, OUTPUT);
Serial.begin(19200);
mySerial.begin(19200);  // the GPRS baud rate   
powerUp();

}

void powerUp()
{
pinMode(9, OUTPUT); 
digitalWrite(9,LOW);
delay(1000);
digitalWrite(9,HIGH);
delay(2000);
digitalWrite(9,LOW);
delay(9000);
Serial.println("Modem powered");
}


void loop()
{
  if (Serial.available())
  {
    char inSer = Serial.read();
    switch (inSer)
    {     
      case '1':      //Just for confirmation that incoming characters from serial port is reading
      digitalWrite(LED, HIGH);
      delay(3000);
      digitalWrite(LED, LOW);
      break;
      
      case '2':
      mySerial.println("ATD + +371200....;"); //Calling to my cell. I just deleted part of my phone number cus i dont want to shove it
      delay(100);
      mySerial.println();
      delay(7000);            
      mySerial.println("ATH");  //Hangup
      break;
     
      case '3':
      mySerial.println("AT+CNMI=?\r");  //asking for new sms message indication
      break;
      
      case '4':
      mySerial.println("AT+CSQ=?\r");  //asking for signal quality report
      break;
    }
  }
if (mySerial.available()) 
{
   Serial.write(mySerial.read());
}  
}

I would be appreciated for help how to show data from SIM900 in serial port monitor.

I see you're using software serial to communicate on hardware serial lines. Don't - it's a pointless waste of time and resources. You don't need SoftwareSerial at all.

Just use Serial1 to communicate on TX1/RX1, Serial2 for TX2/RX2, etc, just as you do with Serial for TX/RX.

What do you mean by don't use Software serial? Then how can i see SIM900 respond on serial terminal?

The mega has 3 serial ports, not 1.

Serial is the TX/RX pins. Serial1 is the TX1/RX1 pins, etc.

void setup() {
  Serial.begin(19200);
  Serial1.begin(19200);
}

void loop() {
  if (Serial.available()) {
    Serial1.write(Serial.read());
  }
  if (Serial1.available()) {
    Serial.write(Serial1.read());
  }
}

SoftwareSerial is very inefficient and should only ever be used if you absolutely have to. With a Mega you very rarely have to.

Thank you, now i see atleast something in serial port monitor

RDY

+CFUN: 1

+CPIN: READY

Call Ready

So that means i had something wrong with software serial.. Do you now how can i send CR(Carriage return) and LF (Line Feed) trought terminal?

Yes - set the line ending to LF, CR or both, whatever takes you fancy. It's in the dropdown list in the window.