Thursday, October 24, 2013

Basic Modem Communication (Initializing a ZTE MF627 Modem) Part II: The AT Commands

Now that we know how to open the modem port the next thing we need to do is to initialize it by sending the proper AT commands to the modem. I sniffed some commands from my modem I'm just not sure if all of them are needed but I'm still posting all of them anyway :D

This is the AT commands sequence I'm using. You need to send these commands(from top to bottom) one by one with atleast 200 milliseconds interval.
AT+ZUSIM=?
AT+CPBS="SM"
AT+CPBR=?
AT+CPBS="SM"
AT+CPMS="SM","SM","
AT+CGSN
AT
AT+ZSEC=?
AT+ZOPRT?
AT+GMR
AT+CGSN
AT+CGMM
AT+GMR
AT+CGSN
AT+CGMM
AT+CPIN?
AT+ZECC?
AT+ZSEC?
AT+ZSTART
ATE0
AT+ZPAS?
AT+ZDON?
AT+CSQ
AT+ZDON?
AT+ZPAS?
AT+CLCK="SC"
AT+CPMS=?
AT+CLVL?
AT+CGDCONT=1,"IP","internet",,0,0
AT+ZBANDI?
AT+CSCA?
AT+ZSMSD?
AT+ZSNT?
AT+ZBANDI?
AT+ZUSIM=?
AT+CPBS="SM"
AT+CPBR=?
AT+ZCPBR=?
AT+CPBR=1,20
AT+CPBR=21,40
AT+CPBR=41,60
AT+CPBR=61,80
AT+CPBR=81,100
AT+CPBR=101,120
AT+CPBR=121,140
AT+CPBR=141,160
AT+CPBR=161,180
AT+CPBR=181,200
AT+CPBR=201,220
AT+CPBR=221,240
AT+CPBR=241,250
AT+CSCS="IRA"
AT+CLVL?
AT+CLIP=1
AT+CMGF=0
AT+CNMI=3,1,0,2,0
AT+CSQ
AT+ZDON?
AT+ZPAS?
AT+CPMS="ME","ME",""
AT+CMGL=4
AT+CPMS="SM","SM",""
AT+CMGL=4
AT+CSQ
AT+ZDON?
AT+ZPAS?
AT+CSQ
AT+ZDON?
AT+ZPAS?
AT+CSQ
AT+ZDON?
AT+ZPAS?
AT+ZCSPOWER
After sending these commands successfully you can now use your modem to do other tasks like send/receive sms, phonebook, etc. To check if our modem really did initialize let's try getting the signal strength.
AT+CSQ
AT+ZDON?
AT+ZDON?
Sending these commands to the modem will give you the signal strength in this format "+CSQ:18,99" where 18 is the signal strength. The signal strength/quality value range from 2-30(30 = excellent quality) and has a corresponding dBm value. In my example 18 means -77 dBm(30 = -53 dBm). You can use the following table as reference.

Value RSSI dBm Condition
2 -109 Marginal
3 -107 Marginal
4 -105 Marginal
5 -103 Marginal
6 -101 Marginal
7 -99 Marginal
8 -97 Marginal
9 -95 Marginal
10 -93 OK
11 -91 OK
12 -89 OK
13 -87 OK
14 -85 OK
15 -83 Good
16 -81 Good
17 -79 Good
18 -77 Good
19 -75 Good
20 -73 Excellent
21 -71 Excellent
22 -69 Excellent
23 -67 Excellent
24 -65 Excellent
25 -63 Excellent
26 -61 Excellent
27 -59 Excellent
28 -57 Excellent
29 -55 Excellent
30 -53 Excellent

If your modem respond to your signal query that means you're good to go. Just parse the +CSQ response using regex and get only the signal quality then you can forward it to a progress bar or where ever you want.

TO BE CONTINUED AGAIN...

PS: I know I suck at explaining and I'm not good at english either :D I just wanted to put something in my blog just like any other blogger lol

Unknown

I'm a modern human swiss knife. Not sure why I'm a coder I can't even rember the simplest syntax in any language lol. But I'll do anything for food so yeah I'm a programmer. And a fast one *wink*

0 comments:

Post a Comment

 

Copyright 2017 Code Monkey