Skip to content

Instantly share code, notes, and snippets.

@damonsk
Created October 25, 2012 20:08
Show Gist options
  • Star 13 You must be signed in to star a gist
  • Fork 8 You must be signed in to fork a gist
  • Save damonsk/3955099 to your computer and use it in GitHub Desktop.
Save damonsk/3955099 to your computer and use it in GitHub Desktop.
Installing Gammu on Raspberry Pi, Huawei E220
# Send SMS messages using Raspberry Pi.
# Using gammu and Huawei E220
# Prepare SD card with wheezy.
# Login / complete rasp-config / reboot / login
# Set vimrc to prevent annoying ADBC arrow keys
cp /etc/vim/vimrc ~/.vimrc
# Set network (can be skipped)
vi /etc/network/interfaces
auto eth0
iface eth0 inet static
address 192.168.1.198
netmask 255.255.255.0
gateway 192.168.1.254
# Set nameservers (can be skipped)
vi /etc/resolv.conf
domain lan
search lan
nameserver 8.8.8.8
nameserver 8.8.4.4
# Restart network
/etc/init.d/networking restart
# Install Gammu (python-gammu and gammu-smsd can be skipped - depending on requirements)
apt-get install gammu
apt-get install python-gammu
apt-get install gammu-smsd
# Find port USB device connected to
dmesg | grep tty
[ 7.578478] usb 1-1.2: GSM modem (1-port) converter now attached to ttyUSB0
[ 7.697942] usb 1-1.2: GSM modem (1-port) converter now attached to ttyUSB1
# Config gammu
gammu-config
# Check connected
gammu --identify
Device : /dev/ttyUSB0
Manufacturer : Huawei
Model : E220 (E220)
Firmware : 11.117.03.01.156
IMEI : 3XX19301XXXXXX3
SIM IMSI : 2XXXX923271XXX1
# Test with a text message
echo "some message" | gammu --sendsms TEXT 07921XXXXXX
@Siros96
Copy link

Siros96 commented Mar 8, 2014

Hi thanks for sharing your knowledge..
but I have a problem.. when I try to send the test message.. here's what I got:

pi@raspberrypi ~ $ echo "test" | sudo gammu sendsms TEXT XXXXXXXXXX
If you want break, press Ctrl+C...
Sending SMS 1/1....waiting for network answer..error 500, message reference=-1
Unknown error.

Do you know what that error 500 means ??
Thanks in advance..

@Siros96
Copy link

Siros96 commented Mar 8, 2014

by the way I'm using the same equipment.. the raspberry pi and the huawei E220

Thanks.

@intruxxer
Copy link

I experienced that one time, most likely the SIM has no credit balance or has no signal. You may check your own modem.

@bijilbaji
Copy link

had the same problem with E1731 bu worked fine after i changed the network setting from 3G to auto or GSM.

@ralfiii
Copy link

ralfiii commented Aug 2, 2016

When I install python-gammu using "sudo apt-get install python-gammu", then it's installed and available in Python2, but not in Python3.

When I try to install it with "sudo pip install python-gammu" (where I could use pip3 for Python3), nothing works - see http://stackoverflow.com/questions/32097420/how-to-install-python-gammu-on-raspberry-pi

Any hints for me?

@frankge973
Copy link

frankge973 commented Feb 1, 2017

Excuse me but I installed GAMMU on a Raspberry PI and I have a problem. If I give gammu --networkinfo it says always requesting network GPRS detached. SIM card is working and has credit but I cannot send with gammu.

root@raspbx:~# dmesg | grep ttyUSB
[ 6.316168] usb 1-1.3: GSM modem (1-port) converter now attached to ttyUSB0
[ 6.340965] usb 1-1.3: GSM modem (1-port) converter now attached to ttyUSB1
[ 6.376561] usb 1-1.3: GSM modem (1-port) converter now attached to ttyUSB2

Gammu identifies it:

root@raspbx:~# gammu --identify
Device : /dev/ttyUSB2
Manufacturer : Huawei
Model : E169 (E169)
Firmware : 11.314.13.51.156
IMEI : XXXXXXXXXXXXXXX
SIM IMSI : YYYYYYYYYYYYYYY

But network is not working even if SIM card is active and has credit. (I tried also another one).

root@raspbx:# gammu --networkinfo
Network state : requesting network
Packet network state : requesting network
GPRS : detached
root@raspbx:
# gammu --networkinfo
Network state : requesting network
Packet network state : requesting network
GPRS : detached
root@raspbx:~# gammu --networkinfo
Network state : requesting network
Packet network state : requesting network
GPRS : detached

@xoxp
Copy link

xoxp commented Feb 6, 2018

frankge973 the response means the modem has not found a gsm network at all, no signal

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment