Go Down

Topic: Help for SIM900A v3.8.2 (Read 7988 times) previous topic - next topic

nouamaneayadi

Hi frinedsi have a module GSM SIM900A v3.8.2. but how i can send a SMS to any phone mobile using Arduino uno,
I tried a lot code but he does not working for me, please i need your help for this projet, give me the solution if you can.
Thank you.

dannable

You could start by telling what code you have used, what happened, and a nice, clear, sensibly sized photo of your set up.

And don't post your question in more than once. See the post at the top of this section on 'How to use this forum'.

Beginners guide to using the Seeedstudio SIM900 GPRS/GSM Shield

nouamaneayadi

I use this code but it is not working


Please note: I am based in the UK and the following works with Orange and O2 pre-pay sim cards. The situation where you are may be different!

The Seeedstudio SIM900 based GSM/GPRS shield for Arduino is a popular and easy to use accessory. However, it can be daunting to first time users so here is my simple guide to getting things working. We first check that we can communicate with the shield, and then we will turn a LED, connected to D10, on and off using text messages / SMS. Perhaps at this stage I should mention that this is just a demonstration of how to achieve this, and is not representative of best programming practice. In the real world, don't use delay()!

Power

Despite what is written in the specifications the SIM900 can momentarily draw about 2 amps when operating. The USB power supply to the Arduino will not suffice! For development work I have a 5 volt 2 amp power supply plugged into the shield, and a separate 9 volt 1 amp power supply into the Arduino. Set the power select switch to the appropriate position, either Xduino or Ext.

 

Operation

Once the shield has been powered up and completed its self check it will start to search for a network signal. During this process the NetLight indicator will blink rapidly, once a second. When a signal is acquired it will then blink once every three seconds.

Preparing

So we need a robust power supply, an unlocked SIM card, our shield, an LED with an appropriate resistor and our Arduino of choice.

Power up

Our first decision is do we want to enable software power control? Initially this might not sound like a difficult decision but think about it for a moment. The same procedure will turn the shield on if it is off and off if it is on. So, if, when you are testing, you reset your Arduino without turning off the shield then it will send the power on/off command and turn the the shield off. So I would suggest that until you are comfortable with the shield leave the pad near pins D8 & D9 (illustrated below) unsoldered and use the PWRKEY switch to turn it on or off.

 

When your project is up and running you may want to incorporate software control. If so, solder the two pads together and add the following section to your code:

void powerUp()
{
  pinMode(9, OUTPUT);
  digitalWrite(9,LOW);
  delay(1000);
  digitalWrite(9,HIGH);
  delay(2000);
  digitalWrite(9,LOW);
  delay(3000);
}

And then put a call to the procedure in setup().

Arduino Uno (etc)

Using the shield with the Uno is comparatively straight forward. We can use the USB connection to communicate with the board, and use SoftwareSerial on pins D7 & D8 to communicate with the shield. Ensure that the jumpers, adjacent to the aerial connector, are to the right as per the main illustration.

Check that it works

The first job is to ensure that we can communicate with the shield. To do that we will use a fairly common piece of software called Serial Relay (sadly I don't know who wrote it to give credit). This piece of software relays any commands sent from the Serial Monitor to the Arduino on to the SIM900, and sends anything from the SIM900 to the Arduino on to the Serial Monitor. Don't worry about the 8-N-1, that is the default setting, and if you have been playing with that you probably don't need to be reading this introduction!

I have removed quite a lot of the original comments. If you don't understand how it works there are several versions on the internet.

//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 GPRS(7, 8);

unsigned char buffer[64];  // buffer array for data receive over serial port
int count=0;               // counter for buffer array

void setup()
{
  GPRS.begin(19200);
  Serial.begin(19200);
}

void loop()
{
  if (GPRS.available())
  {
    while(GPRS.available())
    {
      buffer[count++]=GPRS.read();
      if(count == 64)break;
    }
    Serial.write(buffer,count);
    clearBufferArray();
    count = 0;
  }
  if (Serial.available())
    GPRS.write(Serial.read());
}

void clearBufferArray()
{
  for (int i=0; i<count;i++)
  {
    buffer=NULL;
  }
}

dannable

I can't see a photo of your setup.
Beginners guide to using the Seeedstudio SIM900 GPRS/GSM Shield

nouamaneayadi

i have this GSM module
http://s1.electrodragon.com/wp-content/uploads/2014/09/SIM900A-Mini-03.jpg

and:
i dont know where is it the RX;TX pins;

please give me example for send sms to another phone and show me RX;TX pins

dannable

This guy seems to have it worked out? 
Beginners guide to using the Seeedstudio SIM900 GPRS/GSM Shield

nouamaneayadi

sir i use this code but it is not uploaded to ARDUINO UNO

CODE:


#include <SoftwareSerial.h>
SoftwareSerial SIM900(0, 1);
 #include <string.h>

void setup()
{
  SIM900.begin(9600);
  delay(1000);
  pinMode(6,OUTPUT);
  digitalWrite(6,HIGH);
  delay(5000);
  digitalWrite(6,LOW);
 
 
}
 

 

 
void loop()
{
 
  sendSMS();
  do {} while (1);
}


void SIM900off()
// software equivalent of pressing the GSM shield "power" button
{
  Serial.println("apagando");
  digitalWrite(6, LOW);
  delay(1200);
}
void sendSMS()
{
 
  SIM900.println("AT+CPIN=4785\r\n"); // PIN
  delay(1000);
 
  SIM900.println("AT+CMGF=1\r");                                                        // AT command to send SMS message
  delay(100);
  SIM900.println("AT + CMGS = \"+212673924228\""); // 0034 615075326                                    // recipient's mobile number, in international format
  delay(100);
  SIM900.println("Hello, world. This is a text message from an Arduino Uno.");        // message to send
  delay(100);
  SIM900.println((char)26);                       // End AT command with a ^Z, ASCII code 26
  delay(100);
  SIM900.println();
  delay(10000);                                     // give module time to send SMS
  SIM900off();                                   // turn off module
}

dannable

Code: [Select]
#include <SoftwareSerial.h>
SoftwareSerial SIM900(0, 1);


If you are using an Uno then D0 & D1 are the hardware serial pins. No need to use SoftwareSerial. You use SoftwareSerial on other pins, leaving those two free for serial monitor, if required.

If you have anything connected to pins D0 & D1 then it will probably cause you problems as these are the pins used by the Uno to upload your sketch.
Beginners guide to using the Seeedstudio SIM900 GPRS/GSM Shield

nouamaneayadi

I use this code but it is not working for me. i dont know why
the probleme in this picture:
http://www.m5zn.com/newuploads/2016/02/17/png//feb2139c548b4b5.png

mdahlb

Did you establish a connection? Some of the SIM900A are locked to the Asien country and you have to unlock it by flashing the new firmware.

Please let me now if you progress..

Go Up