Escolar Documentos
Profissional Documentos
Cultura Documentos
35
AT Command bertugas mengirim atau menerima data ke atau dari SMS-Center.
AT Command tiap-tiap SMS device biasanya berbeda-beda, tetapi pada dasarnya
sama.
Beberapa AT Command yang penting untuk SMS yaitu :
AT+CMGS : untuk mengirim SMS
AT+CMGL : untuk memeriksa SMS
AT+CMGD : untuk menghapus SMS
AT Command untuk SMS, biasanya diikuti oleh data I/O yang diwakili oleh unit-unit
PDU.
PDU Sebagai Bahasa SMS dan Bagian Bagiannya
Data yang mengalir ke atau dari SMS-Center harus berbentuk PDU (Protocol Data
Unit). PDU berisi bilangan-bilangan heksadesimal yang mencerminkan bahasa I/O.
PDU terdiri atas beberapa Header. Header untuk kirim SMS ke SMS-Center berbeda
dengan SMS yang diterima dari SMS-Center. Maksud dari bilangan heksadesimal
adalah bilangan yang terdiri atas 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F.
PDU untuk mengirim SMS terdiri atas :
1. Nomor SMS-Center
Header pertama ini terbagi atas tiga subheader, yaitu :
Jumlah pasangan heksadesimal SMS-Center dalam bilangan heksa. Daftar SMS
Center yang ada di Indonesia diperlihatkan dalam tabel dibawah ini.
National/International Code
a. Untuk National, kode subheader-nya yaitu 81
b. Untuk International, kode subheader-nya yaitu 91
No SMS-Centernya sendiri, dalam pasangan heksa dibalikbalik. Jika tertinggal satu
angka heksa yang tidak memiliki pasangan, angka tersebut akan dipasangkan
dengan huruf F didepannya.
Tabel Nomor SMS-Center Operator Seluler Di IndonesiaNo Operator Seluller
Center
Kode PDU
1
Telkomsel
62811000000
07912618010000F
2
Satelindo
62816125 059126181652
3
Exelcom
6218445009 07912618485400F
4
Indosat-M3 62855000000
07912658050000F
5
Starone
62811000000
079126180100
2. Tipe SMS
Untuk SEND tipe SMS = 1. Jadi bilangan heksanya adalah 01
SMS-
lain :
SMS
telex
fax
Dalam hal ini, untuk mengirim dalam bentuk SMS tentu saja dipakai 00
5. Skema Encoding Data I/O
Ada dua skema, yaitu :
1. Skema 7 bit : ditandai dengan angka 00
Oleh karena total 7 bit x 5 huruf = 35 bit, sedangkan yang kita perlukan adalah 8 bit
x 5 huruf = 40 bit, maka diperlukan 5 bit dummy yang diisi dengan bilangan 0.
Setiap 8 bit mewakili suatu pasangan heksa. Tiap 4 bit
mewakili satu angka heksa, tentu saja karena secara logika 24 = 16. Dengan
demikian kata hello hasil konversinya menjadi E8329BFD06
Ke delapan header diatas digabungkan agar membentuk suatu format PDU yang
siap dikirim. Misal untuk mengirimkan kata hello ke ponsel nomor 628129573337
lewat SMS-Center Exelcom, tanpa membatasi jangka waktu valid, maka header PDU
lengkapnya :
07912618485400F901000C9126x8237x33x3000005E8329BFD06
07912618485400F 90100 0C9126x8237x33x3 000005 E8329BFD06
07912618485400F : ok dimengerti
90100 : ini darimana maz????
0C9126x8237x33x3 : ok dimengerti
000005 : ini darimana maz???
E8329BFD06 : ok dimengerti
Penjelasan:000005:
Bentuk SMS, antara lain :
00 : dikirim sebagai SMS
01 : dikirim sebagai telex
02 : dikirim sebagai fax
Dalam hal ini, untuk mengirim dalam bentuk SMS tentu saja dipakai 00
Skema Encoding Data I/O
Ada dua skema, yaitu :
1. Skema 7 bit : ditandai dengan angka
2. Skema 8 bit : ditandai dengan angka lebih besar dari 0
Kebanyakan ponsel/SMS Gateway yang ada dipasaran sekarang menggunakan
skema 7 bit sehingga digunakan 00
Jangka Waktu Sebelum SMS Expired
Agar SMS pasti terkirim sampai ke ponsel penerima, sebaiknya tidak diberi batasan
waktu validnya.
Isi SMS
Header ini terdiri atas dua subheader, yaitu :
a. Panjang isi (jumlah huruf dari isi)
Misalnya untuk kata hello : ada 5 huruf : 05
AT
OK
AT+CMGS=?
OK
AT+CMGS=18
0791265805000F011000D91269836263184F70000FF05C8329BFD06
ERROR
This octet sequence consists of three parts: An initial octet indicating the length of
the SMSC information ("07"), the SMSC information itself ("917283010010F5"), and
the SMS_DELIVER part (specified by ETSI in GSM 03.40).
Note: on some phones (e.g. Ericssson 888?) the first three (colored) parts are
omitted when showing the message in PDU mode!
Octet(s)
Description
07
Length of the SMSC information (in this case 7 octets)
91
Type-of-address of the SMSC. (91 means international format of the phone
number)
72 83 01 00 10 F5 Service center number(in decimal semi-octets). The length of
the phone number is odd (11), so a trailing F has been added to form proper octets.
The phone number of this service center is "+27381000015". See below.
04
First octet of this SMS-DELIVER message.
0B
Address-Length. Length of the sender number (0B hex = 11 dec)
C8
Type-of-address of the sender number
72 38 88 09 00 F1 Sender number (decimal semi-octets), with a trailing F
00
TP-PID. Protocol identifier.
00
TP-DCS Data coding scheme
99 30 92 51 61 95 80
TP-SCTS. Time stamp (semi-octets)
0A
TP-UDL. User data length, length of message. The TP-DCS field indicated 7-bit
data, so the length here is the number of septets (10). If the TP-DCS field were set
to indicate 8-bit data or Unicode, the length would be the number of octets (9).
E8329BFD4697D9EC37 TP-UD. Message "hellohello" , 8-bit octets representing 7bit data.
All the octets above are hexa-decimal 8-bit octets, except the Service center
number, the sender number and the timestamp; they are decimal semi-octets. The
message part in the end of the PDU string consists of hexa-decimal 8-bit octets, but
these octets represent 7-bit data (see below).
The semi-octets are decimal, and e.g. the sender number is obtained by performing
internal swapping within the semi-octets from "72 38 88 09 00 F1" to "27 83 88 90
00 1F". The length of the phone number is odd, so a proper octet sequence cannot
be formed by this number. This is the reason why the trailing F has been added. The
time stamp, when parsed, equals "99 03 29 15 16 59 08", where the 6 first
characters represent date, the following 6 represents time, and the last two
represents time-zone related to GMT.
Interpreting 8-bit octets as 7-bit messages
This transformation is described in detail in GSM 03.38, and an example of the
"hellohello" transformation is shown here. The transformation is based on the 7 bit
default alphabet , but an application built on the PDU mode can use any character
encoding.
Sending a message in the PDU mode
The following example shows how to send the message "hellohello" in the PDU
mode from a Nokia 6110.
AT+CMGF=0 //Set PDU mode
AT+CSMS=0 //Check if modem supports SMS commands
AT+CMGS=23 //Send message, 23 octets (excluding the two initial zeros)
>0011000B916407281553F80000AA0AE8329BFD4697D9EC37<ctrl-z>
There are 23 octets in this message (46 'characters'). The first octet ("00") doesn't
count, it is only an indicator of the length of the SMSC information supplied (0). The
PDU string consists of the following:
Octet(s)
Description
00
Length of SMSC information. Here the length is 0, which means that the SMSC
stored in the phone should be used. Note: This octet is optional. On some phones
this octet should be omitted! (Using the SMSC stored in phone is thus implicit)
11
First octet of the SMS-SUBMIT message.
00
TP-Message-Reference. The "00" value here lets the phone set the message
reference number itself.
0B
Address-Length. Length of phone number (11)
91
Type-of-Address. (91 indicates international format of the phone number).
6407281553F8
The phone number in semi octets (46708251358). The length of
the phone number is odd (11), therefore a trailing F has been added, as if the phone
number were "46708251358F". Using the unknown format (i.e. the Type-of-Address
81 instead of 91) would yield the phone number octet sequence 7080523185
(0708251358). Note that this has the length 10 (A), which is even.
00
TP-PID. Protocol identifier
00
TP-DCS. Data coding scheme.This message is coded according to the 7bit
default alphabet. Having "04" instead of "00" here, would indicate that the TP-UserData field of this message should be interpreted as 8bit rather than 7bit (used in
e.g. smart messaging, OTA provisioning etc).
AA
TP-Validity-Period. "AA" means 4 days. Note: This octet is optional, see bits 4
and 3 of the first octet
0A
TP-User-Data-Length. Length of message. The TP-DCS field indicated 7-bit
data, so the length here is the number of septets (10). If the TP-DCS field were set
to 8-bit data or Unicode, the length would be the number of octets.
E8329BFD4697D9EC37 TP-User-Data. These octets represent the message
"hellohello". How to do the transformation from 7bit septets into octets is shown
here
The following table lists the AT commands that are related to the writing and
sending of SMS messages:
AT commandMeaning
+CMGS
Send message
+CMSS
Send message from storage
+CMGW Write message to memory
+CMGD
Delete message
+CMGC
Send command
+CMMS
More messages to send
One way to send AT commands to a mobile phone or GSM/GPRS modem is to use a
terminal program. A terminal program's function is like this: It sends the characters
you typed to the mobile phone or GSM/GPRS modem. It then displays the response
it receives from the mobile phone or GSM/GPRS modem on the screen. The terminal
program on Microsoft Windows is called HyperTerminal. More details about the use
of Microsoft HyperTerminal can be found in the "How to Use Microsoft HyperTerminal
to Send AT Commands to a Mobile Phone or GSM/GPRS Modem" section of this SMS
tutorial.
Below shows a simple example that demonstrates how to use AT commands and the
HyperTerminal program of Microsoft Windows to send an SMS text message. The
lines in bold type are the command lines that should be entered in HyperTerminal.
The other lines are responses returned from the GSM / GPRS modem or mobile
phone.
AT
OK
AT+CMGF=1
OK
AT+CMGW="+85291234567"
> A simple demo of SMS text messaging.
+CMGW: 1
OK
AT+CMSS=1
+CMSS: 20
OK
Here is a description of what is done in the above example:
Line 1: "AT" is sent to the GSM / GPRS modem to test the connection. The GSM /
GPRS modem sends back the result code "OK" (line 2), which means the connection
between the HyperTerminal program and the GSM / GPRS modem works fine.
Line 3: The AT command +CMGF is used to instruct the GSM / GPRS modem to
operate in SMS text mode. The result code "OK" is returned (line 4), which indicates
the command line "AT+CMGF=1" has been executed successfully. If the result code
"ERROR" is returned, it is likely that the GSM / GPRS modem does not support the
SMS text mode. To confirm, type "AT+CMGF=?" in the HyperTerminal program. If the
response is "+CMGF: (0,1)" (0=PDU mode and 1=text mode), then SMS text mode is
supported. If the response is "+CMGF: (0)", then SMS text mode is not supported.
Line 5 and 6: The AT command +CMGW is used to write an SMS text message to the
message storage of the GSM / GPRS modem. "+85291234567" is the recipient
mobile phone number. After typing the recipient mobile phone number, you should
press the Enter button of the keyboard. The GSM / GPRS modem will then return a
prompt "> " and you can start typing the SMS text message "A simple demo of SMS
text messaging.". When finished, press Ctrl+z of the keyboard.
Line 7: "+CMGW: 1" tells us that the index assigned to the SMS text message is 1. It
indicates the location of the SMS text message in the message storage.
Line 9: The result code "OK" indicates the execution of the AT command +CMGW is
successful.
Line 10: The AT command +CMSS is used to send the SMS text message from the
message storage of the GSM / GPRS modem. "1" is the index of the SMS text
message obtained from line 7.
Line 11: "+CMSS: 20" tells us that the reference number assigned to the SMS text
message is 20.
Line 13: The result code "OK" indicates the execution of the AT command +CMSS is
successful
SEND SMS:
ketik AT+CMGS=081802003868
lalu muncul >
ketik pesennyadiselesaikan dengan ctrl+z
Check if your GSM phone or modem supports SMS text mode
To check if your modem supports this text mode, you can try the following
command:
AT+CMGF=1 <ENTER>
If the modem reponds with "OK" this mode is supported. Please note that using this
mode it is onluy possible to send simple text messages. It is not possible to send
multipart, Unicode, data and other types of messages.
Setting up the modem
If the modem contains a SIM card with is secured with a PIN code, we have to enter
this pin code first:
AT+CPIN="0000" <ENTER> (replace 0000 with your PIN code).
Please not that in most cases you have only 3 attemps to set the correct PIN code.
After setting the PIN code, wait some seconds before issueing the next command to
give the modem some time to register with the GSM network.
In order to send a SMS, the modem has to be put in SMS text mode first using the
following command:
AT+CMGF=1 <ENTER>
In text mode there are some additional parameters that can be set. Using the
following command we can read the current values:
AT+CSMP? <ENTER>
The modem will reponse with a string like this:
+CSMP: 1,169,0,0OK
+CMGS: 62
The message will arrive on the mobile phone shortly.
Sending an Unicode SMS message
Some modems also have the capability to send Unicode or UCS2 messages without
encoding a PDU. You can send Unicode messages by only converting the Unicode
data to a HEX string and send this string to the modem.
To check whether your modem supports this mode, just type the following
command:
AT+CSCS=?
This commands displays the codepages supported by the modem. The modem will
respond like this:
+CSCS: ("GSM","PCCP437","CUSTOM","HEX")
If this string contains "HEX" or "UCS2", Unicode seems to be supported. To specify
that you will use an HEX string to send the message, set the codepage to "HEX" or
"UCS2" depending on the modem response. In our example we will set the modem
to "HEX" :
AT+CSCS="HEX" <ENTER>
Next, we have to specify the correct DCS (Data Coding Scheme) for Unicode
messages, which is 0x08. We can set this value by changing the fourth parameter of
the AT+CSMP command to '8':
AT+CSMP=1,167,0,8 <ENTER>
The modem is now ready to send messages as Unicode. Now is the time to send the
actual message:
AT+CMGS="+31638740161" <ENTER>
Replace the above phone number with your own cell phone number. The modem
will respond with:
>
The only thing you have to program by yourself, is a simple routine which converts
the Unicode string to an hexidecimal string like this:
165
0x04 4
LATIN SMALL LETTER E WITH GRAVE
232
0x05 5
LATIN SMALL LETTER E WITH ACUTE
233
0x06 6
LATIN SMALL LETTER U WITH GRAVE
249
0x07 7
LATIN SMALL LETTER I WITH GRAVE
236
0x08 8
LATIN SMALL LETTER O WITH GRAVE
242
0x09 9
LATIN CAPITAL LETTER C WITH CEDILLA
199
0x0A 10
LINE FEED
10
0x0B 11
LATIN CAPITAL LETTER O WITH STROKE
216
0x0C 12
LATIN SMALL LETTER O WITH STROKE
248
0x0D 13
CARRIAGE RETURN
13
0x0E 14
LATIN CAPITAL LETTER A WITH RING ABOVE
197
0x0F 15
LATIN SMALL LETTER A WITH RING ABOVE
229
0x10 16
GREEK CAPITAL LETTER DELTA
0x11 17
LOW LINE
_
95
0x12 18
GREEK CAPITAL LETTER PHI
0x13 19
GREEK CAPITAL LETTER GAMMA
0x14 20
GREEK CAPITAL LETTER LAMBDA
0x15 21
GREEK CAPITAL LETTER OMEGA
0x16 22
GREEK CAPITAL LETTER PI
0x17 23
GREEK CAPITAL LETTER PSI
0x18 24
GREEK CAPITAL LETTER SIGMA
0x19 25
GREEK CAPITAL LETTER THETA
0x1A 26
GREEK CAPITAL LETTER XI
0x1B 27
ESCAPE TO EXTENSION TABLE
0x1B0A
27 10 FORM FEED
12
0x1B14
27 20 CIRCUMFLEX ACCENT
^
94
0x1B28
27 40 LEFT CURLY BRACKET
{
123
0x1B29
27 41 RIGHT CURLY BRACKET
}
125
0x1B2F
27 47 REVERSE SOLIDUS (BACKSLASH)
\
92
0x1B3C
27 60 LEFT SQUARE BRACKET [
91
0x1B3D
27 61 TILDE ~
126
0x1B3E
27 62 RIGHT SQUARE BRACKET ]
93
0x1B40
27 64 VERTICAL BAR
|
124
0x1B65
27 101
EURO SIGN
164 (ISO-8859-15)
0x1C 28
LATIN CAPITAL LETTER AE
198
0x1D 29
LATIN SMALL LETTER AE
230
0x1E 30
LATIN SMALL LETTER SHARP S (German)
223
0x1F 31
LATIN CAPITAL LETTER E WITH ACUTE
201
0x20 32
SPACE
32
0x21
0x22
0x23
0x24
0x25
0x26
0x27
0x28
0x29
0x2A
0x2B
0x2C
0x2D
0x2E
0x2F
0x30
0x31
0x32
0x33
0x34
0x35
0x36
0x37
0x38
0x39
0x3A
0x3B
0x3C
0x3D
0x3E
0x3F
0x40
0x41
0x42
0x43
0x44
0x45
0x46
0x47
0x48
0x49
0x4A
0x4B
0x4C
0x4D
0x4E
0x4F
0x50
0x51
0x52
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
EXCLAMATION MARK
QUOTATION MARK "
NUMBER SIGN
#
CURRENCY SIGN
PERCENT SIGN
%
AMPERSAND &
38
APOSTROPHE
'
LEFT PARENTHESIS (
RIGHT PARENTHESIS
ASTERISK
*
42
PLUS SIGN +
43
COMMA
,
44
HYPHEN-MINUS
FULL STOP .
46
SOLIDUS (SLASH) /
DIGIT ZERO 0
48
DIGIT ONE 1
49
DIGIT TWO 2
50
DIGIT THREE 3
51
DIGIT FOUR 4
52
DIGIT FIVE 5
53
DIGIT SIX
6
54
DIGIT SEVEN 7
55
DIGIT EIGHT 8
56
DIGIT NINE 9
57
COLON
:
58
SEMICOLON ;
59
LESS-THAN SIGN
<
EQUALS SIGN
=
GREATER-THAN SIGN
QUESTION MARK ?
INVERTED EXCLAMATION
LATIN CAPITAL LETTER A
LATIN CAPITAL LETTER B
LATIN CAPITAL LETTER C
LATIN CAPITAL LETTER D
LATIN CAPITAL LETTER E
LATIN CAPITAL LETTER F
LATIN CAPITAL LETTER G
LATIN CAPITAL LETTER H
LATIN CAPITAL LETTER I
LATIN CAPITAL LETTER J
LATIN CAPITAL LETTER K
LATIN CAPITAL LETTER L
LATIN CAPITAL LETTER M
LATIN CAPITAL LETTER N
LATIN CAPITAL LETTER O
LATIN CAPITAL LETTER P
LATIN CAPITAL LETTER Q
LATIN CAPITAL LETTER R
!
33
34
35
164 (ISO-8859-1)
37
39
40
)
41
45
47
60
61
>
63
MARK
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
62
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
161
0x53
0x54
0x55
0x56
0x57
0x58
0x59
0x5A
0x5B
0x5C
0x5D
0x5E
0x5F
0x60
0x61
0x62
0x63
0x64
0x65
0x66
0x67
0x68
0x69
0x6A
0x6B
0x6C
0x6D
0x6E
0x6F
0x70
0x71
0x72
0x73
0x74
0x75
0x76
0x77
0x78
0x79
0x7A
0x7B
0x7C
0x7D
0x7E
0x7F
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
167
INVERTED QUESTION MARK
191
LATIN SMALL LETTER A
a
97
LATIN SMALL LETTER B
b
98
LATIN SMALL LETTER C
c
99
LATIN SMALL LETTER D
d
100
LATIN SMALL LETTER E
e
101
LATIN SMALL LETTER F
f
102
LATIN SMALL LETTER G
g
103
LATIN SMALL LETTER H
h
104
LATIN SMALL LETTER I
i
105
LATIN SMALL LETTER J
j
106
LATIN SMALL LETTER K
k
107
LATIN SMALL LETTER L
l
108
LATIN SMALL LETTER M m
109
LATIN SMALL LETTER N
n
110
LATIN SMALL LETTER O
o
111
LATIN SMALL LETTER P
p
112
LATIN SMALL LETTER Q
q
113
LATIN SMALL LETTER R
r
114
LATIN SMALL LETTER S
s
115
LATIN SMALL LETTER T
t
116
LATIN SMALL LETTER U
u
117
LATIN SMALL LETTER V
v
118
LATIN SMALL LETTER W w
119
LATIN SMALL LETTER X
x
120
LATIN SMALL LETTER Y
y
121
LATIN SMALL LETTER Z
z
122
LATIN SMALL LETTER A WITH DIAERESIS
LATIN SMALL LETTER O WITH DIAERESIS
LATIN SMALL LETTER N WITH TILDE
209
196
214
241
224
228
246
220
252
Komunikasi dengan handphone ini dilakukan melalui terminal yang ada di bagian
bawah handphone seperti pada gambar diatas dan digunakan juga untuk
menyambungkan charger baterai. Susunan pin pada terminal ini dapat dilihat dalam
tabel dibawah ini.
Tabel
1
2
3
4
5
6
7
8
9
10
11
12
Untuk dapat berkomunikasi dengan handphone ini diperlukan koneksi serial dengan
baudrate 19200 bps. Level tegangan yang digunakan adalah jenis TTL dengan
logika high = + 3 Volt dan logika low = + 0 Volt. Kabel data khusus Handphone ini
telah didesain khusus untuk mengubah level tegangan RS 232 ke level tegangan
TTL khusus siemens M35. Tabel dibawah ini menunjukkan perbandingan level
tegangan RS 232 dengan level tegangan TTL Siemens M35.
RS232 sebagai komunikasi serial mempunyai 9 pin yang memiliki fungsi masingmasing. Pin yang biasa digunakan adalah pin 2 sebagai received data, pin 3 sebagai
transmited data, dan pin 5 sebagai ground signal.
menggunakan program yang telah ada. Program yang telah ada hanya bersifat
terminal aja yaitu
Hyperterminal (yang terdapat pada Start -> All Program -> Accessories ->
Communications -> Hyperterminal.)
cukup satu kata yang terucap kemudian ditulis, dah bisa yang namanya komunikasi
lewat port serial.