TADHack Athens: IoT SMS Monitoring & Controlling

by George Gkitsas and Christos Papantonis

Scope

Usually, the end nodes of an IoT setup have two responsibilities, one is to monitor a process and the other one to control or to act on   it. Since the end nodes are remote devices, there is a need for some kind of connectivity in order to communicate with them. Usually connections via internet are employed, utilizing ethernet and Wi-Fi, or data transmission via GSM/3G/4G.

Besides connectivity at the end nodes’ side which can be usually resolved reliably (eg: a good internet connection is established on the premises), there is a need for reliable connectivity from the user’s side as well (the person that monitors and controls the process). In many locations, internet connectivity might not be reliable and thus other solutions should be utilized. The solution we proposed and implemented during TADHack 2017, is to use SMS messages for communication, since the GSM network is considered more reliable in many locations around the globe.

Architecture

Our solution enables the end nodes to send SMS notifications to the users and enables the users to control the end nodes via SMS messages.

A minimal setup for this scenario needs a server running on end devices that accepts user commands for controlling the process and translates this commands to actions. Additionally, a utility is needed to monitor the process and sends the notifications to the users when specific events occur.

Our main concern was to find a reliable and efficient way of sending and receiving SMSs to and from the end nodes. Telestax’s RestCommONE service proved to be an excellent choice. It provided the means for sending SMSs from the device to the user and backwards. The service is the interface, responsible for translating SMSs to REST API calls.  This solution yields cost reduction, since there is no need to use modems and SIM cards to the end nodes.

In our demo we used a Raspberry Pi as an end node and an analog input to it to emulate a sensor. On the RPi a Node.js server is responsible for accepting user commands and performing actions on the monitored process. A Python script is also running that reads the sensor’s input and is responsible for sending SMS notifications to the users when specific events occur. These events, are customized according to the user’s needs and requirements. The sending of the SMS notifications is done by issuing REST calls to the RestComm server.

On the RestCommOne platform  a registration of the end node’s number was required and  the RVD platform was responsible to  for  the translation of the SMSs that are destined to the end device to REST calls to this device. RVD provides a rule called “External Service” which fitted exactly our need.

Problems and solutions

As always, setting up a demo environment is not an easy ride :). We needed to expose RPi’s REST server but we also wanted to avoid using port forwarding in the local network. Fortunately a solution was found which included running a local RestCommONE server, and more fortunately a docker is provided (https://github.com/RestComm/Restcomm-Docker). But that solves only one side of the problem, the other being that we can no longer use the GSM network for handling SMS sending and receiving. To overcome this difficulty we utilized RestComm’s Android WebRTC Demo App, which is part of RestcComm WebRTC Android SDK (https://github.com/RestComm/restcomm-android-sdk) application which relies on the SIP protocol  (https://en.wikipedia.org/wiki/Session_Initiation_Protocol) for managing voice, video and messaging sessions over IP. At this point all our demo setup runs on the local network and the wrath of the Demo Gods did not strike us down!

Until the next TADHack,

Cheers! George Gkitsas and Christos Papantonis