AT commands and a Siemens M35i

Connect your phone to a computer

You must have a data cable (USB or RS232). A rs232 data cable works fine with a USB-serial converter, because only the ground, RXD and TXD pins are used.

With putty or hyperterminal you can control your mobile phone. For a Siemens M35i, the correct baudrate is 19200. If your baudrate is incorrect, you will receive strange characters. Other Siemens phones used 9600 baudrate, so maybe you have to play around to find the correct baudrate (just keep sending AT until you will receive OK in response).

Connect your phone to a microcontroller using USART

A microcontroller can control the mobile phone using his hardware (or software) UART. Therefore a serial data cable must be used. The signal level of the output  of this cable  are plus or minus 3-15 volt, which must be changed to 0 or 5 volt using e.g. a max232 level shifter. A schematic is given below:

<schematic>

A sample Arduino program is given below. The mobile phone can be controlled using the serial terminal. When a “c” is send, a number is called. When “s” is send, an SMS is received. When the phone is called, the computer received a notification.

<sample program>

The supported  AT command of a Siemens M35(i) can be found in the following file:  s35i_c35i_m35i_atc_commandset_v01.

Read SMS messages

Unlike an incoming call, you receive by default no notifications for a new SMS. To enable this, use the following command (you may have to give this command after powering up your phone):

AT+CNMI=1,1,0,0,1

When a SMS is received, you receive a the memory location and index number.

You can read the text messages from the phone storage. Messages can be stored on different locations (e.g. SIM, phone memory)

To  check what storage locations you can acces, use the following command:

AT+CPMS=?

The M35i only supports that messages can be read from the SIM card.

To get more information about the free space and used space, use the same command:

AT+CPMS=”SM”

Now the received free space and total space is returned. In case of the M35i, the information is dispayed 3 times, becasue the +CPMS=? command display SM 3 times as well.

Read all messages with a specific status using  the CMGL command

To read a message, use the +CMGL command. In text mode, you can read all message using +CMGL=”ALL” . Because the Siemens does not support this mode, you must use the command +CMGL=”ALL”.

  • Received unread:  +CMGL=0
  • Received read:  +CMGL=1
  • Stored unsent:  +CMGL=2
  • Stored sent:  +CMGL=3
  • All messages:  +CMGL=4

In the example below, 2 SMS messages are received and they are stored at position 4 and 9. Then all unread message are being read

You receive the PDU message stored in the memory. To use this data, you have to decode this message.

 Read a single message

To read a single message, use the  AT+CMGR command. In the example below, the messages from index 4 and 9 are being read.

The return is +CMGR: <status>,[<address name>],<TPDU_length>. Because the address name  is optional and not supported by this phone, it is empty in this case. When the status is 1 (meaning received read) , the status is unchanged. The status is the same as for the +CMGL commands given above.

The  TPDU_length is an integer, indicating the amount of octets of the PDU message after the SMSC number (in this case the part after 07911326040011F5). This can be devided in 23 octets, coded in hexadecimal (46 characters).

24 0B 91 13 16 XX XX XX F7 00 00 21 80 20 61 91 71 80 04 54 32 9C 0E

See for more information about the CMGR command this page.

example of code of PDU encoder: http://www.timzaman.nl/?p=47&lang=en

 

Leave a Reply

Your email address will not be published.