SMS – AT Commands, Text Mode, PDU Mode, SMS PDU Converter
This SMS tutorial will cover the following topics,
- SMS Message Format – Text Vs PDU
- Send SMS in Text Format
- Send SMS in PDU Format
- Send SMS message in other languages
- PDU Message Format
- Read SMS Messages
All modem devices support 2 types of SMS message format – Text & PDU (Protocol Data Unit). Depending on what SMS message forma is set, the AT command format to send and read SMS messages will vary. Text format is straight forward to use. PDU format gives more control over the content of the message such as encoding type (other language character set), how long the message is valid, protocol identifier (fax, voice etc),
reply path etc.
With AT Command Tester, you can read and set the SMS Message format type.
//Get the SMS Message format
AT+CMGF?
+CMGF: 0
OK
SMS message for is configured for PDU mode
^RSSI:8
//Set SMS for Text format
AT+CMGF=1
OK
//Set SMS for PDU Format
AT+CMGF=0
OK
SMS message for is configured for Text mode
AT+CMGF?
+CMGF: 1
OK
SMS message for is configured for Text mode
Using the “Show Text Format” and “Show PDU Format”, users can check AT command formatted
message even without connecting the device.
Destination Number – 8588780098
Message – SMS Message sent from AT Command Tester
Text Mode Formatted Message
AT+CMGS=8588780098
SMS Message sent from AT Command Tester.
PDU Mode Formatted Message
Validity Period Format (VPF) -> 2
User Data Header Indication (UDHI) ->0
Status Report Request (SRR) -> 0
Message ID (MR) ->0
Data Coding Scheme (DCS) -> 7-bit
Validity Period (VP) ->170
Message Type (MTI) ->1
Reject Duplicates (RD) ->0
Reply Path (RP) ->0
SMS Service Center -> 2160130300F4
Message Content ->D3E614D42CCFE7E17319342FBBE920B3FCDD0605A9A0E1BBDD0EBBC9206A794E2FCB5D
PDU ->07912160130300F411000A8158888700890000aa28D3E614D42CCFE7E17319342FBBE920B3FCDD0605A9A0E
1BBDD0EBBC9206A794E2FCB5D
AT+CMGS=55
07912160130300F411000A8158888700890000aa28D3E614D42CCFE7E17319342FBBE920B3FCDD0605A9A0E
1BBDD0EBBC9206A794E2FCB5D
With Online AT Command Tester tool, you can send SMS messages in Text or PDU format. The tool will automatically detect what format (Text or PDU) is currently set on the device and will send appropriate AT commands to send the SMS message.
Checking registration status...
AT+CREG?
+CREG: 2,1, 8E, CE87
OK
The device is registered in home network.
Checking SMS Mode…
AT+CMGF?
+CMGF: 1
OK
SMS message for is configured for Text mode
Device is configured for Text mode for SMS.
AT+CMGS=”8588780098″
> SMS Message sent from AT Command Tester.
+CMGS: 22
OK
Try this script included in AT Command Tester Tool.
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Script-send_sms_text_mode.at
//Send SMS in Text Mode
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//List of supported responses
AT+CMGF=?
//WAIT for 1 sec
WAIT=1
//Get the current SMS Mode
// 0 – PDU Mode, 1- Text Mode,
AT+CMGF?
//WAIT for 1 sec
WAIT=1
//Check whether device is registered
//If device is not registered, SMS cannot be sent
AT+CREG?
//First let us send SMS in text mode
AT+CMGF=1
//WAIT for 1 sec
WAIT=1
//Send the message. Set your To number below
AT+CMGS=”8545579983″
//Wait for the > prompt
WAIT=2
//Type the SMS text below
This is my SMS message
//Send the CTRL+Z character. ^z is special command of AT Command Script engine.
^z
Response to above output script in AT Command Tester Tool.
AT+CMGF=?
+CMGF: (0,1)
OK
AT+CMGF?
+CMGF: 1
OK
SMS message for is configured for Text mode
AT+CREG?
+CREG: 0,1
OK
The device is registered in home network.
AT+CMGF=1
OK
AT+CMGS=”8545579983″
> This is my SMS message
>
>
+CMGS: 19
OK
Now let us send message in PDU mode. First change the SMS message format using the AT+CMGF command.
AT+CMGF=0
OK
Checking registration status…
AT+CREG?
+CREG: 2,1, 8E, CE73
OK
The device is registered in home network.
Checking SMS Mode…
AT+CMGF?
+CMGF: 0
OK
SMS message for is configured for PDU mode
Checking SMS Mode…
AT+CMGS=48
> 07912160130300F411000A8158888700890000aa28D3E614D42CCFE7E17319342FBBE920B3FCDD0605A9A0E
1BBDD0EBBC9206A794E2FCB5D
+CMGS: 23
OK
Try this script included in AT Command Tester Tool.
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Script-send_sms_pdu_mode.at
//Send SMS in PDU Mode
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//List of supported responses
AT+CMGF=?
//WAIT for 1 sec
WAIT=1
//Get the current SMS Mode
// 0 – PDU Mode, 1- Text Mode,
AT+CMGF?
//WAIT for 1 sec
WAIT=1
//Check whether device is registered
//If device is not registered, SMS cannot be sent
AT+CREG?
//Send SMS in PDU mode
AT+CMGF=0
//WAIT for 1 sec
WAIT=1
//Send the message. Set your To number below
//Use the SMS tab in AT Command Tester tool to get PDU formatted message.
AT+CMGS=44
//Wait for the > prompt
WAIT=2
//Send the PDU formatted message
0011000A8158585555550000aa23D4F29C0E6A97E7F3F0B90C32CBDF6D50900A1ABEDBEDB09B0CA296E7F4B21C
//Wait for the > prompt
WAIT=2
//Send the CTRL+Z character. ^z is special command of AT Command Script engine.
^z
Response to above output script in AT Command Tester Tool.
AT+CMGF=?
+CMGF: (0,1)
OK
AT+CMGF?
+CMGF: 0
OK
SMS message for is configured for PDU mode
AT+CREG?
+CREG: 0,1
OK
The device is registered in home network.
AT+CMGF=0
OK
AT+CMGS=44
> 0011000A8158585555550000aa23D4F29C0E6A97E7F3F0B90C32CBDF6D50900A1ABEDBEDB09B0CA296E7F4B21C
>
>
+CMGS: 28
OK
The PDU format gives more control over configuring the SMS message. In AT Command Tester, the PDU settings can be configured as shown below,
The format of the mobile-originated SMS message (SMS-SUBMIT) is as follows,
PDU data Conversion
Destination Number – 8588780098
Message – SMS Message sent from AT Command Tester
SMSC Address – 12063130004
Encoding – 7-bit
PDU
07912160130300F411000A8158888700890000aa27D3E614D42CCEE7E17319342FBBE920B3FCDD0605A9A0E1
BBDD0EBBC9206A794E2FCB01
Field | Value | Description |
SCA(Service Center Address) | 07912160130300F4 | 07- length 91 – Address type 2160130300F4 – Service center address |
PDU-TYPE | 11 | Reply Path (RP) ->0 User Data Header Indication (UDHI) ->0 Status Report Request (SRR) -> 0 Validity Period Format (VPF) -> 2 Reject Duplicates (RD) ->0 Message Type (MTI) ->1 |
MR (Message ID) | 00 | |
DA (Destination Address) | 0A815888870089 | 0A – Lenght of the address 81 – Address Type 5888870089 – Destination phone number |
PID (Protocol ID) | 00 | |
DCS (Data Coding Scheme) | 00 | 00 – Default 7-bit encoding |
VP(Validity Period ) | AA | |
UDL (User Data Length) | 27 | 0x27 – 39 characters of user data |
UD (User Data) | D3E614D42CCFE7E17319342FBBE920B3FCDD0605A9A0E1BBDD0EBBC9206A794E2FCB01 | User data with 7-bit encoding SMS Message sent from AT Command Tester |
You read all the SMS messages stored on the device.
+CMGL: 0,”REC READ”,”1511″,,”14/01/31,17:56:01-32″
Welcome to T-Mobile! Dial #BAL# to check your balances. Your T-Mobile number is 1858xxxxxx
+CMGL: 1,”REC READ”,”1511″,,”14/03/14,13:31:57-28″
OK
Keywords: Module SM AT Commands, M2M SM AT Commands, GPRS SM AT Commands, 3G SM AT Commands, SM AT Commands through AT commands,