Friday, October 21, 2011

Getting a USB GSM modem working on Ubuntu (part II)

After getting the USB modem successfully detected as a modem on Ubuntu, the next step is to try it out, and use it to send some SMS.

I use the program Minicom.

First install Minicom
$ sudo apt-get install minicom

The installation is fast and straightforward.

Configure Minicom's serial port as root

$ sudo minicom -s -c on

The minicom's text box menu should appear with the following options:
Filenames and paths
File transfer protocols
Serial port setup
Modem and dialing
Screen and keyboard
Save setup as dfl
Save setup as..
Exit
Exit from Minicom

Select "Serial port setup". Under the setup,
A - Serial Device : dev/ttyUSB2
B - Lockfile location : /var/lock
C - Callin Program :
D - Callout Program :
E - Bps/Par/Bits : 115200 8N1
F - Hardware Flow Control : Yes
G - Software Flow Control : No

There are /dev/ttyUSB0, USB1, and USB2 associated with the modem. Selecting ttyUSB0 or ttyUSB1 causes Minicom to freeze at "initializing modem" stage, and only ttyUSB2 works.

Back to the top menu, select "Save setup as dfl" to save the serial port setup to the file "/etc/minicom/minirc.dfl". This step requires root access. and is the reason for running Minicom with sudo. Once serial port is configured, the subsequent run of minicom can be without sudo.

Select "Exit" to exit the configuration menu. Minicom should briefly show a text box that says "Initializing Modem". When initialization is done, the terminal shows:

Welcome to minicom 2.4

OPTIONS: I18n
Compiled on Jan 25 2010, 06:49:09.
Port /dev/ttyUSB2

Press CTRL-A Z for help on special keys

AT S7=45 S0=0 L1 V1 X4 &c1 E1 Q0
OK


to send an SMS using AT commands inside Minicom
Type the following AT commands:

  • type "AT+CMGF=1", press , the response should be OK
  • type "AT+CMGS="+1408xxxxxxx", press , the prompt > should appear next
  • after the prompt >, type the SMS text
  • type Ctrl-Z to end the SMS text
  • should see the response "+CMGS: " followed by "OK"

Here is how it looks like in the Minicom terminal:

AT
OK
AT+CMGF=1
OK
AT+CMGS="+1408xxxxxxx"
> test sending SMS from Ubuntu on Oct 21, 2011

+CMGS: 24

OK


Great! Now I can send SMS using the GSM modem on Ubuntu!

1 comment:

  1. Hello, I've followed the procedure. I can run AT commands but at the end of entering text i get ERROR.
    I use D-Link DWM156 on Ubuntu x64 and I have installed the .deb package

    Do you have any solutions

    ReplyDelete