SM5100B GSM/GPRS modem – useful AT commands

Latest version of this document can be found under source control here on github.

1) Reboot modem

at+cfun=1,1

+SIND: 1

+SIND: 10,”SM”,1,”FD”,1,”LD”,1,”MC”,1,”RC”,1,”ME”,1

+SIND: 11

+SIND: 3

+SIND: 4

OK

2) save settings (whatever can be saved) to non-volatile memory

at&w

3) display error text instead of error code

at+cmee=2

4) enable local echo

ate1

5) date time (which will be incorrect)

check date time:

at+cclk?

+CCLK: “14/03/15,00:12:18”

OK

set date time:
total 17 chars formatted as – “yy/mm/dd, hh:mm:ss”

AT+CCLK=”13/09/20,23:10:10”

minicom trace

6) check misc status flags

at+cind?

+CIND: 0,19,1,0,1,0,0,0

OK

The format is:

+CIND: <battery>, <signal level>, <service>, <sounder>, <message>, <call>,
<roam>, <smsfull>

<Descr> description
– battery Voltage of battery
– signal Strength of signal (0-31)
– service Availability of network (0-1) (value=1 means registered to network)
– sounder Stillness (0-1) (1=mute)
– message Whether receive short messages (0-1)
– call Existence of a call (0-1)
– roam Net status (0-1) (1=roam status)
– smsfull Short message memory storage has become full(1), or memory locations are available(0)

7) display sms in plain text

at+cmgf=1

OK

8) read sms at specified index (0 is invalid)

at+cmgr=1
+CMGR: “REC READ”,0,”+14088494245″,”13/07/26,23:34:24+00″
Hello cellular prowl

OK
at+cmgr=2
+CMGR: “REC UNREAD”,0,”+14088494245″,”13/07/26,23:36:40+00″
Meow meow purrrr

OK

9) delete sms at specified index (1 in this case)

at+cmgd=1,0

OK
at+cmgr=1

+CMS ERROR: Invalid memory index

The format is:

AT+CMGD=<index>[,<DelFlag>]

<index>: index num of chosen memory <mem1>,which should be less than the maximum num item of <mem1>

<DelFlag> description
– 0 Delete an message according to index
– 1 Delete all readed messages
– 2 Delete all readed or sent messages
– 3 Delete all readed or sent or unsent messages
– 4 Delete all messages

10) list all sms

at+cmgl=”ALL”
+CMGL: 2,0,”REC READ”,”+14088494245″,”13/07/26,23:36:40+00″
Meow meow purrrr

OK

11) make a call

atd0123456789

12) hang up a call (ringing or received)

ath

13) answer a call

ata

14) send sms

at+cmgs=”0123456789″

> hello kitty▒
+CMGS: 1

OK

NOTE: That funny character above is ctrl+z; sending ctrl+z is equivalent to sending a single byte with the hex value: 0x1a

Advertisements

RaspberryPi with SM5100b GSM GPRS cellular shield

RPi

I am going to try porting my PC python script for interfacing to the SM5100b directly to the RPi instead of converting it to an Arduino program.

UPDATE: Wow… it was easier than I thought it would be. I was able to quickly get to the same level of functionality as that previous post in less than an hour. Here is the push message posted to Prowl app using the cellular shield by a python script running on the Raspberry Pi.

Updates project files should show up on my github soon.

IMG_3379[1]

TCP connection over GPRS with SM5100B module

After having no success sending GET requests to HTTP servers I finally decided to set up my own tcp server by directing a port on my router to my PC and setting up a simple tcpserver listener in cygwin like this:

~ > tcpserver -t1000 -v -Bare_we_receiving 0 9876 bash -c "sleep 1000"
tcpserver: status: 0/40

Then I sent the following commands to the modem

AT+CGATT? 
AT+CGDCONT=1,"IP","epc.tmobile.com" 
AT+CGPCO=0,"None","",1 
AT+CGACT=1,1
AT+SDATACONF=1,"TCP","MY_ROUTER_ADDRESS",9876 
AT+SDATARXMD=1,1,0
AT+SDATASTART=1,1

For some reason the MY_ROUTER_ADDRESS had to be the text host name instead of the IP address, which was something like c-blah-blah.comcast.net for me as per my router.

Immediately I saw a connection appear in the tcpserver log:

tcpserver: status: 1/40
tcpserver: pid 5232 from 208.54.32.166
tcpserver: ok 5232 :::ffff:192.168.1.111:9876 :::ffff:208.54.32.166::50107
tcpserver: end 5232 status 256
tcpserver: status: 0/40

And then some data was received on the GPRS modem side:

> +STCPD:1
>

Which I read back promptly:

AT+SDATASTATUS=1
> +SOCKSTATUS: 1,1,0102,54,0,16
> 
> OK
>
AT+SDATAREAD=1
> +SSTR:1,are_we_receiving
> 
> OK
>

And it exactly matched the banner text. So atleast I can establish TCP connections. The AT command interface though is a real pain.

Basic testing the SM5100B

SM5100B GSM GPRS modem setup

The parts for the first phase have arrived and basic functionality of the GSM modem was tested and found to be operational. Here is a log of the modem receiving a phone call:

+SIND: 1
+SIND: 10,"SM",1,"FD",1,"LD",1,"MC",1,"RC",1,"ME",1
+SIND: 11
+SIND: 3
+SIND: 4
RING
RING

Here is a list of what I’m using:

  1. From SparkFun
    1. SM5100B Evaluation Board
    2. GSM/GPRS Module – SM5100B
    3. Quad-band Cellular Antenna SMA
  2. From EvilMadScience
    1. 5V, 3A Regulated Power Supply
  3. From BG Micro
    1. 2.5mm Jack To 2.1mm Plug

I also tested receiving SMS text messages but it seems that, they aren’t pushed over the UART. Instead I had to poll to check if I had received any new SMS messages.

+CMGL: 1,0,"REC READ","1511","12/09/09,00:29:11+00"
Welcome to T-Mobile! Dial #BAL# to check your balances. Your T-Mobile number is 1***412****
+CMGL: 2,0,"REC READ","+1***721****","12/09/09,01:14:02+00"
Hello, world
+CMGL: 3,0,"REC READ","+1***721****","12/09/09,01:16:33+00"
Hello, world 2

I am currently using this with a T-Mobile pay-by-the-day plan which gives me unlimited voice, text, and 2G data for $2 per day.

Next I am going to spend some time thinking about how I want to proceed.