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
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.
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.