AT commands SparkFun LTE Cat M1/NB-IoT shield

I’m trying to use the SparkFun LTE cat M1/NB-IoT shield to trigger relays when specific text messages are received, and I’m having trouble setting the new message indication via AT command.
See code below. The problem I’m having is with the line: lte.println(“AT+CNMI=2,2,0,0,0”);
// AT Command to receive a live SMS.
Every single example I can find online about operating something with arduino via SMS, includes this AT command. But when I try this command in the serial monitor with an AT passthrough sketch, it retuns: +CMS ERROR OPERATION NOT SUPPORTED.


do I need to add additional AT setup commands to the sketch in order for it to work?

#include <SoftwareSerial.h> //software serial library for serial communication b/w arduino & GSM

SoftwareSerial lte(8, 9);//connect Tx pin of GSM to pin 8 of arduino && Rx pin of GSM to pin no 9 of arduino

// Relays connected to pins 3 & 4
const int UP = 3;
const int DOWN = 4;

String textMessage;


void setup()
{
  lte.begin(9600);   // Setting the baud rate of GSM Module  
  Serial.begin(9600);    // Setting the baud rate of Serial Monitor (Arduino)
  delay(20000);

  lte.println("*AT+CNMI=2,2,0,0,0*"); // AT Command to receive a live SMS
  delay(1000);
   
   // Set relay as OUTPUT
  pinMode(UP, OUTPUT);
  pinMode(DOWN, OUTPUT);

  // By default the relay is HIGH
  digitalWrite(UP, LOW);
  digitalWrite(DOWN, LOW);
}

void loop()
{
  if(lte.available()>0){
    textMessage = lte.readString();
    Serial.print(textMessage);    
    delay(10);
  } 
  if(textMessage.indexOf("U")>=0){
    digitalWrite(UP, HIGH);
    delay(300);
    digitalWrite(UP, LOW);
    Serial.println("UP");  
    textMessage = "";   
  }
  if(textMessage.indexOf("D")>=0){
    digitalWrite(DOWN, HIGH);
    delay(300);
    digitalWrite(DOWN, LOW);
    Serial.println("Down");
    textMessage = ""; 
  }

  }
1 Like

AT commands are often manufacturer and device specific. Is this command actually supported by the SARA-R4?

Yes, I’ve used the AT command to query what modes are available, and that combination is apparently valid. The manufacturer manual also details the modes available, and there is nothing stating that this combination is not valid.