Professional Documents
Culture Documents
Sending SMS Messages With An S7 CPU Via The UMTS Router SCALANCE M873 M875
Sending SMS Messages With An S7 CPU Via The UMTS Router SCALANCE M873 M875
Caution:
The functions and solutions described in this entry predominantly confine
themselves to the realization of the automation task. Please also take into account
that corresponding protective measures have to be taken in the context of
Industrial Security when connecting your equipment to other parts of the plant, the
enterprise network or the Internet. For more information, please refer to Entry ID
50203404.
http://support.automation.siemens.com/WW/view/en/50203404
Siemens AG 2013 All rights reserved
Copyright
Solution 2
Function Mechanisms of
this Application 3
Installation 4
SIMATIC Startup of the
SMS Messages via SCALANCE Application 5
M873 / M875 Operation of the
Application 6
Application Description
References 7
Siemens AG 2013 All rights reserved
History 8
Copyright
We do not accept any liability for the information contained in this document.
Any claims against us - based on whatever legal reason - resulting from the use of
the examples, information, programs, engineering and performance data etc.,
described in this Application Example shall be excluded. Such an exclusion shall
not apply in the case of mandatory liability, e.g. under the German Product Liability
Act (“Produkthaftungsgesetz”), in case of intent, gross negligence, or injury of life,
body or health, guarantee for the quality of a product, fraudulent concealment of a
Siemens AG 2013 All rights reserved
Table of Contents
Warranty and Liability .............................................................................................. 4
1 Task................................................................................................................. 6
2 Solution........................................................................................................... 7
2.1 Solution overview .............................................................................. 7
2.2 Solution using the integrated PROFINET interface of the S7
CPU .................................................................................................. 7
2.3 Solution using an Industrial Ethernet CP ............................................ 8
2.4 Description of the functionality ........................................................... 9
2.5 Required hardware and software components ................................... 9
2.5.1 Hardware for the SIMATIC station.................................................... 10
2.5.2 Software components ...................................................................... 10
2.5.3 GSM components ............................................................................ 10
2.5.4 Sample files and projects ................................................................. 10
3 Function Mechanisms of this Application ................................................... 11
3.1 The function block SND_SMS[FB17] in detail................................... 11
3.1.1 Program overview............................................................................ 11
3.1.2 SMS_PARAM[DB11] ....................................................................... 13
3.1.3 Connection parameters for the SND_SMS[FB17] block.................... 14
3.2 The function block SND_SMS_CP[FB18] in detail ............................ 15
Siemens AG 2013 All rights reserved
1 Task
The service personnel are to be informed on their cell phones whenever a warning
or message is issued in the system. In this example, a message is sent that the
filling level has reached the maximum value.
The warning or message is detected at the S7 station. The S7 CPU is to send the
error message to the service personnel via SMS.
The figure below provides an overview of the automation task.
Figure 1-1
Mobile service
Process
Siemens AG 2013 All rights reserved
Automation station
Copyright
2 Solution
2.1 Solution overview
For connection of the S7 CPU to the GSM network, the UMTS router
SCALANCE M873 is used here. With the "SMS messaging from the local network"
function, the SCALANCE M873 can receive the SMS information from the S7 CPU
via TCP/IP. The SCALANCE M873 then sends an SMS message to the cell
phone / GSM device.
The following figure displays the most important components of the solution with an
S7-300 CPU (alternatively, the solution can be realized with an S7-400 or CPU of
the distributed I/O system ET 200S IM15x-8):
Figure 2-1
Copyright
1 3
2
5
SIM card
Included components
Table 2-1
No. Component Description
1 PROFINET S7 CPU An S7-300, S7-400, or ET 200S station
2 Ethernet cable The S7 CPU and SCALANCE M873
are interconnected via a network cable.
3 SCALANCE M873 UMTS router (alternatively, the
SCALANCE M875 can be used)
4 Quad-band antenna ANT794-4MR
5 SIM card from the respective GSM provider
Figure 2-2
4
Copyright
1 6 3
2
5
SIM card
Included components
Table 2-2
No. Component Description
1 S7-300 CPU An S7-300 or S7-400.
6 Industrial Ethernet CP
2-5 The components 2 to 5 are identical
Delimitation
This application does not include any basic information
about GSM radio communication; please refer to document Fehler!
Siemens AG 2013 All rights reserved
STEP 7 project
For the scenario "Generating and sending an SMS message", a user block
programmed in SCL is provided for each of the two solutions.
SND_SMS[FB17] block for the PROFINET CPU
SND_SMS_CP[FB18] block for the CPU with IE CP
The blocks of the sample program are independent of the hardware and can be
integrated in all STEP 7 projects.
Table 2-5
Copyright
Table 2-6
Component No. Order number
SCALANCE M873 UMTS router 1 6GK5873-0AA10-1AA2
(alternatively, SCALANCE M875) (6GK5875-0AA10-1AA2)
GSM antenna 1 6NH9860-1AA00
Standard SIM card 1
The following list includes all files and projects that are used in this example.
Table 2-7
Component Note
54361177_SMS_SCALANCE_M_CODE_V20.zip This zip file contains the sample
program.
54361177_SMS_ SCALANCE_M _DOKU_V20_d.pdf This document.
The graphic below shows the program structure of the entire STEP 7 project.
Figure 3-1
Siemens AG 2013 All rights reserved
Functions
SND_SMS
FC FC
OB 1 DB 17 CONCAT FIND
[FC2] [FC11]
FB 17
OB
Copyright
Communication blocks
SMS_PARAM
DB 11 FB FB FB
TCON TSEND TDISCON
[FB65] [FB63] [FB66]
The SND_SMS[FB17] block is called in OB1. The input and output parameters of
the SND_SMS[FB17] are stored in the global DB SMS_PARAM[DB11]. (For your
solution, you can store these values in different data blocks.)
For sending an SMS message, the S7 CPU has to establish a TCP/IP connection
to the SCALANCE M873 / M875 at the integrated PN interface. Via this TCP/IP
connection, the application sends the telegram (Section 3.3) to the SCALANCE
M873 / M875, which extracts the SMS message and forwards it. For TCP/IP
communication, the open communication blocks TCON, TSEND, and TDISCON
are used in the SCL block SND_SMS[FB17].
Figure 3-2
INPUT
OUTPUT
Siemens AG 2013 All rights reserved
3.1.2 SMS_PARAM[DB11]
For startup of the application, the user has to enter the input parameters in
SMS_PARAM[DB11].
Figure 3-3
Port address
Siemens AG 2013 All rights reserved
Connection ID
The connection ID for the SMS block required for open TCP/IP communication is
Copyright
The graphic below shows the program structure of the entire STEP 7 project.
Figure 3-4
Functions
SND_SMS_CP
FC FC
OB 1 DB 18 CONCAT FIND
[FC2] [FC11]
FB 18
OB Communication blocks
SMS_CP_PARAM
FC
DB 12
Siemens AG 2013 All rights reserved
AG_SEND
[FC5]
The SND_SMS_CP[FB18] block is called in OB1. The input and output parameters
Copyright
For sending an SMS message, the PN/IE CP has to establish a TCP/IP connection
to the SCALANCE M873 / M875. Via this TCP/IP connection, the application sends
the telegram (Section 3.3) to the SCALANCE M873 / M875, which extracts the
SMS message and forwards it. For TCP/IP communication, the AG_SEND[FC5]
function is used in the SCL block SND_SMS_CP[FB18] for open communication.
Figure 3-5
INPUT
OUTPUT
Siemens AG 2013 All rights reserved
Copyright
The parameters CON_ID (Con_ID) and LADDR (Laddr) are relevant for the TCP
connection. The TCP connection via the CP is a configured connection that
remains active after connection establishment and is configured in "Devices &
Networks". Please refer to the connection configuration for the connection
properties.
3.2.2 SMS_CP_PARAM[DB12]
For startup of the application, the user has to enter the input parameters in
SMS_PARAM[DB12].
Figure 3-6
Parameterization Parameterization
Input Web user interface /
parameters Telegram
SMS messaging from the local network
SND_SMS[FB17] SCALANCE M873
IP_ADR
DEVICE_ID
USERNAME
PASSWORD
Copyright
SMS_TEXT
TELNO
SEND_SMS
SMS-Service
PASSWORD
USERNAME
Center
have to be identical
Table 3-4
Status Block
16#0000_xyzx SND_SMS[FB17] / SND_SMS_CP[FB18]
16#0001_xyzx TCON
16#0010_xyzx TSEND / AG_SEND
16#0011_xyzx TDISCON
Copyright
Note For a description of the communication errors (triggered by TCON, TSEND, etc.),
please refer to the STEP 7 Online Help.
Table 3-5
Status Meaning Support / remarks
16#0000_8101 The previous job has not been
completed yet. (You started a new
send process although BUSY was still
active.)
16#0000_8102 Forbidden character : contained in the Correct the SMS_TEXT.
SMS_TEXT.
16#0000_8103 Forbidden character ; contained in the Correct the SMS_TEXT.
SMS_TEXT.
16#0000_8104 Forbidden character # contained in Correct the SMS_TEXT.
the SMS_TEXT.
16#0000_8105 Watchdog timer alarm. Make sure that
This message is only sent for the the IP address entered in
SND_SMS[FB17]. parameter IP_ADR is
Note Restart the send process after having fixed the error.
As described in Section 3.1, the output parameters DONE ERROR; STATUS are
active for one cycle only.
In order that the user can read out the SMS messaging status, these output
parameters (for example, SMS_PARAM“.Error_temp) in OB1 are copied to other
variables (for example, SMS_PARAM“.Error).
Siemens AG 2013 All rights reserved
The variables (for example, SMS_PARAM“.Error) are reset (set to 0) when a new
send trigger is started.
Copyright
4 Installation
4.1 Hardware configuration
The figure below shows the hardware configuration of the sample application.
Figure 4-1
Antenna
CP 24V SCALANCE
PS307 5A CPU
M873/ M875
230V
Siemens AG 2013 All rights reserved
24V
SIM card
PG
Industrial
Ethernet
Copyright
Table 4-1
No. Instruction Remarks
1. Insert the individual modules in a suitable rack. Components list S7 station
"PROFINET CPU"
and S7 station "CPU with
IE CP"
.
The CP is only required if
your S7 CPU has no
PROFINET interface.
2. Insert the MMC card in the respective slot of the S7
CPU.
3. Then connect the components to a 24 V DC supply Mind the correct polarity!
(PS307).
Connect the PS307 to the power grid (230 V AC).
4. Connect the antenna to the respective socket of the
SCALANCE M873 / M875.
5. After completion of the configuration (Chapter 5),
connect the PROFINET interface of the S7 CPU (or
the CP) to the Ethernet socket of the SCALANCE
The following sections describe the necessary configuration steps for the individual
components.
NOTICE Before you switch on the power supply, complete and check the
installation!
Note The installation guidelines for the installation of all components always have to
be observed.
The table below provides an overview of the IP addresses used in this sample
program.
Table 4-2
Module IP address
CPU 315-2PN / DP 192.168.0.1
Siemens AG 2013 All rights reserved
NOTICE First inform the SCALANCE M873 / M875 of the PIN and then insert the SIM
card.
Table 5-3
No. Instruction Remarks / hints
1. Connect the PG/PC to the Ethernet socket of
the SCALANCE M873 / M875.
2. Start your web browser and enter After successful connection establishment, a
https://192.168.1.1 as address (https://[ip confirmation prompt appears. Select "Continue
address SCALANCE M873 / M875]) to this website".
3. Enter the username and password. The factory default is as follows:
Username: admin
Password: scalance
Note The provider information (APN, Net-ID, etc.) is not required for the SMS function.
For sending an SMS message it is not necessary that the SCALANCE M873 /
M875 is logged on to the UMTS/EDGE.
The SCALANCE M873 / M875 now tries to After successful connection establishment, the
establish a connection with the GSM network. LEDs light up as follows:
S (Status): ON
Siemens AG 2013 All rights reserved
signal strength.
No. Instruction
2. Go to
"Local Network > Basic Settings > Local IPs".
Change the internal IP address of the SCALANCE M873 / M875 in accordance with The table
below provides an overview of the IP addresses used in this sample program.
.
Apply the settings with "Save".
3. Adapt the IP address of your PG/PC accordingly (for example, 192.168.0.100) and enter the new
IP address of the SCALANCE M873 / M875 in your web browser ( https://192.168.0.3 ).
Siemens AG 2013 All rights reserved
Copyright
If you want to change the port number, please consider the notes in Section 3.1.3.
2. Select "New" to create a firewall rule for SMS messaging from the local network so that the
TCP/IP connection for SMS messaging can be established.
Siemens AG 2013 All rights reserved
operator is used.
Table 5-8
No. Instruction Remarks
1 Open the STEP 7 project in the TIA portal.
2 Connect the Ethernet interface of the PG/PC
with the PROFINET interface of the S7 CPU (of
the CP).
3 In the "Project tree", go to:
"Online access > adapter board for the network
in which the device is located > Update
accessible devices"
Send trigger
Output parameters
If you use the application via IE CP, enter the desired input parameters in the
SMS_CP_PARAM[DB12].
The values for the parameters Con_ID and Laddr are to be taken from the connection
configuration (see In the STEP 7 project for the CPU with IE CP, the TCP connection is
configured in "Device configuration". If you use a different CP, you can change the CP in
the project via "Change device". After having changed the device, the TCP connection
still exists in the project. To read the configuration data and to adapt them, if necessary,
proceed as follows:
).
No. Instruction
3. Access the S7 CPU online via "Go online".
4. Open the variables table "Watch table SMS" / "Watch table SMS_CP".
Click on the "Monitor all" icon and activate "SMS_PARAM".SND_SMS to send the message.
7 Glossary
EDGE
is the abbreviation for "Enhanced Data rate for GSM Evolution" and is a faster data
transmission service than GPRS (however, EDGE also operates via the GSM
mobile networks). EDGE can be used for connection-oriented HSCSD and as a
further development of the packet-oriented UMTS. Since the packet-oriented
variant EGPRS is much more efficient, development is more and more focused on
EGPRS.
GPRS
General Packet Radio Service; an expansion of the GSM standard for packet-
oriented data transmission.
GSM
Global System for Mobile Communication is a global standard for digital mobile
networks.
SMS
Short Message Service is a telecommunication service for transmitting text
messages.
Siemens AG 2013 All rights reserved
UMTS
UMTS (Universal Mobile Telecommunication System) is a mobile wireless network
of the 3rd generation that allows significantly higher data transfer rates than the
GSM networks of the 2nd generation. UMTS provides not only voice transmission,
IP-based data transmission and SMS transmission but also the option of
transmitting video applications.
Copyright
8 References
The following list is not complete and only represents a selection of relevant
information.
Table 8-1:
Subject Title
\1\ WAN Access http://support.automation.siemens.com/WW/view/en/26662448
Methods
\2\ SCALANCE http://support.automation.siemens.com/WW/view/en/49507278
M873-0
9 History
Table 9-1:
Version Date Modifications
V2.0 18.06.2013 Update to STEP 7 V12 and expansion for IE CP
V1.1 23.04.2012 Table 3-1 and Table 3-5 changed
V1.0 23.09.2011 First version
Siemens AG 2013 All rights reserved
Copyright