Example Code for Arduino-Read SMS (AT Commands)-V1.0

Last revision 2026/01/24

This article offers a complete guide to using Arduino to read SMS messages via AT Commands, including necessary hardware and software preparations, detailed sample code, and step-by-step instructions for setting up and executing the process.

Hardware Preparation

Software Preparation

Preparations

  1. Insert SIM card into SIM7600CE-T shield, then connect it with Arduino UNO and plug in the external power supply.
  2. Press “Boot” to start the module, and wait for SIM card to be successfully registered into Network, which means Net indicator begins to flash quickly.
  3. Select D0/D1 or D7/D8 as communication serial port through jumper cap according to the type of controller board.
  4. Take Arduino UNO as an example, download the following code to UNO and connect RX-D8/TX-D7 by jumper cap.

Sample Code

#include <SoftwareSerial.h>
SoftwareSerial myserial(7, 8); //Define virtual serial port name as myseria,Rx is port 7, Tx is port 8
void setup()
{
  myserial.begin(115200); //Initialize virtual serial port
  Serial.begin(115200); //Initialize Arduino default serial port
}

void loop()
{
  while(1){
  while (myserial.available()) {
    Serial.write(myserial.read());//if Serial received data, output it via mySerial.
  }
  while(Serial.available()) {
    myserial.write(Serial.read());//if myserial received data, output it via Serial.
  }
}
}

Other Preparation Work(AT command)

  1. Send a message to the SIM card on the module, I sent test! here
  2. The serial monitor will print a message +SMTI: "SM",1, and 1 shows the number of the message
  3. Send AT+CMGR=1 to read the message of 1. The message "Test!" should display

Result

TEL0124_read_sms

NOTE: If the text is unreadable, please set the message in TEXT by AT+CMGF=1.

Was this article helpful?

TOP