Go Down

Topic: Problem connecting Arduino Uno R3 to SIM900 GPRS/GSM shield and sending an SMS (Read 3666 times) previous topic - next topic

Far27

Hello everyone,
I am a newbie trying to get my hands on working with Arduino Uno R3 and Arduino GPRS/GSM SIM900 Shield. I have connected the two devices based on the recommendations I got from results from google search. I have also implemented some of the steps I saw on this forum but none has worked form me. I have not worked with electronics before.
The devices are using are Arduino Uno R3 and Arduino GPRS/GSM Shield .
Including SIM card and jumper wires
1. I am using a Windows 10 OS on a HP laptop.
2. I configured my Arduino Uno R3 COM port to use 19200 baud rate from Device Manager.
3. I also made sure my Arduino Uno R3 IDE is  using the same COM port.
4. I have connected my devices and  I have also included the images of my connection as attachment.
5. I am using a 9v 2a power adapter to power the SIM900 and usb for Arduino Uno R3.

Please I will like to know if my connection is correct?

I tried send a message using a piece of code I copied from a pdf I got while search for materials and I have the code here

Code: [Select]
#include <SoftwareSerial.h>

SoftwareSerial GPRS(7, 8);         //7 = TX, 8 = RX
unsigned char buffer[64];
int port = 11;
int count=0;     
int i = 1;                         //if i = 0, send SMS.
void setup(){
  //delay(10000);
  GPRS.begin(19200);               // the GPRS baud rate   
  Serial.begin(19200);             // the Serial port of Arduino baud rate.
  Serial.print("I'm ready");
  Serial.print("Hello?");
}

void loop(){
  if (GPRS.available()){         // if date is comming from softwareserial port ==> data is comming from gprs shield

    while(GPRS.available()){          // reading data into char array
      buffer[count++]=GPRS.read();     // writing data into array
      if(count == 64)break;
    }
  Serial.write(buffer,count);            // if no data transmission ends, write buffer to hardware serial port
  clearBufferArray();              // call clearBufferArray function to clear the storaged data from the array
  count = 0;                       // set counter of while loop to zero
}

if (Serial.available())            // if data is available on hardwareserial port ==> data is comming from PC or notebook
  GPRS.write(Serial.read());       // write it to the GPRS shield
  if(i == 0){
    GPRS.print("AT+CMGF=1\r"); //sending SMS in text mode
    Serial.println("AT+CMGF=1\r");
    delay(1000);
    GPRS.print("AT+CMGS=\"+2347xxxxxxxx\"\r"); // phone number
    Serial.println("AT+CMGS=\"+2347xxxxxxxx\"\r");
    delay(1000);
    GPRS.print("Test\r"); // message
    Serial.println("Test\r");
    delay(1000);
    GPRS.write(0x1A); //send a Ctrl+Z(end of the message)
    delay(1000);
    Serial.println("SMS sent successfully");
    i++;
  }   
}

void clearBufferArray(){              // function to clear buffer array
  for (int i=0; i<count;i++){
    buffer[i]=NULL;                  // clear all index of array with command NULL
  }
}



When I upload the sketch the my Arduino Uno R3 I get
I'm readyHello?

I have attached my connection for inspection.
Please I need help with this problem.
Thanks.

dannable

I can't see much in your photo, to small, washed out and out of focus I'm afraid.

Take a look at the link in my signature which covers connecting a similar shield.
Beginners guide to using the Seeedstudio SIM900 GPRS/GSM Shield

Far27

Thanks dannable for your swift response. I have seen that page before and I have read through it again I tried the serial test communication on that page, but I didn't an Ok. This is the link to the connection I am using.

https://arduino.stackexchange.com/questions/9483/how-to-communicate-the-arduino-board-with-sim900

dannable

Even the photo on SE isn't good enough to read the printing on the pcb.
Beginners guide to using the Seeedstudio SIM900 GPRS/GSM Shield

Far27

Please this is my connection I will like you to have a look at and advice me.

lastchancename

Before getting your SMS to run - load up a simple local echo program to send your typing to the modem and vice versa.  That will let you know you have communication tot he modem.

You can check the modem connection status, etc

After that - you can start faffing around with a functional sketch code, but always keep that echo code nearby so you can see what is expected & returning.
Q: How many searches did you make before posting this question?      A: none
At the very least, take a guess at the solution, then we can help move forward from what you know already.

dannable

I've found a similar board to yours and the first thing I note is where you have your Rx/Tx connections. Try connecting to D7 & D8 on the SIM900 board (assuming that you have the two jumpers near the aerial set to use D7 & D8, and that is how it appears.).
Beginners guide to using the Seeedstudio SIM900 GPRS/GSM Shield

Far27

Before getting your SMS to run - load up a simple local echo program to send your typing to the modem and vice versa.  That will let you know you have communication tot he modem.

You can check the modem connection status, etc

After that - you can start faffing around with a functional sketch code, but always keep that echo code nearby so you can see what is expected & returning.
Thanks for your response. Please I don't know how to load a simple echo program I am pretty new to using Arduino and SIM900 GSM Shield. Is there any example sketch I can use to do that and how can I check modem status please?

dannable

Serial Relay sketch

Code: [Select]
// Serial Relay - Arduino will patch a
// serial link between the computer and the GPRS Shield
// at 19200 bps 8-N-1

#define RxPin 7
#define TxPin 8

#include <SoftwareSerial.h>

SoftwareSerial GPRS(RxPin, TxPin); // RX, TX

void setup()
{
  pinMode(13, OUTPUT); // Turn off pin 13
  digitalWrite(13,LOW); 
  GPRS.begin(19200);
  Serial.begin(19200);
}

void loop()
{
  if (GPRS.available())
  {
    while(GPRS.available())
    {
      Serial.write(GPRS.read());
    }
  }
  if (Serial.available())
  {
    while(Serial.available())
    {
      GPRS.write(Serial.read());
    }
  }
}


Open serial monitor and make sure the baud rate is set to 19200. Type AT (return) and it sound echo in the main screen AT OK.
Beginners guide to using the Seeedstudio SIM900 GPRS/GSM Shield

Far27

I've found a similar board to yours and the first thing I note is where you have your Rx/Tx connections. Try connecting to D7 & D8 on the SIM900 board (assuming that you have the two jumpers near the aerial set to use D7 & D8, and that is how it appears.).
Thanks dannable once more. I have tried several connections on the SIM900 board. I have tried using RX2 TX3 on the Arduino Board and RX7 TX8 on the software serial of SIM900.

When I run the GSM_GPRSLibrary_AT example sketch I get DB:NO RESP Trying to force the baud-rate to 9600. ERROR: SIM900 doesn't answer. Check power and serial pins in GSM.cpp status=IDLE.

I am using a USB to power Arduino Uno and a Power adaptor(12.0v 2.0A) for SIM900 GSM Shield.
I have downloaded the SIM900 library and added it to my IDE library.

Please do you have any suggestion

dannable

One wire from Uno D7 to SIM900 D7. Another wire Uno D8 to SIM900 D8. Ground to ground. This assumes that the jumper block adjacent to the aerial allows you to select between D0,D1 and D7,D8. I cannot read your board markings.

Load the serial relay sketch as above and try it.

Beginners guide to using the Seeedstudio SIM900 GPRS/GSM Shield

Far27

I have loaded the serial relay sketch as you instructed using the connection as you have specified but it is still not working. Do you think the SIM900 board is in good condition?

dannable

Ridiculous question first - you are turning it on?

What happens when you apply power? Does the net light blink rapidly for several seconds, then change to a slower blink?
Beginners guide to using the Seeedstudio SIM900 GPRS/GSM Shield

Far27

Ridiculous question first - you are turning it on?

What happens when you apply power? Does the net light blink rapidly for several seconds, then change to a slower blink?
Yes it does, but I have been trying to get both device to work for over a month now and it has been so frustrating.

dannable

#14
Aug 21, 2017, 03:36 pm Last Edit: Aug 21, 2017, 03:39 pm by dannable Reason: Inline images
Right, similar module to yours. D7 - D7, D8 - D8, Gnd - Gnd, 9v 1A psu for testing module, USB supply to Uno:



Connect using serial monitor:



I dialed my cell (mobile) phone and it connected.
Beginners guide to using the Seeedstudio SIM900 GPRS/GSM Shield

Go Up