1
votes

Before you mark this question as duplicate, please note that I have already tried this, this & this

I bought an Arduino UNO R3 & a SIM808 GSM/GPS shield recently. The RX of the Shield is connected to Pin 11 of Arduino, TX to Pin 10 with both the GNDs connected to each other. I have connected my Arduino to my computer with the USB & the shield is connected to an external power supply with a 12V Adapter. Additionally, I have connected the 3.3V of the Arduino to Vcc of the shield.

Following is the sketch I have used:

// Include the GSM library
#include <GSM.h>

#define PINNUMBER ""

// initialize the library instance
GSM gsmAccess;
GSM_SMS sms;

void setup() {
  // initialize serial communications and wait for port to open:
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }

  Serial.println("SMS Messages Sender");

  // connection state
  boolean notConnected = true;

  // Start GSM shield
  // If your SIM has PIN, pass it as a parameter of begin() in quotes
  while (notConnected) {
    if (gsmAccess.begin(PINNUMBER) == GSM_READY) {
      notConnected = false;
    } else {
      Serial.println("Not connected");
      delay(1000);
    }
  }

  Serial.println("GSM initialized");
}

void loop() {

  Serial.print("Enter a mobile number: ");
  char remoteNum[20];  // telephone number to send sms
  readSerial(remoteNum);
  Serial.println(remoteNum);

  // sms text
  Serial.print("Now, enter SMS content: ");
  char txtMsg[200];
  readSerial(txtMsg);
  Serial.println("SENDING");
  Serial.println();
  Serial.println("Message:");
  Serial.println(txtMsg);

  // send the message
  sms.beginSMS(remoteNum);
  sms.print(txtMsg);
  sms.endSMS();
  Serial.println("\nCOMPLETE!\n");
}

/*
  Read input serial
 */
int readSerial(char result[]) {
  int i = 0;
  while (1) {
    while (Serial.available() > 0) {
      char inChar = Serial.read();
      if (inChar == '\n') {
        result[i] = '\0';
        Serial.flush();
        return 0;
      }
      if (inChar != '\r') {
        result[i] = inChar;
        i++;
      }
    }
  }
}

Problem here is same as that mentioned in those linked posts.

The condition if (gsmAccess.begin(PINNUMBER) == GSM_READY) never gets executed. Neither does the else part execute.

Serial monitor never goes past SMS Messages Sender.

Please note that I am using AirTel India, I have a fully activated Data Plan & the PIN Number has been changed to 0000.

Would really appreciate if someone could suggest something helpful.

Thanks for your time!!

3

3 Answers

2
votes

You cannot power a GSM module from the 3.3V of Arduino! a GSM needs peak currents of 3A (yes, Amps, not milli-amperes). You really need a LiPo battery to power the GSM. You could power a 3V Arduino from the same LiPo battery, actually, if you need a mobile solution, but not the other way around.

1
votes

Please first check if the module responds with the next code Example Code

Other thing the Supply voltage range must be 3.4 ~ 4.4V, try not using less voltage .

0
votes

The GSM library of the Arduino is for the Quectel M10 GSM/GPRS module and is not compatible with SimCom SIMxxx modules.

Here is the library that you can use for your SIM808 module https://github.com/MarcoMartines/GSM-GPRS-GPS-Shield (examples included in the repo). Note that this library uses the SIM900 library which allows low level interface with SimCom modules.

For further reading here two adafruit links:

http://wiki.iteadstudio.com/SIM808_GSM/GPRS/GPS_Module
https://www.adafruit.com/products/2637

the shield is connected to an external power supply with a 12V Adapter. Additionally, I have connected the 3.3V of the Arduino to Vcc of the shield.

What do you mean by that? You need to supply your shield with the required voltage that can deliver the required amps. And also you need to have a common ground with your arduino.

In addition, if your shield is a 3.3V you need to shift Tx line comming from arduino as well (because it's a 5V) using a voltage divider.

Note that these shields have also a soft power-up button that needs to be connected as well, to allow the code to power up your module.