SMS via AT commands / SMS Service Not Subscribed?


#1

I just received my hologram.io SIM card and have been attempting to get it to work with an SIM800L connected to an Arduino.

The GSM module that I am using is: Wangdd22 Mini A6 GPRS GSM Kit Wireless Extension Module Board Antenna Tested Super SIM800L

I believe that I have everything wired up and working correctly and I am passing AT commands through and receiving responses. However, I don’t seem to be connected to the cell network. After establishing my serial connection I see:

+CREG: 3

To me this looks like “registration denied”. I can do an AT+CREG? and get:

+CREG: 1,13

Executing AT+CGATT=? gives me:

+CGATT:(0-1)

And I am able to:

AT+CREG=1
OK

But when I try AT+CGATT=1 I get:

+CME ERROR:50

which I believe means “Requested facility not subscribed”. Is it possible that my SIM has not been properly registered?

I was hoping that I’d be able to just do something like the following to start sending SMS messages:

AT+CSTT="hologram","",""
AT+CSCS="GSM"
AT+CGATT=1
AT+CMGF=1
AT+CMGS="+15551231234"
> This is a test message

But I only get as far as the AT+CMGF=1 before receiving “ERROR”.

My SIM is listed under Devices in the Hologram.io Dashboard and the status is “Live”.

Does it look like I’m doing this wrong, or is it possible that my SIM just isn’t registered somehow? Or maybe the above indicates a misuse of the modem?

Thanks in advance!


#2

Hello @drunnells,

Welcome to our Community!

Where are you currently located and using the SIMCOM 800L?

Best,
PFW


#3

Rochester, New York, USA. My Hologram.io SIM card says it is for Zone 1 in the dashboard.

Uh oh, maybe I didn’t get a module for the correct band/region? I had better go look…


#4

It looks like my module supports SMS and GSM / GPRS four bands, including 850,900,1800,1900MHZ. From what I see about hologram.io, it uses T-Mobile and AT&T in North America which is 850 & 1900?


#5

Hey @drunnells,

Yes, T-Mobile coverage should be strong where you are, and T-Mobile has not yet sunset their 2G support (although AT&T has, and the module you’re using is 2G). So, it will likely still work :slight_smile:

I need a few things from you and then we can check things out from our end:

  1. Can you PM me the last 5 digits of the number printed on the SIM?
  2. Can you visit your nearest Abbott’s and let us know if the frozen custard is still the best in the world? Planning a road trip and need to know whether to stop at Abbott’s or Wegmans :wink:

Thanks,
PFW


#6

Hi Pat,
Recently back in Rochester (born /raised there). Abbotts is absolutely still the worlds best custard (chocolate almond my fav) A stop at Wegmans is also a must so Abbotts AND Wegmans. I would also add a stop at Nick Tahou’s for a garbage plate! So much great food there, I could go on…
Enjoy!!
Tony


#7

@drunnells could you give our SIMCOM library a try? It vastly simplifies working with the 800L module and would help us with troubleshooting. Also, it provides better service around sending and receiving SMS.


#8

@tonym63 @drunnells

We’re going to have to start an entirely separate Rochester thread :laughing:

Been to Nick Tahou’s and definitely have ordered the sauce on a garbage plate


#9

Agree on the garbage plates!!


#10

I just clicked the link you provided and wanted to double check. Is your module the SIMCOM SIM 800L or an A6 branded module?


#11

Benstr,

I don’t think that my module is SIMCOM. It is A6. Actually, I did want to use this library! I think that my other problems are preventing me from getting much use out of it at the moment though. However, when I tested the latest from github I ran into something strange during initialization. My SIM800L has “auto-baud” and I think it was preventing your library from seeing it. When writing my own code and using it straight through serial I needed to send several "AT"s first before getting an “OK” back… I guess while it figured out what baud my terminal was set to? In an attempt to get your library to see my modem I did add something like this that I called first:

void HologramSIMCOM::initModem() {
  Serial.println("Starting init...");
  int modemFound = 0;
  for (int i=0; i < 10; i++) {
    if (modemFound == 0) {
      serialHologram.println("AT");
      delay(1000);
      if (serialHologram.available()) {
        String responseStr = serialHologram.readString();
        Serial.println(responseStr);
        if (responseStr.substring(6,8) == "OK") {
          modemFound = 1;
        }
      }
      Serial.write(serialHologram.read());
    }
  }
  if (modemFound > 0) {
    delay(500);
    Serial.println("Setting baud to " + 9600);
    serialHologram.println("AT+IPR=" + 9600);
    delay(200);
    serialHologram.println("AT+CSTT=\"hologram\",\"\",\"\"");
    delay(200);
  }  else {
    Serial.println("No modem found");
  }
}

Maybe after my other problems are solved I won’t need that… it certainly isn’t very elegant.


#12

OK, thanks for the additional info. The SIMCOM library does not support non-SIMCOM modules yet. I’m not sure what the A6 startup process is like, but sounds like it’s probably slower than the SIMCOM 800.

I’ll set some time aside tomorrow for messing with the A6. In the meantime here are some tips that can help.

  • Make sure to connect the reset (RST) pin to a digital output and cycle it HIGH > LOW > HIGH before doing any AT commands. Cell modules are very picky on the order they’re initialized and state sometimes persists. toggling the RST pin will give you a clean slate each time. Example: https://github.com/hologram-io/hologram-SIMCOM/blob/master/HologramSIMCOM.cpp#L17-L22
  • After a hard reset, the modem will take longer than usual to start up (refer to the module documentation). I put a 10-second delay (crazy, right!) for the SIMCOM modules before calling my first AT.
  • It’s good to see you’re explicitly setting the baud with AT+IPR since I’ve had mixed results with auto-bauding. SIMCOM modules work best at 19200 and the A6 might be the same.
  • When setting the APN try not including empty strings for the user and password. In the past, I’ve experienced module errors when doing that, not including the extra parameters fixed it. "AT+CSTT=\"hologram\""should work just fine.

Hope this helps as I think the first two tips might fix your issues.


#13

Thanks again! I had not connected the reset pin previously. I did that and now I can get the modem to reset with a HIGH LOW HIGH LOW. Leaving it HIGH as in your example did not work for me… the modem appeared unresponsive until RST was LOW again. I also needed to connect VCC to PWR on the module to get the reset pin working. I tried the AT+CSTT without the last two parameters, but received an ERROR. Maybe the A6 requires this?

Whatever the problem I’m having is does not appear to be just with hologram.io. Trying my Cricket Wireless SIM from my phone gives me the same results.


#14

Thanks guys, I was able to get this working and send an SMS with AT commands on my A6 module! I’m embarrassed to say that the big problem was that I had been putting the SIM card in backwards. It never occurred to me that the square end should go in first and the notched end would be sticking out of the slot. I had assumed it was keyed so that it would only fit one way with the notched end touching something on the inside of the slot. I only noticed because there were scratches outside of the contact area on the SIM card from the wrong areas touching the contacts. This is how it is supposed to fit:

If anyone is interested, this is the code that I used in my Arduino Nano using SoftwareSerial to send an SMS message after powering up. About 30 seconds after starting, you should get a text message:

#include <SoftwareSerial.h>

int RX_PIN = 10; 
int TX_PIN = 11;
int RESET_PIN = 7;

SoftwareSerial mySerial(RX_PIN, TX_PIN); // RX, TX
long baud = 9600;

void setup() {
  Serial.begin(baud);
  mySerial.begin(baud);
  initModem();

  sendSmsMessage("15556667777","This is a test!");
}

void loop() { 
}

void initModem() {
  // Reset modem
  delay(100);
  pinMode(RESET_PIN, OUTPUT);
  digitalWrite(RESET_PIN, HIGH);
  delay(2000);
  digitalWrite(RESET_PIN, LOW);
  delay(5000);

  int modemFound = doAutoBaud();
  
  if (modemFound > 0) {
    delay(500);
    Serial.println("AT");
    delay(200);

    sendCmd("AT");
    sendCmd("ATE0");
    sendCmd("AT+CMGF=1");
    sendCmd("AT+CGDCONT=1,\"IP\",\"hologram\"");
    sendCmd("AT+CSTT=\"hologram\",\"\",\"\"");
    
    delay(2000);
  }

}

int doAutoBaud() {
  int toReturn = 0;
  for (int i=0; i < 10; i++) {
    if (toReturn == 0) {
      mySerial.println("AT");
      delay(500);
      if (mySerial.available()) {
        String responseStr = mySerial.readString();
        if (responseStr.substring(6,8) == "OK") {
          toReturn = 1;
        }
      }
    }
  }
  return toReturn;
}

void sendCmd(String cmd) {
  Serial.println(cmd);
  mySerial.println(cmd);
  int response = 0;
  while (response < 1) {
    if (mySerial.available()) {
      Serial.println(mySerial.readString());
      response = 1;
    }
    delay(100);
  }
}

void sendSmsMessage(String phoneNumber, String message) {
  mySerial.print("AT+CMGS=\"");
  mySerial.print(phoneNumber);
  mySerial.write(0x22);
  mySerial.write(0x0D);
  mySerial.write(0x0A);
  delay(2000);
  mySerial.print(message);
  delay(500);
  mySerial.println(char(26));
}

Note - I am powering the Nano and this module with an external 5v 2.5amp power supply. I read somewhere that just whatever the Nano gets from USB wouldn’t be enough for this sort of thing.


A6 - SMS says OK, but nothing is sent.
#15

Happy to hear you figured this out and thank you for posting the sketch!


#16

You’re not the only one that struggled with putting in the sim backwards. :blush: