Questions on a Seeed studio gprs shield v1.4 11A12

Hello i have Question i have this shield it's a Seeed studio gprs shield v1.4 11A12 there is a button that haves to be pressed to make it work from what I'm reading is there a way to bypass it I want to send text messages to my cellphone from the analog pins of the arduino A0 A1 and A2 i haven't tested anything out yet haven't got my sim chip yet into tomorrow 2/25/14 just trying to get some information together can anyone help me out?

Joseph

Hello I still need some help with this please.

Try writing an intelligible sentence. I cannot understand what your actual problem is.

Hello sorry if i wasn't clear in my other post on this but i figure out how to automatically start the gsm shield by putting D9 pin in sketch to high and that turns on the sim900 module before it use to be i had to push the side of the shield there was a button manually took me days in forum pages to figure that out. But my other Question is i want to send a text message to to turn on a led so if i type in ( Turn on led ) and i send that text to the shield it will turn on the led and reply a text back saying Led is on. Same as if i was turning off the led i send that text ( Turn off Led ) and send it to the shield it will turn off the led and reply back with a text led is off. but i want to also add a gps module same as the led if i type in ( GPS ) and send it to the shield it will get me the Latitude and Longitude of where the device is at and reply a text back saying the Latitude and Longitude how can i do this I do not know how to write a sketch or something for this because i never did a gsm shield before i know simple stuff but that's all i really need help?

Joseph

In very general terms:

First you need to decide how you are going to handle an incoming text. They can either be sent straight to the serial port of the modem, or to memory and a notification that one has been received sent to the serial port.

Once you have decided that you need to tell the modem using the AT+CNMI command.

Then you need to write the code to read the message from your chosen source, and act upon it.

Then send a message back to the sending number using the AT+CMGS command.

If you store the messages in memory you can typically store 50 messages on the sim so you need to consider some sort of housekeeping.

hello thank you for the reply i do not want to store the messages i send from my cellphone to the shield. as for the rest not sure yet still new to this. but thank you for helping me get started.

Joseph

Hello i found a simple Sketch for the gsm to control leds

#include <SoftwareSerial.h>
char inchar; // Will hold the incoming character from the GSM shield
SoftwareSerial SIM900(7, 8);
 
int led1 = 10;
int led2 = 11;
int led3 = 12;
int led4 = 13;
 
void setup()
{
  Serial.begin(19200);
  // set up the digital pins to control
  pinMode(led1, OUTPUT);
  pinMode(led2, OUTPUT);
  pinMode(led3, OUTPUT);
  pinMode(led4, OUTPUT);
  digitalWrite(led1, LOW);
  digitalWrite(led2, LOW);
  digitalWrite(led3, LOW);
  digitalWrite(led4, LOW);
 
  // wake up the GSM shield
  SIM900power();
  SIM900.begin(19200);
  delay(20000);  // give time to log on to network.
  SIM900.print("AT+CMGF=1\r");  // set SMS mode to text
  delay(100);
  SIM900.print("AT+CNMI=2,2,0,0,0\r");
  // blurt out contents of new SMS upon receipt to the GSM shield's serial out
  delay(100);
  Serial.println("Ready...");
}
 
void SIM900power()
// software equivalent of pressing the GSM shield "power" button
{
  digitalWrite(9, HIGH);
  delay(1000);
  digitalWrite(9, LOW);
  delay(7000);
}
 
void loop()
{
  //If a character comes in from the cellular module...
  if(SIM900.available() >0)
  {
    inchar=SIM900.read();
    if (inchar=='#')
    {
      delay(10);
 
      inchar=SIM900.read();
      if (inchar=='a')
      {
        delay(10);
        inchar=SIM900.read();
        if (inchar=='0')
        {
          digitalWrite(led1, LOW);
        }
        else if (inchar=='1')
        {
          digitalWrite(led1, HIGH);
        }
        delay(10);
        inchar=SIM900.read();
        if (inchar=='b')
        {
          inchar=SIM900.read();
          if (inchar=='0')
          {
            digitalWrite(led2, LOW);
          }
          else if (inchar=='1')
          {
            digitalWrite(led2, HIGH);
          }
          delay(10);
          inchar=SIM900.read();
          if (inchar=='c')
          {
            inchar=SIM900.read();
            if (inchar=='0')
            {
              digitalWrite(led3, LOW);
            }
            else if (inchar=='1')
            {
              digitalWrite(led3, HIGH);
            }
            delay(10);
            inchar=SIM900.read();
            if (inchar=='d')
            {
              delay(10);
              inchar=SIM900.read();
              if (inchar=='0')
              {
                digitalWrite(led4, LOW);
              }
              else if (inchar=='1')
              {
                digitalWrite(led4, HIGH);
              }
              delay(10);
            }
          }
          SIM900.println("AT+CMGD=1,4"); // delete all SMS
        }
      }
    }
  }
}

when uploading it and it takes when i try the commands nothing happens.

can someone help me out I'm not very good with coding.

\I don't know but if this helps i do not have a uno right now It's on a mega. don't know if that will work differently or not?

You are using the SoftwareSerial library to communicate with the SIM900 via pins 7 & 8. I found the following on the Software Serial page:

Not all pins on the Mega and Mega 2560 support change interrupts, so only the following can be used for RX: 10, 11, 12, 13, 14, 15, 50, 51, 52, 53, A8 (62), A9 (63), A10 (64), A11 (65), A12 (66), A13 (67), A14 (68), A15 (69).

Not 7 & 8.

I don't know if your SIM900 has the facility to use pins 0 & 1, then you can use Serial to talk to it, but you can't then communicate with the PC you are using.

hello thank you for the reply this is the one i do have http://www.seeedstudio.com/wiki/GPRS_Shield_V1.0 sense I'm new to GSM stuff this i have no clue all i want to do right now is control 4 leds to turn then off and on that's all. i no longer have my uno so I'm stuck with a mega 2560 i do have.

Joseph

I'm not at home at the moment so I can't check things for myself, but by the look of it there are a couple of jumpers next to aerial connector which I think allow you to select the serial connection.

when i change the pins over to the left and try to upload the code i get a error from software

Binary sketch size: 7,128 bytes (of a 258,048 byte maximum)
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: verification error, first mismatch at byte 0x0a00
0x20 != 0x00
avrdude: verification error; content mismatch

but if i put the pins back and upload the sketch it takes but nothing happens.

Upload the sketch to the Mega before you attach the shield.

yeah that didn't make no difference i don't know if it's the sketch or library or what it is but no changes at all.

I found a sketch that did work it send a text message to my cellphone

#include <SoftwareSerial.h>
SoftwareSerial GPRS(7, 8);

void setup()
{
  GPRS.begin(19200);// the GPRS baud rate   
  Serial.begin(19200);// the Serial port of Arduino baud rate.
  
   // attach to GPRS service 
   GPRS.println("AT+CPAS?");//Check Phone Status
   delay(2000);
   
  if (GPRS.available()>0)  // Check to see if GPRS Shield is on
  {
    toSerial(); //print response to serial
  }
  else { //Turn on shield if it is off
    powerUpOrDown();
    delay(2000);
  }
  
  // bearer settings
  GPRS.println("AT+SAPBR=3,1,\"CONTYPE\",\"GPRS\"");
  delay(1000);
  toSerial();
  
  //Replace "epc.tmobile.com" with APN of your provider
  GPRS.println("AT+SAPBR=3,1,\"APN\",\"epc.tmobile.com\"");
  delay(4000);
  toSerial();
   
  // bearer settings
  GPRS.println("AT+SAPBR=1,1");
  delay(2000);
  toSerial();

}
 
void loop()
{
  GPRS.println("AT+CMGF=1"); //Tell SIM 900 you are about to send a text
  delay(100);
  GPRS.println("AT + CMGS = \"5554443333\""); //Replace with number to text
  delay(100);
  GPRS.println("This is your text message");//Replace with your message
  delay(100);
  GPRS.println((char)26); //tells sim900 to send text
  delay(100); 
  toSerial();
  delay(60000); //wait one min to not flood your phone

}

void toSerial() //Write SIM 900 response to serial
{
while(GPRS.available()!=0)
{
Serial.write(GPRS.read());
}
}
 
void powerUpOrDown() //Power off or on GPRS Shirld
{
pinMode(9, OUTPUT);
digitalWrite(9,LOW);
delay(1000);
digitalWrite(9,HIGH);
delay(2000);
digitalWrite(9,LOW);
delay(3000);
}

and this is the code that doesn't work

#include <SoftwareSerial.h>
char inchar; // Will hold the incoming character from the GSM shield
SoftwareSerial SIM900(7, 8);
 
int led1 = 10;
int led2 = 11;
int led3 = 12;
int led4 = 13;
 
void setup()
{
  Serial.begin(19200);
  // set up the digital pins to control
  pinMode(led1, OUTPUT);
  pinMode(led2, OUTPUT);
  pinMode(led3, OUTPUT);
  pinMode(led4, OUTPUT);
  digitalWrite(led1, LOW);
  digitalWrite(led2, LOW);
  digitalWrite(led3, LOW);
  digitalWrite(led4, LOW);
 
  // wake up the GSM shield
  SIM900power();
  SIM900.begin(19200);
  delay(20000);  // give time to log on to network.
  SIM900.print("AT+CMGF=1\r");  // set SMS mode to text
  delay(100);
  SIM900.print("AT+CNMI=2,2,0,0,0\r");
  // blurt out contents of new SMS upon receipt to the GSM shield's serial out
  delay(100);
  Serial.println("Ready...");
}
 
void SIM900power()
// software equivalent of pressing the GSM shield "power" button
{
  digitalWrite(9, HIGH);
  delay(1000);
  digitalWrite(9, LOW);
  delay(7000);
}
 
void loop()
{
  //If a character comes in from the cellular module...
  if(SIM900.available() >0)
  {
    inchar=SIM900.read();
    if (inchar=='#')
    {
      delay(10);
 
      inchar=SIM900.read();
      if (inchar=='a')
      {
        delay(10);
        inchar=SIM900.read();
        if (inchar=='0')
        {
          digitalWrite(led1, LOW);
        }
        else if (inchar=='1')
        {
          digitalWrite(led1, HIGH);
        }
        delay(10);
        inchar=SIM900.read();
        if (inchar=='b')
        {
          inchar=SIM900.read();
          if (inchar=='0')
          {
            digitalWrite(led2, LOW);
          }
          else if (inchar=='1')
          {
            digitalWrite(led2, HIGH);
          }
          delay(10);
          inchar=SIM900.read();
          if (inchar=='c')
          {
            inchar=SIM900.read();
            if (inchar=='0')
            {
              digitalWrite(led3, LOW);
            }
            else if (inchar=='1')
            {
              digitalWrite(led3, HIGH);
            }
            delay(10);
            inchar=SIM900.read();
            if (inchar=='d')
            {
              delay(10);
              inchar=SIM900.read();
              if (inchar=='0')
              {
                digitalWrite(led4, LOW);
              }
              else if (inchar=='1')
              {
                digitalWrite(led4, HIGH);
              }
              delay(10);
            }
          }
          SIM900.println("AT+CMGD=1,4"); // delete all SMS
        }
      }
    }
  }
}

trying to control 4 leds using text messages can you help i have no clue i try to mod the good code with some of the led control from the bad code and no luck.

The first version sent a message? Using a Mega?

Can you post a photo of your setup?

Hello this is the images sorry was with my family this 2 images are how i have it setup only right now on 2 leds on A0 and A1. but want to control 4 leds. Also it's on a mega 2560.

Joseph

the other reply with the two sketches are the one i tried first one works sending me a text message to my cellphone with no problem second one trying to control the leds doesn't work.

First of all you cannot run the SIM900 from the USB power supply. It draws, at peak, about 2amps, you can only get 500mA from the USB connection.

And if you are going to persist in trying to use SoftwareSerial all you are proving is that the quote in reply #8 is correct. You cannot use pins 7 or 8 for RX. So from your results you can talk to the SIM900 (Transmit) but not listen (Receive).

Also if you insist on using the Mega instead of the Uno then you will have to use pins 0 & 1 to talk to the SIM900. The trouble with this is that you will be flying blind - you cannot talk to two devices on one serial connection, so you cannot use the Serial monitor to help debug what is going on.

The following code works (I've just chopped up what you posted.). Upload it to the Mega without anything connected, on the SIM900 board move the two jumpers across as I suggested earlier and plug it into the Mega. Then connect your LED and suitable power supply (I use two, a 9V one for the Arduino and a 5V one for the SIM900 board. If you do then make sure you don't mix them up. ) and move the power switch into the appropriate position.

Send a text #a1 to turn the LED on pin 10 on, #a0 to turn it off.

char inchar; // Will hold the incoming character from the GSM shield

int led1 = 10;

void setup()
{
  // set up the digital pins to control
  pinMode(led1, OUTPUT);
  digitalWrite(led1, LOW);

  // wake up the GSM shield
  SIM900power();
  Serial.begin(19200);
  delay(20000);  // give time to log on to network.
  Serial.print("AT+CMGF=1\r");  // set SMS mode to text
  delay(100);
  Serial.print("AT+CNMI=2,2,0,0,0\r");
  // blurt out contents of new SMS upon receipt to the GSM shield's serial out
  delay(100);
}

void SIM900power()
// software equivalent of pressing the GSM shield "power" button
{
  digitalWrite(9, HIGH);
  delay(1000);
  digitalWrite(9, LOW);
  delay(7000);
}

void loop()
{
  //If a character comes in from the cellular module...
  if(Serial.available() >0)
  {
    inchar=Serial.read();
    if (inchar=='#')
    {
      delay(10);

      inchar=Serial.read();
      if (inchar=='a')
      {
        delay(10);
        inchar=Serial.read();
        if (inchar=='0')
        {
          digitalWrite(led1, LOW);
        }
        else if (inchar=='1')
        {
          digitalWrite(led1, HIGH);
        }
        delay(10);
        //  SIM900.println("AT+CMGD=1,4"); // delete all SMS
      }
    }
  }
}