Go Down

Topic: GPRS sheild not working with NewSoftSerial (Read 1 time) previous topic - next topic

lavared

Hi

I bought a GPRS sheild for arduino Uno from seeedstudio (http://www.seeedstudio.com/wiki/index.php?title=GPRS_Shield_v0.9b) and did everything as mentioned in the wiki page. however when i connect the GPRS rx and tx pins to arduino uno pins 7,8 and use the newsoftserial as mentioned, i don't get any response to the AT commands in my terminal program. however if I directly connect these rx,tx pins to hardware rx,tx pins (0,1) on arduino (i.e. hardware urt as mentioned in wiki page link above) i'm able to send SMS messages and the Gprs unit responds to all commands. so the GPRS unit as such is functionning properly but having problems with the newsoftserial connection. Could somebody help me on how to get it working. i have played with different baud rates (4800,9600,19200) but of no use. unfortunately seeedstudio forums are not very helpful on this issue.

Thanks.

48X24X48X

Mind posting up the code when using NewSoftSerial?

lavared

the code I used to test the newsoftserial is given on the wiki page and given below:

Code: [Select]
//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 <NewSoftSerial.h>

NewSoftSerial mySerial(7, 8);

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

void loop()
{
    if(Serial.available())
    {
       mySerial.print((unsigned char)Serial.read());
     } 
    else  if(mySerial.available())
    {
       Serial.print((unsigned char)mySerial.read());
     }   

}


the hardware uart code I used is given below:
Code: [Select]
void setup()
{
  Serial.begin(19200);  //Default serial port setting for the GPRS modem is 19200bps 8-N-1
  Serial.print("\r");
  delay(1000);                    //Wait for a second while the modem sends an "OK"
  Serial.print("AT+CMGF=1\r");    //Because we want to send the SMS in text mode
  delay(1000);

  //Serial.print("AT+CSCA=\"+919032055002\"\r");  //Setting for the SMS Message center number, 
  //delay(1000);                                  //uncomment only if required and replace with
                                                  //the message center number obtained from
                                                  //your GSM service provider.
                                                  //Note that when specifying a tring of characters
                                                  // " is entered as \"

  Serial.print("AT+CMGS=\"+918446043032\"\r");    //Start accepting the text for the message
                                                  //to be sent to the number specified.
                                                  //Replace this number with the target mobile number.
  delay(1000);
  Serial.print("SIM900 and Arduino say Hi!\r");   //The text for the message
  delay(1000);
  Serial.print(26,BYTE);  //Equivalent to sending Ctrl+Z
}

void loop()
{
      //We just want to send the SMS only once, so there is nothing in this loop.
      //If we put the code for SMS here, it will be sent again and again and cost us a lot.
}
[/size]

48X24X48X

Did you add the <CR><LF> characters for each command at the PC side when using the 1st sketch (NewSoftSerial)?

PaulS

Those two sketches do completely different things. They are not interchangeable.

48X24X48X


Those two sketches do completely different things. They are not interchangeable.

I think at their wiki site, the 1st sketch is to test the AT command from the PC site by using the Arduino as a bridge in between.

PaulS

OP seems to think that they are interchangeable, though.

lavared

thanks all,

yeah i did put CR+LF at the end of the commands but nothing happens. Btw the first code's intention is for me to feed the commands through the terminal program and send an SMS that way, whereas the 2nd code does it with the SMS message and number built in.


Go Up