I currently use mobile broadband as my primary Internet connection and this worked great on my Linux PCs for a while. The GSM modem I'm using every day is good old Huawei e220, but there is one aspect of this great hardware device I haven't used on my Linux PCs, and that is sending/receiving SMS messages. In this article I will show you how to send and receive SMS messages using GSM modem or phone on Ubuntu Linux PC.
Lets begin. We don't really want to enter our administration password every time we want to send SMS message, so first thing we must do is to add our selves to the
dialout user group. All members of this group have permission to use modem-like devices on Ubuntu system. This is how we do it:
sudo adduser $USER dialout
Now we can install great Linux application Gammu and its GTK frontend Wammu, again here's how:
sudo apt-get install gammu wammu
Before configuring our modem we must know a few things about it. First thing you should do is go to the Gammu phone database and find your GSM device. In this how to I will use my Huawei e220, with Gammu phone database page here. On this page I've found first data we need to configure Gammu, the
connection parametar that is
at19200 in my case. You should obtain the
connection parameter for your GSM device on its Gammu phone database page.
Also you must find your GSM device entries inside
/dev directory. You will recognize this entries because they usually start with "tty" prefix. On my hardware this device entry is named
ttyUSB1. You can also check
dmesg this way:
Here's output of this command on my hardware:
marko@marko-pc:~$ dmesg|grep tty [ 0.000000] console [tty0] enabled [ 8.103849] usb 2-2: GSM modem (1-port) converter now attached to ttyUSB0 [ 8.103998] usb 2-2: GSM modem (1-port) converter now attached to ttyUSB1
Now you can use
gammu-config to configure your hardware or you can write Gammu configuration file manually. Here's how to do it using
Here's how you will setup your hardware with port
ttyUSB0 and connection parameter
at19200 I'm using for my Huawei e220 GSM modem:
After you set configuration options you can save changes and you will get Gammu configuration file
.gammurc file inside you home directory. You can also save this file for future use once you are sure that configuration it contains is correct.
Important notice: Network manager has tendency to lock your GSM device once you start your GSM Internet connection. The device stays locked even after you disconnect so you must make sure that right click on Network manager -> Enable mobile broadband option is unchecked before you use Gammu. If this option is enabled you will get permission denied errors from Gammu.
After we got that right I will show you how to check your SIM card messages the CLI way and how to start the GTK Gammu GUI called Wammu. To view all messages on your SIM card using CLI you can use something like this:
For more about CLI usage you can check Linux manual pages usin
man gammu command. To send and receive SMS messages using you GSM device you can also use GUI frontend to Gammu called Wamu. You will find this program by navigating to the Applications -> Accessories -> Wammu. Then you can go to Phone -> Connect. If the connection to the modem is successfully established you can use Retrieve menu to get messages or contacts from your SIM card and Create menu to send new SMS messages. If connection couldn't be established then you need to double check port and connection parameter you have used to configure Gammu. Cheers!