Send an SMS message to a phone

The XBee Cellular Modem can send and receive Short Message Service (SMS) transmissions (text messages) while in Transparent mode. This allows you to send and receive text messages to and from an SMS capable device such as a mobile phone.

Note For help with debugging, see Debugging.

The following table explains the AT commands that you use in this example.

Command Value Description

AP (API Enable)

0 Set the device's API mode to Transparent mode.

IP (IP Protocol)

2 Set the expected transmission mode to SMS communication.

P# (Destination Phone Number)

<Target phone number>

The target phone number that you send to, for example, your cellular phone. See P# (Destination Phone Number) for instructions on using this command.

TD (Text Delimiter)

D (0x0D)

The text delimiter to be used for Transparent mode, as an ASCII hex code. No information is sent until this character is entered, unless the maximum number of characters has been reached. Set to 0 to disable text delimiter checking. Set to D for a carriage return.

PH (Module's SIM phone number)

Read only The value that represents your device's phone number as supplied by the SIM card. This is used to send text messages to the device from another cellular device.
  1. Ensure that the device is set up correctly with the SIM card installed and the antennas connected as described in Connect the hardware.
  2. Open XCTU and Add a device to XCTU.

  3. Click the Configuration working mode button.
  4. Select a device from the Radio Modules list. XCTU displays the current firmware settings for that device.
  1. To switch to SMS communication, in the IP field, select 2 and click the Write button .
  2. To enter your cell phone number, in the P# field, type the <target phone number> and click the Write button. Type the phone number using only numbers, with no dashes. You can use the + prefix if necessary. The target phone number is the phone number you wish to send a text to.
  3. In the TD field, type D and click the Write button.
  4. Note the number in the PH field; it is the XBee Cellular Modem phone number, which you see when it sends an SMS to your phone.
  5. Click the Consoles working mode button on the toolbar to open a serial console to the device. For instructions on using the Console, see the AT console topic in the XCTU User Guide.
  6. Click the Open button to open a serial connection to the device.
  7. Click in the left pane of the Console log, type hello world and press Enter. The XBee Cellular Modem sends the message to the destination phone number set by the P# command.

Note If you are receiving individual characters, verify that you set TD correctly.

  1. When the phone receives the text, you can see that the sender's phone number matches the value reported by the XBee Cellular Modem with the PH command.
  2. On the phone, reply with the text connect with confidence and the XBee Cellular Modem outputs this reply from the UART.