Quality Guru's – Home of QA/QE SW Testing Workshops

February 28, 2010

Test Status to SMS/MMS: Sending SMS messages with dedicated GSM modem device

Filed under: Test Status to SMS/MMS — natiku @ 4:48 pm


This entry is part of Test Status to SMS/MMS workshop.

Sending SMS messages with dedicated GSM modem device

Selecting a Modem device and Mobile Provider

As a GSM mode device I select a simple & bheap USB stick – my preference is Huawei E160, it is sold across Europe,
can attach optional antenna and it’s have direct support in Linux kernel from 2.6.20+ without need to install
any additional drivers and/or configurations.

As GSM network Mobile provider I select Prepaid cars Twist for T-mobile, it has good signal at my home and
support checking of credit balance and expiration date over SMS, which I will demonstrate later.

Looking on SMS Functionality and Modem Commands first

If you are new to modems (Hayes stuff) and/or to SMS functionality I recommend to study Short Message Service/SMS Tutorial
Don’t worry if content looks too technical for you, we will use later a bunch of different tools to provide this tasks,
however is good to know basics of direct communication with modem in case then you will need debug thinks later.

Installing GSM modem and sending your first SMS

I recommend you to attach USB GMS modem with 3m long USB extension cable,
especially if don’t have external antenna, it will help you find place with best GSM signal.

Put SIM card into E160 modem (near USB connector) and connect it to USB slot.

Power of computer and boot some latest Linux distro, in my case Fedora 12

In dmesg (Boot messages) you will see lines like this:

dmesg | grep -A 1 -B 12 GSM
scsi8 : SCSI emulation for USB Mass Storage devices
usb-storage: device found at 2
usb-storage: waiting for device to settle before scanning
scsi9 : SCSI emulation for USB Mass Storage devices
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
usb-storage: device found at 2
usb-storage: waiting for device to settle before scanning
usbcore: registered new interface driver usbserial
USB Serial support registered for generic
usbcore: registered new interface driver usbserial_generic
usbserial: USB Serial Driver core
USB Serial support registered for GSM modem (1-port)
option 2-3:1.0: GSM modem (1-port) converter detected
usb 2-3: GSM modem (1-port) converter now attached to ttyUSB0
option 2-3:1.1: GSM modem (1-port) converter detected
usb 2-3: GSM modem (1-port) converter now attached to ttyUSB1
usbcore: registered new interface driver option
option: v0.7.2:USB Driver for GSM modems

Now we can connect to E160 GSM modem’s AT commands port /dev/ttyUSB1 with minicom terminal software

yum install minicom

ln -s /dev/ttyUSB1 /dev/modem

minicom

First remove PIN protection from SIM card (Here my pin is 1234)

AT+CPIN=1234
OK
AT+CLCK="SC",0,"1234"
OK
AT+CPIN?
+CPIN: READY
OK

Second check if SMS center number is already configured

AT+CSCA?
+CSCA: "+420608005681",145
OK

Switch to text mode to be able write SMSes in comfort way

AT+CMGF=?
+CMGF: (0-1)
OK

AT+CMGF?
+CMGF: 0
OK

AT+CMGF=1
OK

Where SMSes are stored ? (By default is in SIM card)
Note: If your card show on 10 max messages is old and you can probably replace it to new one on your Network provider

AT+CPMS?
+CPMS: "SM",2,25,"SM",2,25,"SM",2,25

List ALL SMS Messages stored in card
Note: There is a READ command, if you use it you can filter new SMS messages which was not read yet

AT+CMGL="ALL"
+CMGL: 1,"REC READ","4603",,"10/02/26,14:52:28+04"
Blahoprejeme vam k porizeni predplacene karty Twist. Podrobne informace o nasic.
OK

Now try to send some free SMS , consult your provider for free SMS based services, for T-mobile Czech (Prepaid TWIST)

AT+CMGS="4603"[Press Enter here]
> TARIF[Press Ctrl-Z here]
+CMGS: 2
OK

We will receive as answer a SMS with credit, expiration date and services program

AT+CMGL="ALL"
+CMGL: 1,"REC READ","4603",,"10/02/26,14:52:28+04"
Blahoprejeme vam k porizeni predplacene karty Twist. Podrobne informace o nasich sluzbach vam poskytne bezplatna Infolinka T-Mobile na cisle 4603. Vas T-Mobile.
+CMGL: 4,"REC READ","5602",,"10/02/26,16:51:48+04"
T-Mobile: Vazeny zakazniku, dobiti Twist karty s telefonnim cislem 605311031 probehlo uspesne. Kredit byl navysen o 300 Kc. Kod transakce je 936215562.
+CMGL: 0,"REC UNREAD","4603",,"10/02/26,17:24:54+04"
Tarif: Twist Pratele, kredit: 306.5 Kc, vyprsi: 01.03.2011, z toho bonusovy kredit: 0 Kc.
OK 

Congratulations!, you send you first SMS directly with GSM modem’s AT commands.
If you can’t send SMS, don’t worry, I will will show you some trouble shutting with AT next time.

Exit minicom with CTRL-A-Z X

Advertisements

Leave a Comment »

No comments yet.

RSS feed for comments on this post.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: