iot.a2s.pl

Reaction of iMod platform to an SMS message


Reaction of iMod platform to an SMS message

The iMod has the capability of reacting to incoming SMS messages. For this purpose, an appropriately configured MainConfig.xml file and a simple shell script should be used. The script switches off the USER LED at the time when an SMS message is sent to the device with the content USER_LED=0. A source channel that will enable access to hardware resources must be added in the MainConfig.xml file.

  1. <source-channel name="NPE_io">
  2.     <protocol name="HARDWARE"/>
  3.     <gap>0</gap>
  4.     <cycle>5</cycle>
  5. </source-channel>

The parameter determining the User Led must also be defined for the purpose of assigning the modbus address of 100 to it.

  1. <parameter>
  2.     <id>100</id>
  3.     <source-channel channel-name="NPE_io" parameter-id="USER_LED"/>
  4.     <access-channel channel-name="Modbus_S1" parameter-id="100"/>
  5. </parameter>

The next step is to prepare a shell script causing a change in the LED's value depending on the content of the SMS message.

  1. #!/bin/sh
  2. A=`ls -1A /tmp/sms/incoming/ | wc -l`
  3. echo $A
  4. sleep 120
  5. B=`ls -1A /tmp/sms/incoming/ | wc -l`
  6. echo $B
  7.  
  8. if [ $B -gt $A ]; then
  9.     echo "NPE received a SMS"
  10.     cd /tmp/sms/incoming/
  11.     C=`ls -t1 | head -n1`
  12.     echo $C
  13. if [ `grep -i 'USER_LED=0' $C` ]; then
  14.     D=`modmas write:100:0`
  15.     echo "User Led turned OFF"
  16. elif [ `grep -i 'USER_LED=1' $C` ]; then
  17.     E=`modmas write:100:1`
  18.     echo "User Led turned ON"
  19. else
  20.     echo "SMS message is wrong"
  21. fi
  22. elif [ $B -le $A ]; then
  23.     echo "NPE not received a SMS"
  24. fi

First of all, the script checks the number of files found in the /tmp/sms/incoming/ directory, waits 5 seconds, then checks the number of files in the directory again. If the number of files has increased, this means the NPE has received an SMS message in the meantime. This condition is described in the further part of the script. In this situation, the script searches for the last previously modified file and marks it as parameter C.

The next step is to check the content of the received SMS message. In the script above, the state of the User Led can accept the value of 1 or 0 depending on the content of the SMS message.

If USER_LED=0 is present in the content of the SMS message, then the value of the modbus parameter with the id of 100 is changed to 0 with the help of the modmas application. According to the earlier configuration, this parameter is assigned to the User Led, which will cause the LED to turn off. If the USER_LED=1 string of characters is present in the content of the SMS message, the User LED will be turned on. In the case of different message content, SMS message is wrong will be displayed on the console.

There is a wide range of applications for scripts. Two-way SMS communication introduces the capability of not only remote control of the operation of an automated installation, but also of controlling resources using short SMS text messages sent from a cellular phone.

See article “iMod – New function: two-way SMS communication”
See article “Sending SMS messages upon an event from the iMod platform”
See iMod series devices

Articles in Categories: iMod functionality Collapse
Perfect Controller for Fleet Monitoring
The NPE/iMod industrial computer is commonly used in various industrial sectors. One of the sectors is the automotive industry, where the J1939 protocol is often used. This protocol enables collection of all the data provided by a vehicle. NPE/iMod is a perfect device for data collection, data logging and data sharing among end-users.
Read article »
Industrial Computer with Built-in Modbus Capability, part 3
This article is the third part of a series describing the NPE/iMod devices with Modbus capability. In order to see the other parts, please click the links below.
Read article »
Industrial Computer with Built-in Modbus Capability, part 2
This article is the second part of a series describing the NPE/iMod devices with Modbus capability. In order to see the other parts, please click the links below.
Read article »
Industrial Computer with Built-in Modbus Capability, part 1
This article is the first part of a series describing the NPE/iMod devices with Modbus capability. In order to see the other parts, please click the links below.
Read article »
NPE/iMod – Everything is Under Control
The NPE/iMod industrial computer is a perfect telecontrol device. It enables you to connect different devices into one network and to receive a constant data readout. Access to the information is provided by a built-in Apache HTTP server, the data might also be displayed in real time with the NXDynamics graphical interface.
Read article »
Remote Weather Monitoring
The NPE/iMod telemetry module is not only a device for industry. It is also a perfect solution for Meteorology, where it can operate as a data logger or a notify module. With the use of proper sensors, the NPE/iMod operates as a fully functional weather station.
Read article »
Data Logger and Notify Module in CAN Networks
The NPE/iMod industrial computer is equipped with a number of interfaces and protocols. External modules additionally enhance its functionalities. Can bus is one of the protocols that the NPE/iMod device can be equipped with. It has been widely used both in the automotive industry and in production automation. The NPE/iMod controller, together with the I-7530A-MR module is perfect for control and monitoring of the devices using the protocol.
Read article »
Embedded Computer for Multiple Access Systems
The NPE/iMod industrial computer, due to its enhanced architecture, can operate as a versatile automation controller. This module combines the advantages of a fully programmable and configurable PAC/CAC, which guarantees a quick start and a full use of the device possibilities without the need to use a complicated software.
Read article »
Enhanced Interface and Protocol Converter
Due to a huge number of interfaces and supported protocols, the NPE/iMod industrial computer has functionalities of both a simple, easy to use, configurable converter and a fully programmable device. The NPE/iMod computer is equipped with serial interfaces such as RS-232, RS-485, GPRS, USB or Ethernet.
Read article »
Configurable and Programmable SQL and CSV Data Logger
The NPE/iMod industrial computer is a perfect fully programmable and configurable data logger. Due to an extensive range of input and output interfaces, the data collected by the device can be transferred further in order to check if the system, where NPE/iMod is installed, operates properly.
Read article »
Telemetry Module for Railway Industry
The iMod platform is such a versatile solution that it has been approved by the railway industry. NPE/iMod can operate as a remote controller, notify module and a data logger. Users can configure their own visualisation interface on the NXDynamics Web platform, providing constant access to parameters and status of devices in real time.
Read article »
PostgreSQL Server for Embedded Computers
The PostgreSQL database support has been recently added to the NPE/iMod functionalities. Due to this functionality an industrial computer can operate both as an SQL database server and an SQL client. In order to make the PSQL support easier, we created a built-in module for the innovative NX Dynamics Web interface. This module fully supports both local and external PostgreSQL database in accordance with the SQL syntax. It enables an easy database connection as well as viewing and modifying the tables in the database.
Read article »
Intelligent Controller for DeviceNet Network
With the use of the I-7242D external module, the NPE/iMod industrial computer is perfect for control and management of the objects in the DeviceNet networks. The communication between the module and the computer is carried out through the Modbus RTU protocol. Next, all the data can be transferred to a local HMI or using the GPRS - to a control station.
Read article »
iMod internal structure
This is a second in a series of four articles aimed at bringing You a revolutionary iMod platform.Great opportunities always carry a large customizable. iMod has a user-friendly way to configure many options, which is done by editing a simple XML file. This allows you to freely define parameters such as...
Read article »
Smart Metering - Save Your Energy
There is a wide offer of precise electronic energy meters on the market. Most of them are only for metering the current electricity consumption. By using the NPE/iMod telemetry module, the energy grid can be fully automated (smart grid) and metres intelligent (smart metering).
Read article »
iMod - Why Linux
Every IT professional knows what Linux offers for servers. However, more often, thanks to more powerfull energy-efficient processors, this system becomes the ideal platform for embedded systems and all kinds of drivers. The Linux system is characterized by...
Read article »
iMod - Why GPRS
iMod allows parallel access via GSM and Ethernet - Router RS-232 / RS-485 / Ethernet / GPRS - Modbus router / gateway - Access via FTP, WWW, Telnet - Remote configuration and management
Read article »
Wireless GPRS communication between serial ports
Because of a built-in modem, the NPE/iMod telemetry module is a perfect RS-232/485 to wireless data transmission converter. The NPE/iMod computer creates a network connection between several remotely located devices, due to the built-in GPRS modem or the VPN support.
Read article »
NX Dynamics web interface
NX Dynamics is an innovate solution from TechBase company - a modern interface for operating and monitoring NPE/iMod computers.
Read article »
NXDynamics - Tool for iMod Configuration
NXDynamics is an innovative interface for monitoring and operation of the NPE/iMod industrial computers through a Web browser. One of the latest functionalities available is the easy management of the iMod configuration files.
Read article »
I/O Modbus module with built-in GSM/GPRS modem
There are 7 example files in the iMod telemetric module, which help with a proper configuration of the device and help to understand the basic, necessary rules of creating configuration files.
Read article »
Access to Free Software Updates
In order to meet our clients’ expectations, we created an application for automatic update of packages – Software manager. This application enables free of charge, easy and fully automatic update of the software on the NPE/iMod platform. Apart from the key packages such as firmware, there are other software packages available through the application (e.g., PHP, SSH, SSL and VPN).
Read article »
iMod: QuickStart
We created a QuickStart document, especially for first time users of the iMod platform. Its simple form should help the less experienced users with a fast understanding of the device’s core functionalities.
Read article »
iMod – New functionality: two-way SMS communication
The iMod telemetric module has an option with a GSM/GPRS/EDGE Class 10 modem operating in three ranges (900/1800/1900 MHz). These modems are ideally suited for installation where information collected by the device is sent over large distances.
Read article »
Sending SMS messages upon an event from the iMod platform
Sending an SMS from the iMod upon an event is very simple – it is sufficient to correctly configure the MainConfig.xml file...
Read article »
iMod – a scripting source channel
The iMod telemetric module has the capability of using BASH scripts as a source of data. This capability can be used in different ways, including two-way SMS communication support.
Read article »
iMod with 1-Wire interface
iMod telemetry module gained new feature which is 1-Wire interface. What is 1-Wire?
Read article »
Details on making WWW visualizations
The iMod platform finds a wide range of applications in distributed system as a telemetric module as well as a communication and control module...
Read article »
iMod - new function: Schedulers
As the NPE/iMod are developed, there is more and more demand for new functions. One of the basic functions that a telemetric module should have, is the capability of saving the values of selected parameters to CSV files or databases (SQLite or PSQL) with specific hours, times of day, and even days of the year.
Read article »