SIM900 GSM/GPRS for Arduino doesn't work

Few weeks ago I bought a simple SIM900A and I thought it was broken because he didn't do anything, not even the data led was blinking every 3 seconds, now the new board connects normaly, but I don't get in the output an OK but I recieve following for at = vfvw, AT = �� & ata gives vvfv. This is the board I'm using now:
https://www.amazon.com.be/-/en/SIM900-Shield-Development-Board-Antenna/dp/B07FS34P84/ref=asc_df_B07FS34P84/?tag=begogshpadde-21&linkCode=df0&hvadid=632994742240&hvpos=&hvnetw=g&hvrand=10991973398412831805&hvpone=&hvptwo=&hvqmt=&hvdev=c&hvdvcmdl=&hvlocint=&hvlocphy=1001162&hvtargid=pla-591271251758&psc=1&gclid=EAIaIQobChMI3K2E7e7AgAMVzOZ3Ch0DHQmpEAQYASABEgIG2vD_BwE
This is the code I'm using to test:

/*
* Connections
*  SIM900   ARDUINO UNO
*    GND         GND
*    RX           2
*    TX           3
* 5VDC 2A        5V USB
*/

#include <SoftwareSerial.h>

SoftwareSerial GPRS(2, 3);

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

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

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[i] = NULL;
  }
}

How can I solve this problem? Or do I need to import other libraries or packages?

Try another baud rate.

@xfpd Hi xfpd,
I already tried all baudrates other sketches, but I don't get a respond from the shield.

Would you post a diagram of your project, and a picture. That might help.

@xfpd Hi xfpd,
I´ve tried it with an ESP32 and the gsm shield seems to work normal. The netlight blinks every 3 seconds but I don´t recieve anything. Not even OK.


This is an image of the esp32 connection to reduce the voltage the gnd is connected with a 270 Ohms resistor and the tx/rx with a 470 Ohms connected to the pin. So I´ll get 5Vx470/(470+220) = +- 3.17V.

With the UNO the 0 RX goes to 0 TX of the shield, 1 TX to 1 RX on the gsm shield, gnd to gnd of the shield and to gnd UNO.
Thanks for your time.

Before the 3 seconds blink, does the serial monitor show any response from the SIM900?

@xfpd Hi xfpd, he´s working now. I used other Gpio´s and another sketch. I´ll put it later here with the wiring. I´m going to use it as an alarm which sends an sms when the power falls out.
Thank you for the interest and your time.
Greetings Rudy.

1 Like

@xfpd Like I said this is the sketch that's working for me.

#include <SoftwareSerial.h>
// Wiring
/*
* GSM shield            Arduino            RY1:5V             RY2             T1:NPN
*    5V                  VINN              5V                 COM           
*    GND                 GND               T1:E               GND            B
*    12V                                                      12V
*    J1                   7
*    J2                   8
*    11                   11                                  NC
*                         13                                                 C        
*    PWRKey                                COM
*    PWRKey                                NO
*    2V8                  A5
*    11                   A3                        
*     
*/
//Create software serial object to communicate with SIM900
SoftwareSerial GSM900(7, 8);  //SIM900 Tx & Rx is connected to Arduino #7 & #8
char incoming_char = 0;
int pinStartUp = 13;  // Used to start up the GSM shield
int pinIn = 11;       // controlates if there's still power on the relay
int analogPin = A3;   // from RY2 NO
int valA = 0;         // variables to store the readed value
int valB = 0;
int val = 0;        // integer to read digital value, comes from relay NC
int powerPin = A5;  // analog pin5 used to measure if the module is powered and needs a restart from 2V8 gsm-shield
int smsVal = 0;
int counter = 0;
int count = 0;

void setup() {
  pinMode(pinIn, INPUT);
  pinMode(pinStartUp, OUTPUT);
  //Begin serial communication with Arduino and Arduino IDE (Serial Monitor)
  Serial.begin(19200);
  Serial.println("Initializing...");
  //Begin serial communication with Arduino and SIM900
  GSM900.begin(19200);
}

void loop() {
  val = digitalRead(pinIn);
  valA = analogRead(analogPin);  // read the input pin
  valB = analogRead(powerPin);
  if (val == 1 ) {
    resetCounter();
  } else if (val != 1 && counter >= 49 && smsVal < 2 && valA < 1000) {
    if (smsVal < 1) {
      // An error occured, send sms
      sendSms();
      delay(1000);
      Serial.println("Sending sms....");
    }
  } else {
  }
  if (valB < 100) {
    count++;
    if (count >= 15) {
      /*Serial.print("Count = ");
      Serial.println(count);
      Serial.println(valB);*/
      startUp();
    }
  }
  updateSerial();
  if (valA == 0 && counter < 50) {
    counter += 1;
  }
  delay(1000);
  if (counter != 0) {
    Serial.print("Counter = ");
    Serial.println(counter);
  }
}

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

void sendSms() {
  smsVal++;
  delay(100);
  GSM900.println("AT");  //Once the handshake test is successful, it will back to OK
  updateSerial();
  GSM900.println("AT+CMGF=1");  // Configuring TEXT mode
  updateSerial();
  GSM900.println("AT+CMGS=\"+ZZxxxxxxxxx\"");  //change ZZ with country code and xxxxxxxxxxx with phone number to sms
  updateSerial();
  GSM900.print("Power failer");  //text content
  updateSerial();
  GSM900.write(26);
}

void startSystem() {
  // Give the module the time to start up and start reading from input
  delay(2000);
  counter += 1;
}

void resetCounter() {
  // Serial.println("Reset counter");
  counter = 0;
  if (smsVal > 0) {
    smsVal = 0;
  }
}

void startUp() {
  digitalWrite(pinStartUp, HIGH);
  Serial.println("Start up");
  delay(2000);
  digitalWrite(pinStartUp, LOW);
  Serial.println("Done starting up");
  count = 0;
}

Okay. Glad you got it working. Did you find the reason for the Uno not working? Power supply? Wiring? Compiling?

@xfpd Wiring and also the power supply. I used in first case rx and tx from the UNO, now I'm using 7 and 8. At this moment I'm only sending messages, later I like to receive messages also, but at this moment I don't need it.

1 Like

I see. Hardware serial uses pins 0 RX and 1 TX. You are using SoftwareSerial. Very good.

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.