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

Last revision 2026/01/24

This article guides users through sending SMS using Arduino and AT commands, including hardware setup, software preparation, sample code, and troubleshooting tips for efficient communication.

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)

Open DF Serial Debugger and copy the settings according to the image below. If you cannot open the port, please check if the port is occupied by the Arduino IDE serial monitor.

  1. Send AT+CMGF=1 to set the SMS in text format. You will get OK
  2. Send *AT+CMGS="170***9217" to set the receiver number. You will see a notation >
  3. Write the content of the message
  4. Send 1A(HEX) as an end to send the message
  5. You will get OK, and the message will be sent

We recommend using DF Serial Debugger because when you are going to send the message, you have to send 0x1A in HEX. The DF Serial Debugger can send data in HEX while the Arduino IDE can't.

NOTE: Do NOT tick the checkbox hex until Step 4 which is to send 0x1A in HEX.
TEL0124_phone_receive_sms

Result

TEL0124_send_sms_DF_serial

Was this article helpful?

TOP