Help me with communication between Arduino with Wavecom Q2303A GSM modem!:)

Guys,i need help with my project
I have connected my arduino AtMega328 to Wavecom Q2303A GSM Modem using rs232 level converter(RS232 Communication - The Level Conversion - eXtreme Electronics),but i still can't configure my gsm modem to send SMS to my desired phone number.I'm using arduino 1.0 btwFollowing is my coding for the project:

#include <SoftwareSerial.h>

const int rxpin = 2; // pin used to receive
const int txpin = 3; // pin used to transmit
SoftwareSerial gsm(rxpin, txpin); // new serial port on pins 2 and 3
char phoneNumber[] = "0128950630";
void setup()
{
Serial.begin(9600); // 9600 baud for the built-in serial port
gsm.begin(9600); //initialize the software serial port also for 9600
delay(35000);
}
void loop()
{

gsm.println("AT");
delay(500);
gsm.println("AT+CMGF=1"); // set SMS mode to text
delay(500);
gsm.print("AT+CMGS="); // now send message...
gsm.write((byte)34);// ASCII equivalent of "
gsm.print(phoneNumber);
gsm.write((byte)34); // ASCII equivalent of "
gsm.println();
delay(500);
gsm.print("Hello, This is your Arduino"); // our message to send
gsm.write((byte)26); // ASCII equivalent of Ctrl-Z
// this will send the following to the GSM module
// on the Cellular Shield: AT+CMGS=”phonenumber”
// message<CTRL+Z>
gsm.println();
delay(15000); // The GSM module needs to return to an OK status

{
delay(1);
}
while (1>0); // if you remove this you will get a text message every 30 seconds or so.
}

I have connected Tx and Rx wire from the rs232 level converter to pin 2 and pin 3 of the arduino respectively,is this correct? Can anyone point out what's wrong with my coding?

Your code sends commands to the phone but never reads anything the phone sends so there is no way to see if the phone is responding as expected.

Try echoing the output of the phone to the Serial Monitor after each command:

delay(500); //  You already have this
while(gsm.available())
    Serial.write((byte)gsm.read());
Serial.println();

I have changed my coding as following but still can't get see any words in hyperterminal,and there's still no SMS received..any clue?

#include <SoftwareSerial.h>

const int rxpin = 2; // pin used to receive 
const int txpin = 3; // pin used to transmit 
SoftwareSerial gsm(rxpin, txpin); // new serial port on pins 2 and 3
char phoneNumber[] = "0128950630";
void setup()
{
Serial.begin(9600); // 9600 baud for the built-in serial port
gsm.begin(9600); //initialize the software serial port also for 9600
delay(35000);
}
void loop()
{  

gsm.println("AT");
while(gsm.available())
    Serial.write((byte)gsm.read());
Serial.println();
delay(500);
gsm.println("AT+CMGF=1"); // set SMS mode to text
while(gsm.available())
    Serial.write((byte)gsm.read());
Serial.println();
delay(500);
gsm.print("AT+CMGS="); // now send message...
gsm.write((byte)34);// ASCII equivalent of "
gsm.print(phoneNumber);
gsm.write((byte)34); // ASCII equivalent of "
gsm.println();
while(gsm.available())
    Serial.write((byte)gsm.read());
Serial.println();
delay(500);
gsm.print("Hello, This is your Arduino"); // our message to send
gsm.write((byte)26); // ASCII equivalent of Ctrl-Z
// this will send the following to the GSM module
// on the Cellular Shield: AT+CMGS=”phonenumber”<CR>
// message<CTRL+Z><CR>
gsm.println();
while(gsm.available())
    Serial.write((byte)gsm.read());
Serial.println();
delay(15000); // The GSM module needs to return to an OK status

{
delay(1);
}
while (1>0); // if you remove this you will get a text message every 30 seconds or so.
}

Since your GSM module is not responding it may not be in command mode. Is there anything in the manual about switching to command mode? Typically it's somethung like:

delay(1000);
gsm.write("$$");
while(gsm.available())
    Serial.write((byte)gsm.read());
Serial.println();

Command mode?I thought it will automatically receive and interpreted AT-command,no?Btw,here's the manual of the modem http://www.ozeki.hu/attachments/588/M1206B_Manual.pdf

See section 4.1.3 of the manual. It says the baud rate is 115200, not 9600. Try that.

i have tried 115200 on hyperterminal,i can't see anytime i type in hyperterminal.Instead when i choose 9600,i was able to send AT command to Gsm modem.Weird right?

xemse89:
i have tried 115200 on hyperterminal,i can't see anytime i type in hyperterminal.Instead when i choose 9600,i was able to send AT command to Gsm modem.Weird right?

Were you able to get responses back?

Yeah!i solved it already,apparently i had wrongly constructed the circuit for rs232,i fixed it and it is working now!Nevertheless,many thanks to johnwasser who have helped me during the process!Thx dude!

Hi!

I'm also working on similar project and I also have some problems... :frowning:
When I send AT to gsm modem I don't get an answer at all, and when I send some other commands I get some strange signs..

I also tried your code and result is the same.

So, my questions are did you use baud rate 9600 or some other and did you use cts and rts signals?

Also other suggestions are welcome!

Thanks in advance!

Must read this stuff.....

it might be useful...

Ho di you do it? xemse89
I need your help.