Download as pdf or txt
Download as pdf or txt
You are on page 1of 32

Cover

Sending SMS Messages with an


S7 CPU via the UMTS Router
SCALANCE M873 / M875
SCALANCE M873 / M875

Application Description June 2013

Applications & Tools


Answers for industry.
Siemens Industry Online Support
This entry is taken from the Siemens Industry Online Support. The following link
takes you directly to the download page of this document:
http://support.automation.siemens.com/WW/view/en/54361177

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

SMS Messages via SCALANCE M873 / M875


2 V2.0, Entry ID: 54361177
s Task 1

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

SMS Messages via SCALANCE M873 / M875


V2.0, Entry ID: 54361177 3
Warranty and Liability

Warranty and Liability


Note The Application Examples are not binding and do not claim to be complete
regarding the circuits shown, equipping and any eventuality. The Application
Examples do not represent customer-specific solutions. They are only intended
to provide support for typical applications. You are responsible for ensuring that
the described products are used correctly. These Application Examples do not
relieve you of the responsibility to use safe practices in application, installation,
operation and maintenance. When using these Application Examples, you
recognize that we cannot be made liable for any damage/claims beyond the
liability clause described. We reserve the right to make changes to these
Application Examples at any time without prior notice. If there are any deviations
between the recommendations provided in these Application Examples and
other Siemens publications – e.g. Catalogs – the contents of the other
documents have priority.

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

deficiency or breach of a condition which goes to the root of the contract


(“wesentliche Vertragspflichten”). The damages for a breach of a substantial
contractual obligation are, however, limited to the foreseeable damage, typical for
the type of contract, except in the event of intent or gross negligence or injury to
life, body or health. The above provisions do not imply a change of the burden of
proof to your detriment.

Any form of duplication or distribution of these Application Examples or excerpts


Copyright

hereof is prohibited without the expressed consent of Siemens Industry Sector.

SMS Messages via SCALANCE M873 / M875


4 V2.0, Entry ID: 54361177
Table of Contents

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

3.2.1 Program overview............................................................................ 15


3.2.2 SMS_CP_PARAM[DB12] ................................................................ 16
3.3 Generating and sending an SMS message ...................................... 17
3.4 Error and status display ................................................................... 18
4 Installation .................................................................................................... 20
4.1 Hardware configuration .................................................................... 20
4.2 Installation of the software ............................................................... 21
5 Startup of the Application ............................................................................ 22
Copyright

5.1 Installation of the application software .............................................. 22


5.2 Configuration of the SCALANCE M873 / M875 ................................ 22
5.3 Configuration of the S7 station ......................................................... 27
6 Operation of the Application ........................................................................ 29
7 Glossary........................................................................................................ 31
8 References .................................................................................................... 32
9 History .......................................................................................................... 32

SMS Messages via SCALANCE M873 / M875


V2.0, Entry ID: 54361177 5
1 Task
2.1 Solution overview

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

SMS Messages via SCALANCE M873 / M875


6 V2.0, Entry ID: 54361177
2 Solution
2.1 Solution overview

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.

For this task, two solutions are provided:


Solution using the integrated PROFINET interface of the S7 CPU
Solution using an Industrial Ethernet CP

2.2 Solution using the integrated PROFINET interface of


the S7 CPU
Display
Siemens AG 2013 All rights reserved

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

SIMATIC S7 PROFINET CPU SCALANCE M873 / M875


4

1 3

2
5

SIM card

SMS Messages via SCALANCE M873 / M875


V2.0, Entry ID: 54361177 7
2 Solution
2.3 Solution using an Industrial Ethernet CP

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

2.3 Solution using an Industrial Ethernet CP


Display
If your S7 CPU does not provide an integrated PROFINET interface, you can
connect an Industrial Ethernet CP to your S7 CPU. The following figure displays
the most important components of this solution with an S7-300 CPU (alternatively,
an S7-400 can be used):
Siemens AG 2013 All rights reserved

Figure 2-2

SIMATIC S7 CPU with IE CP SCALANCE M873 / M875

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

SMS Messages via SCALANCE M873 / M875


8 V2.0, Entry ID: 54361177
2 Solution
2.4 Description of the functionality

No. Component Description


with the components 2 to 5 in the
configuration in Section .

2.4 Description of the functionality


Overview
This application example demonstrates
how to establish a connection between an S7 station and the SCALANCE
M873 / M875 using open communication,
what to configure at the SCALANCE M873 / M875 with regard to SMS
messaging,
how to encapsulate the SMS functionality in a SCL block, and
how to send a text message via this SCL block.

Delimitation
This application does not include any basic information
about GSM radio communication; please refer to document Fehler!
Siemens AG 2013 All rights reserved

Verweisquelle konnte nicht gefunden werden. in the References on this.


about the programming languages LAD / FBD / STL / SCL.
Basic knowledge of these topics is assumed.

Scope of validity of the application V2.0


STEP 7 V12 (Basic or Professional)
SCALANCE M873, SCALANCE M875, SINAUT MD741-1
Copyright

Solution using the integrated PROFINET interface of the S7 CPU


– CPU 31x-2 PN/DP from FW 2.4 on
– CPU 41x-3 PN/DP
– ET 200S IM15x-8 PN/DP CPU
For the solution using an Industrial Ethernet CP
- S7-300 & S7-300 IE CP (all CP 343-1 variants)
- S7-400 & S7-400 IE CP (all CP 443-1 variants)

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

2.5 Required hardware and software components


This application was generated with the following components:

SMS Messages via SCALANCE M873 / M875


V2.0, Entry ID: 54361177 9
2 Solution
2.5 Required hardware and software components

2.5.1 Hardware for the SIMATIC station

The blocks of the sample program are independent of the hardware and can be
integrated in all STEP 7 projects.

S7 station "PROFINET CPU"


Table 2-3
Component No. Order number
PS307 5A 1 6ES7307-1EA00-0AA0
CPU 315-2 PN/DP 1 6ES7315-2EH14-0AB0
Micro Memory Card 1 6ES7953-8LF11-0AA0
Industrial Ethernet twisted-pair 2 6XV1 850-2GH60
cable

S7 station "CPU with IE CP"


Table 2-4
Component No. Order number
PS307 5A 1 6ES7307-1EA00-0AA0
CPU 312 1 6ES7312-1AE14-0AB0
Siemens AG 2013 All rights reserved

CP 343-1 Advanced 1 6GK7 343-1GX31-0XE0


Micro Memory Card 1 6ES7953-8LF11-0AA0
Industrial Ethernet twisted-pair 2 6XV1 850-2GH60
cable

2.5.2 Software components

Table 2-5
Copyright

Component No. Order number


STEP 7 Professional V12 1 6ES7822-1A.02-..

2.5.3 GSM components

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

2.5.4 Sample files and projects

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.

SMS Messages via SCALANCE M873 / M875


10 V2.0, Entry ID: 54361177
3 Function Mechanisms of this Application
3.1 The function block SND_SMS[FB17] in detail

3 Function Mechanisms of this Application


Introduction
The following S7 stations are configured in the sample project:
"PROFINET CPU" (SND_SMS[FB17])
"CPU with IE CP" (SND_SMS_CP[FB18])
This chapter provides a detailed description of the user blocks SND_SMS[FB17]
and SND_SMS_CP[FB18] with regard to the core functionality and the internal
functional sequences.

3.1 The function block SND_SMS[FB17] in detail


3.1.1 Program overview

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]

User blocks S7 standard


library blocks

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].

SMS Messages via SCALANCE M873 / M875


V2.0, Entry ID: 54361177 11
3 Function Mechanisms of this Application
3.1 The function block SND_SMS[FB17] in detail

Calling the SND_SMS[FB17]


The figure and table below show the call interface of the user block
SND_SMS[FB17] in OB1.

Figure 3-2

INPUT

OUTPUT
Siemens AG 2013 All rights reserved

Meaning of the individual parameters


Table 3-1
Name Data type Description / remarks
Copyright

IP_ADR DWORD IP address of the SCALANCE M873 /


M875
Example: DW#16#C0A80003
corresponds to 192.168.0.3
DEVICE_ID BYTE Interface identifier, depending on the CPU
type (see The parameters IP_ADR
(IP_Address) and DEVICE_ID (Device_ID)
are relevant for the TCP connection.
)
USERNAME STRING[10] Username that has to be contained in the
telegram before the text is sent via SMS.
Maximum length: 10 characters
PASSWORD STRING[10] Password that has to be contained in
the telegram before the text is sent via
SMS.
Maximum length: 10 characters
TELNO STRING[24] Recipient phone number of the device
to which the SMS message is to be
sent.
Example: ’ +49xxxxxxxxx’ >
‘+49123456789’
Permissible value: 24 characters max.
SMS_TEXT STRING[160] SMS message text with 160 characters

SMS Messages via SCALANCE M873 / M875


12 V2.0, Entry ID: 54361177
3 Function Mechanisms of this Application
3.1 The function block SND_SMS[FB17] in detail

Name Data type Description / remarks


max.
The following forbidden characters
must not be contained in the SMS
message text:
# Separator of the first command level
; Separator of the second command level
: Defines the end of the message
(see References Fehler! Verweisquelle
konnte nicht gefunden werden.)
Maximum length: 160 characters
SND_SMS BOOL Starts the send process
Only reacts to a positive edge
DONE BOOL When the send process has been
completed successfully, "DONE" is set
to TRUE.
Is TRUE for one cycle only
BUSY BOOL Is set to TRUE when the
SND_SMS[FB17] block is occupied
with the send process.
Takes on the FALSE state as soon as
Siemens AG 2013 All rights reserved

the above procedure has been


terminated
ERROR BOOL Gives feedback if an error occurs
during the processing of the routine
Is TRUE for one cycle only
Default value: FALSE
STATUS DWORD If ERROR = TRUE, returns the status
for error cause localization
Returns the status for one cycle only
Copyright

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

SMS Messages via SCALANCE M873 / M875


V2.0, Entry ID: 54361177 13
3 Function Mechanisms of this Application
3.1 The function block SND_SMS[FB17] in detail

The function block SND_SMS[FB17] generates a telegram based on the data


parameterized by the user, which is then transmitted via an open TCP connection
to the SCALANCE M873 / M875 (Section 3.3).
The parameters IP_ADR (IP_Address) and DEVICE_ID (Device_ID) are relevant
for the TCP connection.
Table 3-2 DEVICE_ID
DEVICE_ID CPU type
B#16#01 CPU 151-8, WinAC RTX IF1
B#16#02 CPUs 315-2 PN/DP, 317-2 PN/DP, and IM 154-8
B#16#03 CPU 319-3 PN/DP
B#16#05 CPUs 414-3 PN/DP, 416-3 PN/DP, and 416-3F PN/DP
B#16#06 WinAC RTX IF2
B#16#0B WinAC RTX IF3
B#16#0F WinAC RTX IF4

3.1.3 Connection parameters for the SND_SMS[FB17] block

Port address
Siemens AG 2013 All rights reserved

The port address of the SCALANCE M873 / M875 is freely parameterizable


(default value in the SCALANCE M873 / M875: 26864). The value can be changed
via the instance DB (port_no). This port number also has to be changed
correspondingly in the parameterization on the SCALANCE M873 / M875 in the
"SMS messaging from the local network" function.

Connection ID
The connection ID for the SMS block required for open TCP/IP communication is
Copyright

fixedly parameterized in FB17 to the value W#16#63.


If you want to configure further open communication connections apart from SMS
messaging, different connection IDs have to be selected for each connection (to be
changed via the instance DB: con_id).

SMS Messages via SCALANCE M873 / M875


14 V2.0, Entry ID: 54361177
3 Function Mechanisms of this Application
3.2 The function block SND_SMS_CP[FB18] in detail

3.2 The function block SND_SMS_CP[FB18] in detail


3.2.1 Program overview

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]

User blocks S7 standard


library blocks

The SND_SMS_CP[FB18] block is called in OB1. The input and output parameters
Copyright

of the SND_SMS_CP[FB18] are stored in the global DB SMS_CP_PARAM[DB12].


(For your solution, you can store these values in different data blocks.)

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.

SMS Messages via SCALANCE M873 / M875


V2.0, Entry ID: 54361177 15
3 Function Mechanisms of this Application
3.2 The function block SND_SMS_CP[FB18] in detail

Calling the SND_SMS_CP[FB18]


The figure and table below show the call interface of the user block
SND_SMS_CP[FB18] in OB1.

Figure 3-5

INPUT

OUTPUT
Siemens AG 2013 All rights reserved
Copyright

Meaning of the individual parameters


The input/output parameters of the SND_SMS_CP[FB18] are identical with the
parameters of the SND_SMS_[FB17] with the following exceptions:
Table 3-3
Name Data type Description / remarks
CON_ID INT Connection ID
LADDR DWORD Start address of the CP

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].

SMS Messages via SCALANCE M873 / M875


16 V2.0, Entry ID: 54361177
3 Function Mechanisms of this Application
3.3 Generating and sending an SMS message

Figure 3-6

Similar to the function block SND_SMS[FB17], the SND_SMS_CP[FB18]


generates a telegram based on the data parameterized by the user, which is then
transmitted via an open TCP connection to the SCALANCE M873 / M875.

3.3 Generating and sending an SMS message


The graphic below shows schematically how the SND_SMS[FB17] /
SND_SMS_CP[FB18] generates a telegram from the input parameters.
Figure 3-7
Siemens AG 2013 All rights reserved

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

The telegram has to comply with the following format:


Username#Password#CommandCode#Seq-Num;Telno;Messagetext:

Example: User#Password#105#01;004943465789;my SMS text:

SMS Messages via SCALANCE M873 / M875


V2.0, Entry ID: 54361177 17
3 Function Mechanisms of this Application
3.4 Error and status display

SMS messaging requires authentication. Therefore, the telegram contains a


Username and Password which also have to entered correspondingly in the Web
user interface of the SCALANCE M873 / M875 at "SMS messaging from the local
network".

Note The username and password in the SMS_PARAM[DB11] /


SMS_CP_PARAM[DB12] and in the configuration of the SCALANCE M873 /
M875 have to be identical. If this is not the case, the SMS message is not sent.
In this case, SCALANCE M873 / M875 does not give any feedback to the
SND_SMS[FB17] / SND_SMS_CP[FB18] block.

3.4 Error and status display


The function block SND_SMS[FB17] / SND_SMS_CP[FB18] provides a STATUS
output for error diagnosis. By reading the STATUS output of the function block, you
get information about logical errors and error messages that might occur in the
communication between the control unit and SCALANCE M873 / M875.
The error messages are structure such that the first word indicates the block which
triggered this message; for example, the error message 16#000180A3 was
triggered by TCON. The table below provides a list of possible error messages.
Siemens AG 2013 All rights reserved

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.

Error messages triggered by the SND_SMS[FB17] / SND_SMS_CP[FB18] are


described in the table below.

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

SMS Messages via SCALANCE M873 / M875


18 V2.0, Entry ID: 54361177
3 Function Mechanisms of this Application
3.4 Error and status display

Status Meaning Support / remarks


identical with the IP
address of the
SCALANCE M873 /
M875.
the S7 CPU is physically
connected with the
SCALANCE M873 /
M875.
16#0000_8106 Character x contained in the TELNO. Enter the desired phone
number in the TELNO
parameter.

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

SMS Messages via SCALANCE M873 / M875


V2.0, Entry ID: 54361177 19
4 Installation
4.1 Hardware configuration

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

SMS Messages via SCALANCE M873 / M875


20 V2.0, Entry ID: 54361177
4 Installation
4.2 Installation of the software

No. Instruction Remarks


M873 / M875.

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

CP343-1 Advanced IT 192.168.0.2


SCALANCE M873 / M875 192.168.0.3
PG/PC 192.168.0.100

4.2 Installation of the software


Copyright

For this application, STEP 7 is required.


Table 4-3
No. Instruction Remarks
1. Install STEP 7 V12. Follow the instructions of the
installation program.

SMS Messages via SCALANCE M873 / M875


V2.0, Entry ID: 54361177 21
5 Startup of the Application
5.1 Installation of the application software

5 Startup of the Application


5.1 Installation of the application software
The table below lists the steps required for the installation of the sample code.
Table 5-1
No. Instruction
1 The project is available on the HTML page from which you downloaded this document. Save the
"54361177_SMS_SCALANCE_M_CODE_V20.zip" project on your hard disk.
2 Extract the project by right-clicking on the zipped folder.

5.2 Configuration of the SCALANCE M873 / M875


The SCALANCE M873 / M875 is commissioned in three steps:
Executing the PIN configuration
Inserting the SIM card in the device
Changing the IP address
Siemens AG 2013 All rights reserved

Executing the SMS configuration

Adapting the PG/PC IP address


Table 5-2
No. Instruction
1 After delivery or after a reset to the factory settings, the SCALANCE M873 / M875 has the address
192.168.1.1.
For configuration of the SCALANCE M873 / M875, assign your PG/PC an IP address that is in the
Copyright

same network as your SCALANCE M873 / M875 (for example, 192.168.1.100).

Step 1: PIN configuration


In order that the SCALANCE M873 / M875 can communicate via the GSM network,
the device has to be informed of the PIN of the SIM card.

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

SMS Messages via SCALANCE M873 / M875


22 V2.0, Entry ID: 54361177
5 Startup of the Application
5.2 Configuration of the SCALANCE M873 / M875

No. Instruction Remarks / hints


4. The administrator web page is opened. The default language is German. The language can be
changed in the top right field and the setting can be applied to the SCALANCE M873 / M875 with
"Go".

5. Now go to "External Network > UMTS/EDGE".


Siemens AG 2013 All rights reserved

Enter the PIN of your SIM card.


Copyright

Save the settings with "Save".

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.

SMS Messages via SCALANCE M873 / M875


V2.0, Entry ID: 54361177 23
5 Startup of the Application
5.2 Configuration of the SCALANCE M873 / M875

Step 2: Inserting the SIM card


Table 5-4
No. Instruction Remarks / hints
1. Disconnect the SCALANCE M873 / M875 from
the power supply.
2. Insert the SIM card as shown in the figure and
connect the router with the power supply.

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

Q (Quality): ON, lights up with interruptions


depending on the field intensity

Step 3: Changing the IP address


Table 5-5
No. Instruction
1. Reopen the administrator web page of the SCALANCE M873 / M875. The "Overview" screen
provides, among other things, information about the connection with the GSM network and the
Copyright

signal strength.

SMS Messages via SCALANCE M873 / M875


24 V2.0, Entry ID: 54361177
5 Startup of the Application
5.2 Configuration of the SCALANCE M873 / M875

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

SMS Messages via SCALANCE M873 / M875


V2.0, Entry ID: 54361177 25
5 Startup of the Application
5.2 Configuration of the SCALANCE M873 / M875

Step 4: SMS configuration


Table 5-6
No. Instruction
1. Go to "SMS > SMS over IP".
Activate Enable SMS messaging from the local network.
Enter the username and password. (These values then have to be entered at the input
parameters Username and Password in the SMS_PARAM[DB11] or SMS_CP_PARAM[DB12].)

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

Apply the settings with "Save".


3. Go to "SMS > Service Center".
In order that the SMS function works reliably, enter the phone number of the Service Center
(SMSC) here (list for Germany: http://www.telespiegel.de/html/sms-
Copyright

kurzmitteilungszentralen.html ). If nothing is stated here, the standard SMSC of your network


U

operator is used.

Apply the settings with "Save".

SMS Messages via SCALANCE M873 / M875


26 V2.0, Entry ID: 54361177
5 Startup of the Application
5.3 Configuration of the S7 station

5.3 Configuration of the S7 station


Reading out the properties of the TCP connection for the CPU with IE CP
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:
Table 5-7
No. Instruction Remarks
1. Open the STEP 7 project in the TIA portal.
2. Open the "Device configuration" of the "CPU
with IE CP" station and change to the
"Network view".

3. Click on "Connections" and then on the TCP


connection.
Siemens AG 2013 All rights reserved

4. In the "Properties > Local ID" you find the


Copyright

parameters which you are later supposed to


enter in the SMS_CP_PARAM[DB12].

5. In the "Address details" field you can adapt the


partner address or partner port.
Note: The partner for the S7 CPU is the
SCALANCE M873 / M875.

Assigning the IP address


Before the STEP 7 project can be downloaded to the S7 CPU, the IP address of
the S7 CPU (or the CP) via which the project is downloaded to the S7 CPU has to
be changed in accordance with The table below provides an overview of the IP
addresses used in this sample program.
.

SMS Messages via SCALANCE M873 / M875


V2.0, Entry ID: 54361177 27
5 Startup of the Application
5.3 Configuration of the S7 station

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"

4 Under the required accessible


device, double-click on "Online & diagnostics".

5 In the "Online & diagnostics" dialog, go to


"Functions > Assign IP address".
Siemens AG 2013 All rights reserved

6 Enter the IP address in accordance with The


table below provides an overview of the IP
addresses used in this sample program.
and click on "Assign IP address".
Copyright

Downloading the STEP 7 project


Table 5-9
No. Instruction Remarks
1 Select the S7 station and download the CPU
project to your S7 CPU via the download icon.

SMS Messages via SCALANCE M873 / M875


28 V2.0, Entry ID: 54361177
6 Operation of the Application

6 Operation of the Application


This chapter provides information about how to operate this application.
All variables required for that are stated in the variables table "Watch table SMS" /
"Watch table SMS_CP".
Figure 6-1

Send trigger

Output parameters

The sending of an SMS message is controlled via the "SMS_PARAM".SND_SMS


variable.
When the user program registers a positive edge in the SND_SMS[FB17] /
SND_SMS_CP[FB18], the state machine is started and the generation and sending
Siemens AG 2013 All rights reserved

of the SMS message is triggered.


The table below gives instructions for sending an SMS message.
Table 6-1
No. Instruction
1. Connect the PROFINET interface of the S7 CPU (or the CP) to the Ethernet socket of
the SCALANCE M873 / M875.
2. Enter the desired input parameters in the SMS_PARAM[DB11].
Copyright

Save the settings and reload the SMS_PARAM[DB11].

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:
).

SMS Messages via SCALANCE M873 / M875


V2.0, Entry ID: 54361177 29
6 Operation of the Application
5.3 Configuration of the S7 station

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.

The variable "SMS_PARAM".SND_SMS is reset automatically after the send trigger.


5. After successful sending of the SMS message, the DONE parameter is set to TRUE. In the case
of an error, ERROR is set to TRUE and STATUS is assigned a value not equal to 0. For error
Siemens AG 2013 All rights reserved

evaluation, please use the error list provided in Section 3.4.


For additional diagnostic information, please refer to the log file of the SCALANCE M873 / M875
at "System > Log".
6. To send a new SMS message, first check in the variables table whether the "SMS_PARAM".Busy
variable has been reset. Only then can "SMS_PARAM".SND_SMS be activated again.
Copyright

SMS Messages via SCALANCE M873 / M875


30 V2.0, Entry ID: 54361177
7 Glossary

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

SMS Messages via SCALANCE M873 / M875


V2.0, Entry ID: 54361177 31
8 References

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

SMS Messages via SCALANCE M873 / M875


32 V2.0, Entry ID: 54361177

You might also like