This tutorial explains how to enable EasyIoT server SMS interface. EasyIoT SMS interface can be used to send alarm SMS messages to mobile phone or to read sensor properties or send commands to sensors with SMS. You will need USB modem stick with SIM card.

Those days you can get USB modem stick for couple of EUR. It doesn't need to be modern high speed modem, because it will be used only to receive and send SMS messages.

 

First step is installation. SIM card must be unlocked - no PIN protection.

Windows platform

Most modems come with Windows SW which is installed first time when you insert USB modem in computer. If everything is installed correctly you should see modem under Control panel in device manager under ports (Com and LPT). To test modem send AT commands. Use PuTTY or similar program to send commands to test modem. Try to send ATi comand to see modem information. If everything is OK you should see modem info like manufacturer, model, etc in response.

Raspberry Pi platform

To install modem in Raspberry Pi first update Raspbian to latest release:

sudo apt-get update

sudo apt-get upgrade

After that check if modem is installed (modem must be inserted in USB port). Run lsusb command. You should see similar output:

 

Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
Bus 001 Device 008: ID 050d:0234 Belkin Components F5U234 USB 2.0 4-Port Hub
Bus 001 Device 005: ID 7392:7811 Edimax Technology Co., Ltd EW-7811Un 802.11n Wireless Adapter [Realtek RTL8188CUS]
Bus 001 Device 010: ID 12d1:1506 Huawei Technologies Co., Ltd. E398LTE/UMTS/GSM Modem/Networkcard

 

If you see output with detail modem info that's ok. If you see output similar as this:

 

Bus 001 Device 010: ID 12d1:14d1 Huawei Technologies Co., Ltd.

 

Just modem manufacturer with no additional info, you need to install usb_modeswitch. To install usb_modeswitch execute:

sudo apt-get install usb-modeswitch

After that you should see detail modem info in lsusb. Exact installation procedure can be different for your modem model - use Google to find proper solution.

If you see detail modem info test if modem is working. In console send AT commands to modem port.

echo "ATi^M" > /dev/<DEVICE> #(note: ^M is ctrl+v+m)

device is most probably /dev/ttyUSB0 or /dev/ttyUSB1. To see response type

cat /dev/ttyUSB0

or

cat /dev/ttyUSB1

In response you should see modem information.

 

Some of my findings:

  • you need good power supply for Raspberry Pi. In my case it was not good enough to use 1A power supply. It works only with 2A power supply. This may depend on USB modem model.
  • I have problems with one USB stick. It works at begging, but it stops working after one hour. Then it was not recognized by Raspian any more. It start working only after reboot. I assume it's Raspbian-USB modem problem, because sticks works OK on Windows machine. This problem is sloved with AT^CURC=0 command in V0.7. 
  • Modem may consume bigger current than Raspberry can supply. It may be different for your modem model and Raspberry model. I'm using Raspberry Pi model B rev.2. I have to shortcut polyfuse F3 (see picture) to supply enough current to USB modem. For other Raspberry model solution may be different. Do this only if you know what are you doing (you will lose warranty or fry Raspberry). The other solution to supply enough current would be to use Powdered USB hub for USB modem.

Enable SMS interface in EasyIoT server

In EasyIoT web interface go to Config->SMS interface.

First enter USB stick port - the one you tested before. Under Rasbian it's usually /dev/ttyUSB0 and under Win is some COMxx port. Then check if your modem speed is correct. Open Systemconfig.xml in config folder. If you see <BaudRate>115000</BaudRate> change to <BaudRate>19200</BaudRate>. This settings is under <SmsGateway> tag. Before you change settings you should shutdown server.

After you enter correct port and baudrate enable SMS interface.

Next try to test if your SMS interface is working. Send SMS message with text "test"  (without ") to your USB modem SIM card telephone number. In response you should get SMS with "EasyIoT server SMS interface OK." text.

 

 

EasyIoT server SMS commands

With SMS commands you can control or monitor your sensor network.

To read sensor property use:

GetParameter [driver] [address] [property]

For example if you want to read temperature sensor of MySensor driver with adders N4S0 use 

GetParameter MySensors N4S0 Sensor.Temperature

You can find driver name and sensor address in web interface:

 As response you will get SMS with value of parameter.

 

To control module you have more commands:

-to switch digital output on

ConrolModule [driver] [address] ControlOn

-to switch digital output off

ConrolModule [driver] [address] ControlOff

-to set analog output value 

ConrolModule [driver] [address] ControlLevel [value]

Examples are:

ControlModule MySensors N1S3 ControlOn - to switch on

ControlModule MySensors N1S3 ControlOff - to switch off

ControlModule MySensors N1S4 ControlLevel 20 - to set (dimmer) level 20

 

Those commands are sometimes hard to remember. To make things easier create shortcuts. In Web interface click button Add shortcuts and enter shortcut and complete command. After that you can call commands with shortcut text.

In Allowed sender you can limit the list of telephone numbers which are allowed to send commands to your EasyIoT server for security reason.

 

See more tutorials at ​http://iot-playground.com/build​

 

Buying guide

To support this site and EasyIoT framework development please buy in our store.

 

USB STICK SIM Modem 7.2MBPS 3G Wireless USB Dongle

To control EasyIoT server by SMS message.

 


Comments   

+1 #10 Jerry 2016-05-04 16:28
Hello everybody. I started to use EasyIot and it works well with my sensors (Raspberry with SD image). Now I bought the 3G USB Dongle from China from the above link (the black-orange one) and want to send some informations per sms. Currently I get an error from EasyIot.

2016-05-04T15:50:22.0319980+02:00 ERROR EasyIoTSMSInterface AT^CURC=0 command error.

I tried the "test" sms and get no response. I tried to manually send a sms with minicom and this works. I tried some AT commands and it seems to me thet this stick doesn't support all of them.

Did anybody get this USB stick work with EasyIot?

Thanks for your replies.
Jerry
+1 #9 how to use desktop 2015-03-27 09:59
Hey there I am so grateful I found your site, I really found you by accident, while I was
searching on Digg for something else, Anyhow I am here now
and would just like to say many thanks for a remarkable post and a all round entertaining blog (I
also love the theme/design), I don't have time to read through it all at the moment
but I have book-marked it and also added your RSS feeds,
so when I have time I will be back to read a lot more, Please
do keep up the awesome work.
+1 #8 Super User 2015-03-14 23:05
Quoting pch:
Such a curiosity, E160G is seen as 3 USB ports, when I connect to usb2, (e.g. minicom -b 19200 -o -D /dev/ttyUSB2) and sends AT^BOOT=0,0 then disable the "boot" reports, next run the SMS server on usb0, and the modem is no longer hangs until you turn off raspberry
PCh.


Thank you for this info. I've investigated and found solution. The problem are modem periodic status messages. It can be switched off by AT^CURC=0. After I add this command in EasyIoT server modem works all the time. Fix will be included in V0.7 release,
+1 #7 pch 2015-03-03 19:05
Such a curiosity, E160G is seen as 3 USB ports, when I connect to usb2, (e.g. minicom -b 19200 -o -D /dev/ttyUSB2) and sends AT^BOOT=0,0 then disable the "boot" reports, next run the SMS server on usb0, and the modem is no longer hangs until you turn off raspberry
PCh.
#6 Super User 2015-02-24 22:17
Quoting citra:
How to send sms notification when status gpio changed, its like warning alarm.


yes, search EventHelper in forum
#5 citra 2015-02-24 20:24
How to send sms notification when status gpio changed, its like warning alarm.
#4 Super User 2015-02-23 00:38
Quoting pch:
Hi, I have a Huawei E160G modem plugged in Raspberry and with gnokii I can send sms all the time, the modem will not stop working after an hour, but with EasyIoT server SMS stops working. I think that the cause of the error is a serial port input buffer raspberry. The modem all the time sends something like ^BOOT:22017301,0,0,0,76.. by serial port, so that after some time you may receive buffer overflow, gnokii when sending sms, first flushes the buffer (sending ATZ and reads everything, until the buffer is empty), garbage sometimes occupy several screens.. Maybe this is the solution of the problem.
Sorry for my English :-)
PCh.


You gave me good idea. SMS interface always reads all characters and ignore garbage. I will try flush com port before sending AT commands.
[EDIT]
I've tried all combination ATZ command and cleaning serial port - result is the same, Huawei E169 hangs.
#3 pch 2015-02-22 14:05
Hi, I have a Huawei E160G modem plugged in Raspberry and with gnokii I can send sms all the time, the modem will not stop working after an hour, but with EasyIoT server SMS stops working. I think that the cause of the error is a serial port input buffer raspberry. The modem all the time sends something like ^BOOT:22017301,0,0,0,76.. by serial port, so that after some time you may receive buffer overflow, gnokii when sending sms, first flushes the buffer (sending ATZ and reads everything, until the buffer is empty), garbage sometimes occupy several screens.. Maybe this is the solution of the problem.
Sorry for my English :-)
PCh.
#2 Super User 2015-01-31 21:53
Quoting Chris crowe:
Do you have an online source for USB modem sticks. I checked ebay and most are 30 to 50 usd.

Chris


No. I've got mine on local web site for second hand things for 10 EUR. It was cheaper than on ebay.
#1 Chris crowe 2015-01-31 19:37
Do you have an online source for USB modem sticks. I checked ebay and most are 30 to 50 usd.

Chris

You have no rights to post comments