0

I am new to Arduino which I got only this week for my project which sends sms from my windows application.

I have Arduino Uno R3 and GPRS Shield (Simcom) Sim900 (S2-1040S-Z0912)

I am currently following this guide > https://educ8s.tv/arduino-gsm-shield/

As of the moment I have problem connecting the Sim900 to Arduino (I think Arduino cannot detect Sim900). The Arduino is working properly as my PC detected it. Also I confirm that the SIM900 is working properly as I can call the Sim inside and it is ringing (also the led on the device is blinking almost every 3 secs or so)

I found this, but I'm planning to use USB powered only as I only need the SMS feature so I am stacking the SIM900 on top of the Arduino. How to communicate the Arduino board with SIM900?

I am using this library http://www.tinyosshop.com/datasheet/GSM_GPRS_GPS_Shield_GSMSHIELD.rar

and below is the sketch:

#include "SIM900.h"
#include <SoftwareSerial.h>
#include "sms.h"
SMSGSM sms;

int numdata;
boolean started=false;
char smsbuffer[160];
char n[20];

char sms_position;
char phone_number[20];
char sms_text[100];
int i;

void setup()
{
    Serial.begin(9600);
    
    if (gsm.begin(9600)) 
    {
        Serial.println("\nstatus=READY");
        started=true;
    } 
    else 
        Serial.println("\nstatus=IDLE");

    if(started) 
    {
        if (sms.SendSMS("214", "?15001"))
        {
          Serial.println("\nSMS sent OK.");
        }
        else
        {
          Serial.println("\nError sending SMS.");
        }      
    }
};

void loop()
{
    if(started) 
    {
        sms_position=sms.IsSMSPresent(SMS_UNREAD);
        if (sms_position) 
        {
            Serial.print("SMS postion:");
            Serial.println(sms_position,DEC);
            sms.GetSMS(sms_position, phone_number, sms_text, 100);
            Serial.println(phone_number);
            Serial.println(sms_text);
        }      
        delay(2000);
    }
};

and here is the output

Trying to force the baud-rate to 9600

1200
2400
4800
9600
19200
38400
57600
115200
ERROR: SIM900 doesn't answer. Check power and serial pins in GSM.cpp

status=IDLE

What I have tried so far:

I tried the sketch with SoftwareSerial mySerial(7, 8); and SoftwareSerial mySerial(9, 10) which i found on other tutorials but didn't work.

I tried modifying GSM.cpp and modify the value of _GSM_TXPIN_ and _GSM_RXPIN_ to 7, 8 and 9, 10 but didn't work.

Found that the pin on my Arduino is RX=0 and TX=1, and SIM900 is TX=0 and RX=1, tried the SoftwareSerial code above but with 0, 1 and GSM.cpp with 0, 1 but still not working.

I am currently still trying every other sketch i find on the internet but nothing works.

EDIT: This is the link for the module i bought https://www.lazada.com.ph/products/sim900-gsm-shield-i267689740-s379728457.html?mp=1

I cant find the link for the datasheet of this specific module so I will try to include the picture of the module

SIM900 Bottom

SIM900 Top

  • Can you provide a link to the actual module you are using? Does it have jumpers on it to change the TX and RX pin assignments? – Majenko Jun 24 at 11:36
  • Hi @Majenko, Please see the edit on the bottom of my question. Thanks – Henry Jun 25 at 1:40
0

After many trials, I found the solution to my problem, thanks to @Majenko for mentioning the jumpers.

I am still stacking the SIM900 module on top of Arduino.

Switching the jumpers from D1 and D0 to D8 and D7 solved the problem (see green square on the pic)

I don't know why it needs to be on D8 and D7 since on board it says TX=0 and RX=1 and vise-versa for Arduino

JUMPERS

Then used the below sketch from this tutorial > https://lastminuteengineers.com/sim900-gsm-shield-arduino-tutorial/

#include <SoftwareSerial.h>

//Create software serial object to communicate with SIM900
SoftwareSerial mySerial(7, 8); //SIM900 Tx & Rx is connected to Arduino #7 & #8

void setup()
{
  //Begin serial communication with Arduino and Arduino IDE (Serial Monitor)
  Serial.begin(9600);
  
  //Begin serial communication with Arduino and SIM900
  mySerial.begin(9600);

  Serial.println("Initializing...");
  delay(1000);

  mySerial.println("AT"); //Handshaking with SIM900
  updateSerial();
  mySerial.println("AT+CSQ"); //Signal quality test, value range is 0-31 , 31 is the best
  updateSerial();
  mySerial.println("AT+CCID"); //Read SIM information to confirm whether the SIM is plugged
  updateSerial();
  mySerial.println("AT+CREG?"); //Check whether it has registered in the network
  updateSerial();
}

void loop()
{
  updateSerial();
}

void updateSerial()
{
  delay(500);
  while (Serial.available()) 
  {
    mySerial.write(Serial.read());//Forward what Serial received to Software Serial Port
  }
  while(mySerial.available()) 
  {
    Serial.write(mySerial.read());//Forward what Software Serial received to Serial Port
  }
}

With this, it displays correct output on serial monitor based on the tutorial and I can confirm that its working as well on my windows form application as it can send sms from the application.

| improve this answer | |
  • 0 and 1 are the hardware serial pins. If you are using Serial elsewhere in your code then you can’t use 0 and 1 for the shield. They’re already in use by the hardware serial. You are creating a software serial. It’s not a real serial port. It’s software pretending to be a serial port. That won’t use hardware serial pins. – Delta_G Jun 25 at 16:03
  • If you want to use 0 and 1 then get rid of all the software serial business and just use Serial to talk to the shield. But that means you can’t use it for other purposes and it also means complications when you want to upload new code. – Delta_G Jun 25 at 16:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.