Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive
 

Following page describes how to use a ZTE ML190 USB drive to receive SMS and forward them to another mobile phone number. But you can also send the SMS in an eMail or do other stuff. You can control any devices at home, i.e. turn on or turn off some device, open and close your garage and much more.

 

Hardwaredetails

Following description is for a ZTE ML190 USB Stick

lsusb
Bus 001 Device 009: ID 19d2:0117 ZTE WCDMA Technologies MSM
usb-devices
T:  Bus=01 Lev=02 Prnt=02 Port=02 Cnt=03 Dev#=  9 Spd=480 MxCh= 0
D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=19d2 ProdID=0117 Rev=00.00
S:  Manufacturer=ZTE,Incorporated
S:  Product=1&1 Surf-stick
S:  SerialNumber=MF190xxxxxxxxxxx
C:  #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr=500mA
I:  If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
I:  If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
I:  If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
I:  If#= 3 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage

 

SMS relay server overview

gammu is used to poll for SMS all the time. A small script watches for updates in the directory the received SMS are stored. If a new SMS arrives the content of the SMS is read and send via SMS to another phone. The script can easily be changed to do anything else with the SMS.

 

Infrastructure installation and test

sudo apt-get install usb-modeswitch usb-modeswitch-data

Now you should see ttyUSB devices

ls -la /dev/serial/by-id/
total 0
drwxr-xr-x 2 root root 100 Jan 12 19:38 .
drwxr-xr-x 4 root root  80 Jan 12 19:38 ..
lrwxrwxrwx 1 root root  13 Jan 12 19:54 usb-ZTE_Incorporated_1_1_Surf-stick_MF19001MOD010000-if00-port0 -> ../../ttyUSB0
lrwxrwxrwx 1 root root  13 Jan 12 19:54 usb-ZTE_Incorporated_1_1_Surf-stick_MF19001MOD010000-if01-port0 -> ../../ttyUSB1
lrwxrwxrwx 1 root root  13 Jan 12 19:54 usb-ZTE_Incorporated_1_1_Surf-stick_MF19001MOD010000-if02-port0 -> ../../ttyUSB2

Install gammu

sudo apt-get install gammu

Next call gammu-config to configure gammu.  Change port to /dev/tty/USB2 and connection to at. Next test the configuration with

gammu --identify
Device               : /dev/ttyUSB2
Manufacturer         : ZTE
Model                : MF190 (MF190)
Firmware             : BD_MF190V1.0.0B09
IMEI                 : xxxxxxxxxxxxxxx
SIM IMSI             : yyyyyyyyyyyyyyy

Next send an SMS to a known phone number, e.g. +4947114712

sudo -i -- bash -c 'echo "Das ist eine SMS von gammu" | gammu --sendsms TEXT +494711472'

 

Installation and configuration of gammu-smsd

sudo apt-get install gammu-smsd

The installation will try to start the service but will fail. You have to update the configuration in the next step.

sudo vi /etc/gammu-smsdrc

Make sure to have

# Configuration file for Gammu SMS Daemon
[gammu]
port = /dev/ttyUSB2
connection = at
[smsd]
service = files
logfile = syslog
# Increase for debugging information
debuglevel = 0
# Paths where messages are stored
inboxpath = /var/spool/gammu/inbox/
outboxpath = /var/spool/gammu/outbox/
sentsmspath = /var/spool/gammu/sent/
errorsmspath = /var/spool/gammu/error/

gammu-smsd now has to be restarted again

sudo systemctl start gammu-smsd
sudo systemctl status gammu-smsd.service

Now check whether gammu-smsd sends a SMS

sudo -i -- bash -c 'echo "This is a SMS from gammu" | gammu-smsd-inject TEXT +4917147114711

 

Activation and contol of the SMS relay server

The SMD relay server has to read incomming SMS and send them to another mobile . I wrote a small bash script watchGammu.sh which accomplishes this task. Copy this script into /usr/local/sbin and add in /etc/rc.local following line to get it started during boot:

/usr/local/sbin/watchGammu.sh start &

To stop the relay server type

sudo watchGammu.sh stop

Sometimes it's required to start/stop the gammu-smsd

sudo systemctl stop gammu-smsd
or
sudo systemctl stop gammu-smsd

 

Debuging

If there is a connectivity issue check whether a PIN is required:

echo -e 'AT+CPIN?\r' > /dev/ttyUSB2
cat /dev/ttyUSB2

If yes add following statement in your config file

[smsd]
pin = 4711

In addition you can enable debug logging for gammu-daemon if you face any issue. debuglevel 3 usually is sufficient. Add

[smsd]
service = files
logfile = /var/log/gammu-smsd.log
# Increase for debugging information
debuglevel = 3

 

References

The Gammu Manual

Gammu smsd man page

Gammu man page

Add comment

Note

Every comment is reviewed manually because of spam and usually it may take up to one day until you comment will be published.
In order to reduce spam posts which pass reCAPTCHA you have to wait for at least 15 minutes until you can post a new comment. In addition a comment with string http is rejected immediately.
Sorry for the inconvenience.