tensixtyone

Rants of Andrew Williams / Nik_Doof

Howto: Send SMS using a Huawei E160G and Debian

with 11 comments

People who use their Huawei E160G on Three will know that in the Windows client you can send and receive SMS, this will come at some minor cost of £0.10 per SMS, and you can add bundles onto your mobile broadband account to make this cheaper.

Similar functionality can be achieved in Linux, and it’s very useful if your like me and want to drop someone a message when you don’t have your phone around.

For this we’ll be using Gammu, which is a toolset for managing phones via the AT GSM command set. It was originally forked from Gnokii, which was a similar toolset for Nokia handsets. As the E160G opens a serial port with access to the AT command set this is a relatively easy tool to setup.

First of all, we need to grab the packages. As these are standard Debian packages you should have no issues.

# sudo apt-get install gammu

Next, we need to configure Gammu to pickup the correct device. Check your dmesg for the serial port:

$ dmesg|grep tty
[12321.308078] usb 5-3: GSM modem (1-port) converter now attached to ttyUSB0
[12321.308275] usb 5-3: GSM modem (1-port) converter now attached to ttyUSB1

Edit ~/.gammurc, or run gammu-config to change the device settings. Your ~/.gammurc file should look similar to:

[gammu]
port = /dev/ttyUSB0
model =
connection = at19200
synchronizetime = yes
logfile =
logformat = nothing
use_locking =
gammuloc =

Give it a test by getting all the SMS from the device:

# gammu getallsms

This should bring back all the SMS currently stored on the stick, which should include your login details for the Three website (unless you’ve deleted them). To send a SMS use the “sendsms” command:

$ gammu sendsms text 07874454543
Enter message text and press ^D:
Test Message!!!!!1!
Sending SMS 1/1....waiting for network answer..OK, message reference=2

Gammu has a lot more tools and options to explore, now you have the basic config you can setup a SMSD, which can expose the ability to send SMS to a network. Also, Gammu has a python interface so you can possibly build your own frontend client for sending SMS. For more details explore the Gammu Wiki.

Written by Andrew Williams

October 17th, 2008 at 11:53 am

11 Responses to 'Howto: Send SMS using a Huawei E160G and Debian'

Subscribe to comments with RSS or TrackBack to 'Howto: Send SMS using a Huawei E160G and Debian'.

  1. i will have to give tihs a try with the acer one. could be useful.

    zabouth

    18 Oct 08 at 10:14 am

  2. swamytk, You tried Huawei E160G phone with gammu, whereas i’ve nokia 6600 and nokia 3310 which i want to use with gammu to make it my home SMS gateway. Actually I’d prefer 3310 because i can dedicate that old phone for that job but problem is that is not working now properly, whereas it was just working fine for two months, I followed the following guide

    http://www.syednetworks.com/opensourc-sms-gateway-using-gammu-and-mysql

    Now from last few days my PC do not recognize my phone even i changed cable but same happend. Can you help me what can be done here?

    saher

    25 Oct 08 at 8:51 pm

  3. Hi
    I tried this and it works for a while , then I get the “No response in specified timeout..” message and the only way to get working is to remove and reinsert the E160. Anyone else hit this problem. Ive now tried a couple of machines both running Ubuntu 8.10

    Jon

    11 Feb 09 at 10:31 am

  4. I’ve tried gammu with a huawei u526. It doesn’t work with gammu –identify, it only mentioned that the device does not exist. What does this mean? What do I do?

    Lim Soo Kwang

    23 Feb 09 at 5:11 pm

  5. Hi, Andrew! I’ve tried this utility on my Mac. After searching the correct device file, I’ve managed to send my other number an sms! :D But is it possible to use gammu while still using the Internet from the modem? Right now I have to disconnect my Internet connection first before using gammu sendsms etc. Thanks.

    Okky

    7 Mar 09 at 11:08 am

  6. Hi Andrew,

    I’m trying to make it work with a Huawei E220, but I got no answere by the modem.

    When I do gammu –identify, no answere is given and the terminal stay stoped until I hit ctrl+c

    Any other tutorial to work around this?

    This is my dmesg output:
    feijo@pegasus:~$ dmesg | grep tty
    [ 0.004000] console [tty0] enabled
    [ 19.570998] usb 3-2: GSM modem (1-port) converter now attached to ttyUSB0

    gammurc is like this
    [gammu]
    port = /dev/ttyUSB0
    model =
    connection = at19200

    Gustavo Feijo

    26 Mar 09 at 7:15 pm

  7. Hi Lim Soo,

    Try PyHumod for your Huawei u526:
    http://code.google.com/p/pyhumod/
    Cheers

    rampier

    28 Jun 09 at 6:33 pm

  8. Thanks Andrew – just used your starting point to read the SMS messages off my Huawei E1550 from Three. Very much appreciated.

    Horridbloke

    9 Sep 09 at 8:47 pm

  9. hello
    didnt have much luck at getting gammu to work with the huawei e220, although didnt try for that long.
    anyway found this page http://designbuildtestrepeat.wordpress.com/2008/04/29/huawei-e220-on-linux-for-sms/ and had no trouble sending sms with minicom. i didnt bother with the script either, just installed minicom, adjusted the settings and bobs your uncle

    you

    13 Sep 09 at 7:00 pm

  10. If you look at the dmesg output you’ll see 2 ports registered ttyUSB0 and ttyUSB1. I got mine working by setting the port to ttyUSB1 in the config file.

    Gavin McCord

    18 Sep 09 at 8:05 pm

  11. Bloody brilliant…
    I couldn’t figure out the “connection” string.

    Thanks – SMS alerts from server now :-)

    MacGyver

    18 Dec 09 at 1:29 am

Leave a Reply