As I don't want to stack the shield over the mega 2560 board, I try to connect only the pins that used for GSM communication. Here are my connection:

Pin 3 on Mega <==> Pin GSM Rx on Shield

Pin 10 on Mega <==> Pin GSM Tx on Shield

Pin 4 on Mega <==> Pin 4 on Shield

Pin 5V on Mega <==> Pin Vin on Shield

Pin GRD on Mega <==> Pin GRD on Shield

Code I used is from the Examples library, GsmScanNetworks:

#include <GSM.h>

// PIN Number
#define PINNUMBER "8888"

// initialize the library instance
GSM gsmAccess;     // include a 'true' parameter to enable debugging
GSMScanner scannerNetworks;
GSMModem modemTest;

// Save data variables
String IMEI = "";

// serial monitor result messages
String errortext = "ERROR";

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

  Serial.println("GSM networks scanner");

  // connection state
  boolean notConnected = true;

  // Start GSM shield
  // If your SIM has PIN, pass it as a parameter of begin() in quotes
      notConnected = false;
      Serial.println("Not connected");

  // get modem parameters
  // IMEI, modem unique identifier
  Serial.print("Modem IMEI: ");
  IMEI = modemTest.getIMEI();
  if(IMEI != NULL)

void loop()
  // scan for existing networks, displays a list of networks
  Serial.println("Scanning available networks. May take some seconds.");

    // currently connected carrier
  Serial.print("Current carrier: ");

  // returns strength and ber
  // signal strength in 0-31 scale. 31 means power > 51dBm
  // BER is the Bit Error Rate. 0-7 scale. 99=not detectable
  Serial.print("Signal Strength: ");
  Serial.println(" [0-31]");



  1. After opening the serial port, only a line "GSM network scanner" is read. Seems that the program is stuck ongsmAccess.begin(PINNUMBER), how shall I fix that?
  2. Is it a must that I shall supply 5V 2A power to the shield seperately in order for the shield to work? (with connection mentioned above, the ON led light on the shield does turns on with an orange light)
  3. For the PINNUMBER defined in the program, my SIM has default PIN 8888. I checked with a mobile phone that the SIM card does work. But my phone shows that the SIM card is not locked with PIN. So shall I define the PIN as 8888 for ''?


GSM shield link

Note for using GSM shield with Mega

* And yes! The shield did work when stacked! (Orginally I don't want to bend pin 2...but...unnh...stacking and bending out pin 2 did work)

* Tried the examples "GSMScanNetwork" and "SendSMS", works fine. But for "GsmWebServer", an IP address is shown, but when I enter the IP address on my browser, chrome/ie says they cannot find the IP address.....Any clues?

* And does the status LED on the GSM board have anything to do with power? It goes on and off and on and off.....

* For question 1 & 3, PINNUMBER is set to ''. Worked fine.

migrated from electronics.stackexchange.com Apr 15 '14 at 5:05

This question came from our site for electronics and electrical engineering professionals, students, and enthusiasts.

  • On point #2, yeah, you'll most likely need to provide an adequate supply. I have a GSM module and it'll turn off as it's trying to connect when I don't give it enough current. – sachleen Apr 15 '14 at 5:09
  • Does it work when you do directly stack the boards together? – jippie Apr 15 '14 at 5:13
  • Edited the question, please check, thanks! – MW_hk Apr 17 '14 at 3:37
  • I see pin 3 as input but no where in your code are you setting the pin to input. As I missing something? – PhillyNJ May 11 '16 at 20:33

I have done this, and had (some limited) success.

A couple of your connections are wrong; Connect both the pin 7s on the shield and MEGA, not the pin 4s. Pin 7 is the reset pin - I think that GSM.begin resets the shield before doing anything. This might help with Q1.

Make sure that you use the regulated 5V output on the MEGA, and not the Vin to power your shield. Vin is whatever voltage is connected to the MEGA power socket, and could damage your shield. I personally have not noticed any difference when powering the MEGA+Shield from USB or external 12V supply.

I had problems with interference when I used wires to connect shield to MEGA. The stacking seems to have reduced this problem, but not eliminated it by any means...

The GSM Web server is unlikely to work except maybe from within your SIM provider's own network. Some of the limitations are mentioned here; https://www.arduino.cc/en/Tutorial/GSMToolsTestWebServer


Give power to gsm shield with 9v adaptor. It may work. I too used power to gsm module from arduino, but there is no connnection.after i used 9v adaptor ,then it works well.

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.