Go Down

Topic: GSM and Serial Monitor (Read 3624 times) previous topic - next topic

andber74

Hi,

I used this GSM-Shield:http://www.elecfreaks.com/wiki/index.php?title=EFCom_GPRS/GSM_Shield
I have some problem with sending sms from this example code:

void setup()
{
  Serial.begin(19200);  //Default serial port setting for the GPRS modem is 19200bps 8-N-1

  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
  Serial.read();
  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=\"+919032055002"\r");    //Start accepting the text for the message
  Serial.read();                                   //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
  Serial.read();
  delay(1000);
  Serial.write(26);  //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.


I can send sms using sscom32E(terminal program) but when I monitor the above code using built in serial monitor it just print out the lines without any response from the shield.
When I for example sending AT with sscom32E then the shield response with OK. When I do this with the code nothing happens .
Does any body have an idea what the problem could be.

Regards Andreas

dannable

Which Arduino are you using? You would normally use SoftwareSerial to talk to the GSM board, in this case using D2 & D3, and leave D0 & D1 so you can communicate with  the Arduino using the Serial Monitor. And don't forget the note about using the correct power supply!
Beginners guide to using the Seeedstudio SIM900 GPRS/GSM Shield

andber74

Hi,

Thanks for your reply, I m using Arduino UNO r3. I have also supply my board with 12V 2.5A external power supply.
Some questions I have maybe someone has an answer:

Can I download the code with the shield plugged in to the UNO?
Can I use serial monitor when I am using the USB-cable and using serial.write to the shield?
The jumpers on the shield have I set to D2(TX) and D3(RX) is that rigt for the example code?
Can it has something to do with the enter kommand after the text have bin written to the serial?
When I use sscom32 after I wrote my text for example AT and press enter the shield is respones directly with OK,
the same doesnt happen when the code is written the text.
Has somebody got this to work with this hardware and code?

Regards Andreas

dannable

1) I would upload the code without the shield attached.
2) You don't need to use sscom32, the Serial Monitor will do what you need.

Based on what you have said above, at the top of your sketch add the lines:

#include <SoftwareSerial.h>

SoftwareSerial GSM(3, 2);

And then change every instance of 'Serial.' to 'GSM.'

Then upload and try it.
Beginners guide to using the Seeedstudio SIM900 GPRS/GSM Shield

Go Up