Sending AT commands through serial monitor

I’m using the Arduino Uno board with Quectel M10 GPRS shield. I want to send AT commands through the serial monitor. I load the following code and send AT commands through the serial monitor. I dont see the AT command sent or response received on the serial monitor output window. Any help is appreciated…

/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 mySerial(2,3);

void setup()
{
mySerial.begin(19200); // the GPRS baud rate
Serial.begin(19200); // the GPRS baud rate
}

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

}

I suggest you add a Serial.println() call in setup() so you can confirm that the USB serial connection is working correctly. I don't see anything wrong with the code, so I suggest you double check the connections to the modem and the serial settings. Have you check that the pins used for mySerial are the correct way round wrt the wiring connections? How do you know that the modem is using 19200 bps? If there's any possibility that it's starting off at another speed, or with different serial settings, try changing the mySerial setup to see if you can get a response from it.

Also, please correct the bogus comment in setup(). :)

PeterH,
You were correct. The modem was set at 9600 baud, that’s why I wasn’t getting any response. Once I fixed that as shown below, AT communication is working fine now… Thanks for your help…

/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 mySerial(2,3);

void setup()
{
mySerial.begin(9600);
Serial.begin(9600);
}

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

}

Hi, I have a problem with gprs modem.
I’m using gprs Maestro 100 evo. I have set this modem(AT command) using hyperterminal then the connection established (between modem and virtual serial port in PC) but when I am going to send data, PC can’t read it.
these my program

#include <SoftwareSerial.h>

SoftwareSerial gprs(6, 5);

void setup()
{
gprs.begin(9600);
delay(20000);

gprs.println(“AT+IPGPRS=1”);
gprs.println(“AT+IPGPRS=1,“APN””);
gprs.println(“AT+IPGPRS=1,“APN”,“user name””);
gprs.println(“AT+IPGPRS=1,“APN”,“user name”,“password””);
gprs.println(“AT+IPTCP=89,“ip””);
gprs.println(“AT+AUTOTCP=1”);
}

void loop()
{gprs.println(“A”); // send character A to PC
delay(5000);
}

Help me please!

Perhaps you ought to read and display the responses from the modem, in case any of your AT commands are failing.

I'm using a Sierra Wireless FXT009 to send AT Commands to the Arduino. I used m2msupport's code so that I can monitor whether the the arduino is receiving successfully. I have it connected using a Max232 to pins 2 and 3 (Software Serial Pins).

When I open the serial monitor all I see is garbage, unreadable symbols, but I can tell it's receiving the data because there is a 20 second gap between automatic acknowledgements from the modem. It's just that this data arrives unreadable. There's no problem when you connect the modem directly to the PC. I checked the baud rate and even changed the modem's baud rate to 9600, still didn't help.

Any ideas on what the problem could be?

I think I think I would try getting the GPS info returned to main program loop from GPS object.

THEN println it out to monitor.

This SKETCH is useful, identifying to the terminal with keypress.

The GPS object likely needs to inherit the print object.

-

/*
  SerialEcho
 Echos a char value sent via USB input back to the terminal application.
 Initializes returning first keypress as identifier string.

 */

int charVal;
void setup() {
  Serial.begin(9600);
  splash();
}

void splash(){
  
  while (!Serial.available()){
  }
  Serial.println("ARDUINO XMEGA_2560");

}

void loop() {
  
  if (Serial.available()){
    charVal = Serial.read();
  }
  
  if (charVal){
      digitalWrite(13, HIGH);   // set LED on
      delay(5);              // wait
      Serial.write(charVal); 
      Serial.write(32); // Added a space here to make echo obvious 
      charVal = 0;
      digitalWrite(13, LOW);    // set LED off
      delay(5);              // wait
     }
  }

Can anyone tell me how can I send sms to many numbers at once? im sending through java… Can send to one number at once… when I try to send many numbers. sms is going for just 2 or 3 numbers… how can I send many sms at once?

sham999: Can anyone tell me how can I send sms to many numbers at once? im sending through java.. Can send to one number at once.. when I try to send many numbers. sms is going for just 2 or 3 numbers... how can I send many sms at once?

This doesn't seem related to the original question and I think you're hijacking the thread. If you have a new question, start your own thread. If you want help with a problem in your code, you will need to post the code which demonstrates the problem.

hi everyone

My Aim is to Establish a communication between Arduino Uno and gsm/gprs Modem.

for this i am sending AT commands using the following code and i am expecting the acknowledgement from the gsm/gprs modem

i am using the gsm/gprs modem which is from the below link

http://entesla.com/easy-sim-gsm-gprs?filter_name=gsm

this is the code that i am using

//the modem is connected to the Tx(pin 1) and Rx(pin 0) pins of the Arduino 

void setup()
{
  Serial.begin(9600);
  Serial.println("Setup is Ready");  
}
 
void loop()
{
   Serial.println("AT");
   delay(1000);
   if(Serial.available() > 0)
   {
     Serial.println("Data received");
     Serial.write(Serial.read()); 
   }

}

the problem is it is printing the AT in serial terminal but it is not receiving any reply from the modem…

→ is there any mistake in my code ??? or am i missing something???

anyone who is reading this post please help me out…

Thanks in advance…

-> is there any mistake in my code ??? or am i missing something???

Yes, there is. Are you using the Serial instance to talk to the PC or to talk to the modem? "Yes" is the wrong answer. So is "both".

Well, it might be your answer, but it is the root of your problem.

Hi paulS thanks for the reply

the GSM/GPRS Modem that i have is in the following link

http://entesla.com/easy-sim-gsm-gprs?filter_name=gsm

this modem has only TTL interface only.

i will tell you exactly what i did.

Connections that i did.. -> i've connected the Arduino Tx(pin 1) to Rx pin of the modem and Arduino Rx(pin 0) to Tx pin of the modem. -> and i am using the USB cable to power up and i think i can use the same cable to watch the serial communication also..

this the setup..

this setup is ok or do i need to connect more????

is there any mistake that i did in the setup??? please help me out...

-> i've connected the Arduino Tx(pin 1) to Rx pin of the modem and Arduino Rx(pin 0) to Tx pin of the modem.

You can use those pins to talk to the modem. But you can't then use them to talk to the USB-to-serial chip that communicates with the PC via the USB cable.

this setup is ok or do i need to connect more????

No, and yes.

The yes part is that you need to connect power and ground, too.

The no part is that you need to connect the Rx and Tx pins to other pins on the Arduino, and use SoftwareSerial to talk to the modem.

the theory you said i understood, but the setup is bit confusing..

-> i will use the Software serial to communicate with the Modem it is ok.. -> you are saying that use Arduino Tx and Rx pins to communicate with the pc it is confusing do i need to connect to these pins or through USB interface can i use these with out connecting ????

you are saying that use Arduino Tx and Rx pins to communicate with the pc it is confusing do i need to connect to these pins or through USB interface can i use these with out connecting ????

The Arduino team already made the connections....

Does the extra punctuation really help?

Digital pins 0 & 1 to are used by the Arduino to communicate with your computer (Serial.). Use SoftwareSerial and two other pins to talk to the modem.

hi dannable and paulS
thanks for the reply and suggestions…

the following is the code that i modified as per your suggestions

#include <SoftwareSerial.h>
 
SoftwareSerial mySerial(2,3);  //Rx,Tx
 
void setup()
{
  mySerial.begin(9600);                 
  Serial.begin(9600);                 
}
 
void loop()
{
  mySerial.println("AT"); // sending "AT" command
 
  while(!(mySerial.available() > 0));
    Serial.println(mySerial.read()); //expected reply "OK"  
}

and these are the connections

→ Tx pin of modem to Rx(pin-2 ) of softwareserial.
→ Rx pin of modem to Tx(pin-3) of softwareSerial.
→ power supply to the modem from arduino.

problem
this time i not getting anything in the serial monitor…
i tried to replace the “println” with “write” also but still nothing in serial monitor…

the connections and programs are ok?? (or) still am i doing any mistakes?? suggest me any changes???

hi hi dannable and paulS

now i am getting the output by using the modified code.. the problem is in my modem i figured it out Thanks for your suggesions ..

Could you tell us what the problem was for future reference?

Hi, i have problem with AT command, it do not have any reply after i follow the instruction above… May i know what is the problem? After key in the command and click send, it do not have any response. Anyone can help? ><