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]

Giving Arduino a second UART over I2C by stacking another Arduino on top

Now that I have the Cellular modem working with the PC over serial I am trying to get the same thing implemented on an Arduino. Since the modem uses the serial interface I will not be able to use that to debug my program via a serial terminal running on my PC.

I tried using the SoftSerial (or the NewSoftSerial) library but ran into data corruptions even at the low speeds, so I decided to look for other ways to get another hardware UART on the Arduino. For a while I was contemplating getting a Mega Pro from Sparkfun but its price was a turnoff. In the end I realized that I could just stack another Arduino on my Diavolino (both interfaced to each other over I2C as master slave) and after trimming the UART rx/tx shield pins be able to separate out the two UARTs.

The other issue is that the UART pins of the Cellular modem are not 5V tolerant. This had not affected me till now since I was using the Adafruit FTDI friend at 3.3V logic levels when connecting to the PC serial port. So I could not get another 5V Diavolino. In the end I decied to get a 3.3V Arduino Pro and stack that on top of my 5V Diavolino.

Overall the connections will look something like the following diagram:

arduino extra serial port plan

Note that when I drew this I was planning on using another Diavolino at 3.3V but decided against it since it seemed like more work because I would need to get the 3.3V regulator on my own and also somehow get an 8MHz AVR chip for it. In hind sight this may not have been a good idea since the Arduino Pro seems to be connecting both the Vcc pins in the header to 3.3V. The Diavolino instead has them separated which seems more sensible to me.

Another thing I forgot to show in the diagram above are the pull up registers for the I2C lines (SDA & SCL) between the two Arduino boards. I am hoping that connecting those to 3.3v would work for the 5v arduino, but I am not sure.

State Machine based serial interface to SM5100b shield in Python

Ever since I got TCP data rx/tx working on the SparkFun SM5100b GSM/GPRS shield I have been prepping for the next step which is to get HTTP GET requests working. The problem I seem to be having here is that the HTTP server disconnects the TCP connection immediately after sending the response to the GET request, and I am not able to transfer the TCP data received using the AT command after the TCP connection has been disconnected.

Yesterday I finally got a state machine based serial interface written in Python working. The input to the Python script is a state machine description written in a YAML file.

Dummy Shimmy

Here is the script:

https://github.com/cyclicredundancy/VCX/blob/master/projects/cellular_prowl/modem_driver.py

And here is a very simple YAML state machine file for the boot up sequence:

https://github.com/cyclicredundancy/VCX/blob/master/projects/cellular_prowl/cellular_state_machine.yaml

Coding up something equivalent for the Arduino will be a pain.

Finally, transfers over TCP are working with the SM5100B!!

Thanks to some help from a blog post about GPRS with the SM5100B Arduino GSM Shield by Hadley Rich I was finally able to get the TCP connection working. I will add more details on this when I get time.

Here is a screen shot of the shield transmitting the byte character “B” followed by CR and LF to a Perl TCP server running on my PC, and then receiving one copy of the message “[9212]AsYouWish” in return for each byte.

Sparkfun GSM/GPRS SM5100b shield on a Diavolino

I have decided to return the SM5100B evaluation board since I am instead using the SM5100B cellular shield. This is because I was not really going to use any of the interface pins of the SM5100B module broken out on the eval board. One useful thing about the shield (that I wasn’t expecting) is that it is able to reset the cellular module using the on board reset button similar to the eval board.

8008528875_923b20b2d9_z

The Diavolino board here is running without any AVR 328 mega chip plugged into it, and has the 2.5mm x 5.5mm power barrel socket for the 5V 3A regulated power supply from EvilMadScience.

Diavolino hosting a GSM/GPRS shield

Meanwhile although I can receive TCP data on the SM5100B modem over GPRS I still haven’t been able to successfully confirm transmission of data.