0% found this document useful (0 votes)
169 views322 pages

Basic Training SIEMENS

Uploaded by

Minh Phong
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
169 views322 pages

Basic Training SIEMENS

Uploaded by

Minh Phong
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 322

Basic Training

Micro-automation

Unrestricted © Siemens AG 2020 www.siemens.com/tia


Our comprehensive offering
for the manufacturing industry

Unrestricted © Siemens AG 2017


Slide 16 SLT / DF FA
SIMATIC Controller

Unrestricted © Siemens AG 2017


Slide 17 S7-1200 ET200SP CPU Open controller S7-1500 C S7-1500 S7-1500 T SIMATICSLT / DF FA
Controller
Performance and Flexible for Machine and Manufacturer

Unrestricted © Siemens AG 2017


Slide 18 Single Axis Multiple Axis SLT / DF FA
Be flexible thanks to networking possibilities

SIMATIC S7-1200
SIMATIC S7-1200

2. Signal board or
Communication
board

3. Signal Module
for I/O expansion
(up to 8 : depended on model)
4. Communication 1. Main unit
(10 DIO, 14 DIO, 24 DIO
Unrestricted © Siemens AG 2017 Module (up to 3) depended on model)
Slide 33 SLT / DF FA
SIMATIC S7-1200

6 DI, 4 DQ, 2 AI 8 DI, 6 DQ, 2 AI 14 DI, 10 DQ, 2 AI

CPU1211C CPU1212C CPU1214C

14 DI, 10 DQ, 2 AI

CPU1215C, CPU1217C
2 AQ

CPU1215C, CPU1217C
2 Ethernet ports
CPU1215C CPU1217C
Unrestricted © Siemens AG 2017
Slide 34 SLT / DF FA
SIMATIC S7-1200 : Local station

S7-1200 :
S7-1200 : CPU1212C
CPU1211C
6 DI, 4 DQ, 2 AI 8 DI, 6 DQ, 2 AI

3 : HSC 4 : HSC

Board

Board

3 CM 3 CM Board 2 SM

14 DI, 10 DQ, 2 AI
S7-1200 : CPU1214C, CPU1215C, CPU1217C
6 : HSC

CPU1215C, CPU1217C
2 AQ

CPU1215C, CPU1217C
2 Ethernet ports

Unrestricted © Siemens AG 2017


3 CM Board 8 SM
Slide 35 SLT / DF FA
SIMATIC S7-1200 : Distributed I/O

SIMATIC S7-1200
IO Controller

1. Can connect to IO Device : up to 16 devices


( The amount should be reduced if the controller is using other network applications together )

2. Can connect up to 256 sub-modules ( each IO Device can connect up to 16 sub-modules )

PROFINET

SIMATIC ET200SP SIMATIC ET200SP SIMATIC ET200SP SIMATIC ET200SP


IO Device IO Device IO Device IO Device
1 2 3 16
Unrestricted © Siemens AG 2017
Slide 36 SLT / DF FA
S7-1200 : Processor

Type of Power Supply

Type of DI

Use PTO to
select DC

Type of DO
Unrestricted © Siemens AG 2017
Slide 37 SLT / DF FA
S7-1200 : Board

Unrestricted © Siemens AG 2017


Slide 38 SLT / DF FA
S7-1200 : Communication (CM)

Unrestricted © Siemens AG 2017


Slide 39 SLT / DF FA
S7-1200 : Signal module (SM)

Unrestricted © Siemens AG 2017


Slide 40 SLT / DF FA
S7-1200 : Engineering framework

SIMATIC STEP 7 (TIA Portal) V14 SP1


TRIAL Download
Entry type: Download, Entry ID:
109745153, Entry date: 03/31/2017

Unrestricted © Siemens AG 2017


Slide 41 SLT / DF FA
Contents

Introduction to SIMATIC Step 7

Programming Procedure

Basic programming 1

Basic programming 2

PLC Concept & Programming Concept

Technical note

Appendix
Unrestricted © Siemens AG 2017
Slide 42 SLT / DF FA
1. Introduction to SIMATIC Step 7

1 System requirements

2 Software Environment

Unrestricted © Siemens AG 2017


Slide 43 SLT / DF FA
1.1 System requirements "SIMATIC STEP 7 Basic"

Unrestricted © Siemens AG 2017


Slide 44 SLT / DF FA
1.2 Software Environment : Portal View vs Project View

Unrestricted © Siemens AG 2017


Slide 45 SLT / DF FA
1.2 Software Environment : Portal view

1. Menu for various tasks


2. Task selected from the menu
3. Recently opened projects for quickly
re-open / open a project
4. Switch between Project view and Portal
view

Unrestricted © Siemens AG 2017


Slide 46 SLT / DF FA
1.2 Software Environment : Project view

1. Menu bar & Project name


Toolbar
2. Project navigator 3. Work area 4. Task cards
(Project tree)
Task cards
Project tree • Hardware catalog
• Devices • Online tools
• Reference projects • Tasks
• Details view • Libraries
5. Inspector window
6. Changes to Portal view 7. Editor bar
Unrestricted © Siemens AG 2017
Slide 47 SLT / DF FA
Example Layout of Project tree

Unrestricted © Siemens AG 2017


Slide 48 SLT / DF FA
Example Layout of the Work area

Unrestricted © Siemens AG 2017


Slide 49 SLT / DF FA
Example Layout of the Inspector window

Unrestricted © Siemens AG 2017


Slide 50 SLT / DF FA
Example Layout of Task cards

Unrestricted © Siemens AG 2017


Slide 51 SLT / DF FA
Keyboard operation in the TIA Portal

Unrestricted © Siemens AG 2017


Slide 52 SLT / DF FA
Contents

Introduction to SIMATIC Step 7

Programming Procedure

Basic programming 1

Basic programming 2

PLC Concept & Programming Concept

Technical note

Appendix
Unrestricted © Siemens AG 2017
Slide 54 SLT / DF FA
2. Programming Procedure

1. Create new project

2. Hardware Configuration

3. Declaring PLC Tags

4. Creating and Using Function Blocks

5. Compile Project

6. Download to PLC

7. Monitoring On/Off

Unrestricted © Siemens AG 2017 8. Save Project


Slide 55 SLT / DF FA
2.1 Create new project

Declare basic information of the


project

Choose "Create new project"

Choose "Create" to finish creating


a new project

Unrestricted © Siemens AG 2017


Slide 56 SLT / DF FA
2.1 Create new project

Portal view
From Portal view, there are 3 methods to switch to Project view:
a. In "First steps" choose "open the project view"
b. Choose "Project view" in the corner
c. Click the combination " Alt + F7 " on the keyboard

Project view

c Press Alt + F7
b

Unrestricted © Siemens AG 2017


Slide 57 SLT / DF FA
2.1 Create new project : Assign device name
Name the device
Add new device

Assign device name

Select CPU model

Specify Firmware version

Choose your device by its article number


( See next slide to find what is article number of a
device )
Choose the right firmware of your
device
Double-click Add new device

Click OK

Unrestricted © Siemens AG 2017


Slide 58 SLT / DF FA
2.1 Create the User Program

Device Article Number

Unrestricted © Siemens AG 2017


Slide 59 SLT / DF FA
2.2 Hardware Configuration : Using hardware catalog

Hardware catalog
6

Your selected CPU is shown.


Select Hardware catalog if you want to add other
modules such as Signal Modules (SM) or
Unrestricted © Siemens AG 2017
Communication Module (CM)
Slide 60 SLT / DF FA
Show

Hide

Hide Device overview 7

Unrestricted © Siemens AG 2017


Slide 61 SLT / DF FA
2.2 Hardware Configuration : Using hardware catalog

Add Signal Modules and Communications Modules

Select Signal Module and

Communication module that

Communication module Board Signal module


you want to use

Drag & Drop


2.2 Hardware Configuration

CPU1212 : Up to 2 Signal Modules


CPU1214 : Up to 8 Signal Modules
CPU1215 : Up to 8 Signal Modules
1 Board CPU1217 : Up to 8 Signal Modules

Up to 3 Communication Modules
Unrestricted © Siemens AG 2017
Slide 63 SLT / DF FA
2.2 Hardware Configuration : Upload from the unit

1 4
2
6
3 5

7 7

9
Unrestricted © Siemens AG 2017
Slide 64 SLT / DF FA
2.2 Hardware Configuration : Upload from the unit

11

12

13

10
Check to flash LED

14
Unrestricted © Siemens AG 2017
Slide 65 SLT / DF FA
2.2 Hardware Configuration : Setting IP address and Subnet mask

Double click to
open Device view
1
Click CPU
2
3
Specify the IP address and Subnet mask that you

4 5 want to use for your controller

In case of using a router, enter the IP


Unrestricted © Siemens AG 2017
Slide 66
6 address of the router
SLT / DF FA
2.2 System and clock memory

System and clock memory:

- System memory bits are bits working as a system constant, such as M1.2 is always ON and M1.3 is always OFF

- Clock memory bits are output as a clock signal with various frequencies

Unrestricted © Siemens AG 2017


Slide 67 SLT / DF FA
Clock memory

10 Hz 100 ms
5 Hz 200 ms
2.5 Hz 400 ms
2 Hz 500 ms
1.25 Hz 800 ms
1 Hz 1 Sec
0.625 Hz 1.6 Sec
0.5 Hz 2 Sec

Unrestricted © Siemens AG 2017 Ref : Page 113, S7-1200 Programmable controller, System Manual, V4.2, 09/2016, A5E02486680-AK
Slide 68 SLT / DF FA
2.3 Declaring PLC Tags

You can specify the name and byte of the IO Devices

1 Type Tag table Absolute address


Symbolic name

Specify the name/symbol


of each I/O

2 Unrestricted © Siemens AG 2017


Slide 69 SLT / DF FA
PLC Tags table

Unrestricted © Siemens AG 2017


Slide 70 SLT / DF FA
PLC Tags table : Auto Fill

Click the button at the right corner of the "Name" box

Move the mouse down to add tags and


release when the number of tags is
reached

Number of tags will be added


Unrestricted © Siemens AG 2017
Slide 71 SLT / DF FA
2.4 Programming

(1) Double click


at instruction

Drag & Drop (2)Use function


key
(3)Drag & Drop
Drag & Drop

Blank block
Open branch
Unrestricted © Siemens AG 2017
Slide 72 Close branch SLT / DF FA
Sample 1 : Self interlocking

Drag & Drop

Unrestricted © Siemens AG 2017


Slide 73 SLT / DF FA
2.5 Compile Project

Click Compile Project


If errors occur while system is compiling, you can go directly to where

the error is in order to fix this by clicking button.

Otherwise you can not download your program to the CPU

After TIA finishes compiling your program, the information

will be shown there. If there is no Error, you can download

your program to the CPU

Unrestricted © Siemens AG 2017


Slide 74 SLT / DF FA
Change CPU device

Right-click at CPU

Then choose another CPU or


another firmware. Then click
OK

Click change device

Unrestricted © Siemens AG 2017


Slide 75 SLT / DF FA
2.6 Download to PLC

Click Download
Choose interface type

Choose Target device (PLC)


Flash LED Click Start search

6
Click Load
Unrestricted © Siemens AG 2017
Slide 76 SLT / DF FA
2.6 Download to PLC

7 Choose stop all

Click Load 8

Choose Start all 9

Click Finish
10
Unrestricted © Siemens AG 2017
Slide 77 SLT / DF FA
2.7 Monitoring Online

Unrestricted © Siemens AG 2017


Slide 78 SLT / DF FA
2.8 Save Project

1. Save project: save all the changes to you current project

2. Save as : save your project as a new project file

3. When you create a project there are some files created. So when you want to use your
project with another device, you should copy completely all the project folder not just the
.ap file

Unrestricted © Siemens AG 2017 In case you are using TIA Portal V13, the file name extension will be .ap13
Slide 79 SLT / DF FA
A-1 Archiving and Retrieving Project

Choose folder that will


store your Archived
project

1. Click Project - Archive : Archive is to compress you whole project into a file so that will be
easy for transfer the project.

2. Choose the path: the archived file with have the extension .zap14 if you use TIA Portal
V14 to archive the project.
Unrestricted © Siemens AG 2017
3. Click Archiving.
Slide 80 SLT / DF FA
A-1 Archiving and Retrieving Project

Select folder to store the


retrieved project

Choose Archived project

1. Choose Project - Retrieve.


2. Go to the folder storing your archived project, the extension of the file should
be .zap14 ( it means that the project is archived via TIA Portal V14 ). Higher
versions of TIA such as V15, V15.1 can also used to retrieve the archived
project via TIA V14, V13 or lower ones.
3. Click Open
4. Choose a folder to store your retrieved project
Unrestricted © Siemens AG 2017
5. Click OK
Slide 81 SLT / DF FA
A-2 Convenient tools : Floating working area

1. Choose a random window ( here is Device configuration )

2. Click float and we will have a separated Device configuration


working window

Unrestricted © Siemens AG 2017


Slide 82 SLT / DF FA
A-2 Convenient tools : Floating working area

ForUnrestricted
example,© Siemens
you can
AGchoose
2017 Main OB window and click float, then you can easily drag & drop the I/O
Slide 83 SLT / DF FA
A-2 Convenient tools : Drag & Drop

1. Expand the size to 400% zoom. The infographic of the


CPU and modules will appear

2. Drag and drop to assign the I/O

Unrestricted © Siemens AG 2017


Slide 84 SLT / DF FA
A-2 Convenient tools : Split editor space

With split view, we can easily drag and drop


the I/O Tag to the device configuration

Unrestricted © Siemens AG 2017


Slide 85 SLT / DF FA
Easy-to-use tools

S7 1200 CPUs do not have physical RUN-STOP switches like other models, but
RUN-STOP can be switched by buttons in the CPU operator panel of TIA Portal

Unrestricted © Siemens AG 2017


Slide 87 SLT / DF FA
Contents

Introduction to SIMATIC Step 7 (TIA Portal V13)

Programming Procedure

Basic programming 1

Basic programming 2

PLC Concept & Programming Concept

Technical note

Appendix
Unrestricted © Siemens AG 2017
Slide 88 SLT / DF FA
3. Basic programming 1 : Bit operant

NO

NC

AND

OR

Set

Ptrig
Unrestricted © Siemens AG 2017
Slide 89 SLT / DF FA
3.1 NO (Normally Open)

Absolute Address

Symbolic name

Unrestricted © Siemens AG 2017


Slide 90 SLT / DF FA
3.2 NC (Normally Close)

Absolute Address

Symbolic name

Unrestricted © Siemens AG 2017


Slide 91 SLT / DF FA
3.3 AND

Absolute Address

Symbolic name

Unrestricted © Siemens AG 2017


Slide 92 SLT / DF FA
3.4 OR

Absolute Address

Symbolic name

Unrestricted © Siemens AG 2017


Slide 93 SLT / DF FA
3.4 SET

Absolute Address

Symbolic name

Unrestricted © Siemens AG 2017


Slide 94 SLT / DF FA
3.6 Trig : Ptrig & Ntrig

There are 2 types of Trig:


1. Positive Trig
2. Negative Trig

Unrestricted © Siemens AG 2017


Slide 95 SLT / DF FA
Exercise - 1

Right click Click Modify Choose modify to 1

Unrestricted © Siemens AG 2017


Slide 96 SLT / DF FA
Contents

Introduction to SIMATIC Step 7 (TIA Portal V13)

Programming Procedure

Basic programming 1

Basic programming 2

PLC Concept & Programming Concept

Technical note

Appendix
Unrestricted © Siemens AG 2017
Slide 98 SLT / DF FA
4. Basic programming 2 : Word operant

Timer

Counter

Compare

Mathematic Function

Convert data

Unrestricted © Siemens AG 2017


Slide 99 SLT / DF FA
4.1 Timer
Drag and drop TON block to the ladder

Name the instance DB

Click OK

Fixed terms for PT

PT = 700 ms ➔ T#700ms
PT = 5 Sec ➔ T#5s
PT = 10 Minute ➔ T#10m
PT = 8 Hour ➔ T#8h
PT = 5 Day ➔ T#5d
Time set for PT can be a constant or a time type
PT = 1hr, 45min, 30sec, 15ms
variables
➔ T#1h_45m_30s_15ms
Unrestricted © Siemens AG 2017
Slide 100 SLT / DF FA
4.2 Counter

Drag and drop CTU to the ladder

Name for instance DB

Click OK

Input for PV should be a constant or a Integer data


type

Unrestricted © Siemens AG 2017


Slide 101 SLT / DF FA
Example : Timer & Counter

1) %I0.0 turn on 2) TON starts working

3) TON will work for a set


time ( here is 5 seconds )

4) %Q0.0 turn on

Timer Accumulator

Define a tag for resetting timer


Unrestricted © Siemens AG 2017
Slide 102 Determine the time for PT SLT / DF FA
Exercise – 2 : Counter

Unrestricted © Siemens AG 2017


Slide 103 SLT / DF FA
Blocks, timers, and counters supported by S7-1200

Unrestricted © Siemens AG 2017


Slide 104 SLT / DF FA
4.3 Compare

Unrestricted © Siemens AG 2017


Slide 105 SLT / DF FA
4.4 Mathematic Function

Output result
Add new parameter
input
parameter

Unrestricted © Siemens AG 2017


Slide 106 SLT / DF FA
Exercise – 3 : Calculation

Click
to insert new Set data type of
inputs block to REAL

Real

Convert Int ➔ Real Int Real

Real Convert from


INT to REAL
Int
Unrestricted © Siemens AG 2017
Slide 107 SLT / DF FA
Monitor on/off

Click Modify

Right-click the name tag

Click Modify Operand

Enter your desired value

Click OK

(100.0+10.0)x(15.0-5.0) =1100
Unrestricted © Siemens AG 2017
Slide 108 SLT / DF FA
Data type

I3.7 I3.6 I3.5 I3.4 I3.3 I3.2 I3.1 I3.0 I2.7 I2.6 I2.5 I2.4 I2.3 I2.2 I2.1 I2.0 I1.7 I1.6 I1.5 I1.4 I1.3 I1.2 I1.1 I1.0 I0.7 I0.6 I0.5 I0.4 I0.3 I0.2 I0.1 I0.0

BYTE 3 BYTE 2 BYTE 1 (1 byte data) BYTE 0


IB3 IB2 IB1 IB0
WORD 2 (2 bytes data) WORD 0
IW2 IW0
(4 bytes data) DWORD 0
ID0

I0.7 I0.6 I0.5 I0.4 I0.3 I0.2 I0.1 I0.0 0 IB0 IW0 ID0
Memory I1.7 I1.6 I1.5 I1.4 I1.3 I1.2 I1.1 I1.0 1 IB1
I2.7 I2.6 I2.5 I2.4 I2.3 I2.2 I2.1 I2.0 2 IB2 IW2
I Q M I3.7 I3.6 I3.5 I3.4 I3.3 I3.2 I3.1 I3.0 3 IB3
I4.7 I4.6 I4.5 I4.4 I4.3 I4.2 I4.1 I4.0 4 IB4 IW4 ID4
0 0 0
I5.7 I5.6 I5.5 I5.4 I5.3 I5.2 I5.1 I5.0 5 IB5
1023 1023 xxx Bytes I6.7 I6.6 I6.5 I6.4 I6.3 I6.2 I6.1 I6.0 6 IB6 IW6
Unrestricted © Siemens AG 2017
Slide 109 I7.7 I7.6 I7.5 I7.4 I7.3 I7.2 I7.1 I7.0 7 IB7 SLT / DF FA
Memory

CPU 1211C / 1212 C


I
➢ I : 0…1023 (1024 bytes)
➢ Q : 0…1023 (1024 bytes)
➢ M : 0…4095 (4096 bytes)
Memory Q
CPU 1214C / 1215C / 1217C
➢ I : 0…1023 (1024 bytes)
M ➢ Q : 0…1023 (1024 bytes)
➢ M : 0…8191 (8192 bytes)
Unrestricted © Siemens AG 2017
Slide 110 SLT / DF FA
5.1.8 Accessing the data of the S7-1200

The data of Step 7 is stored in following types of memory:


1. Global memory: is used for Input/Output and memory blocks. Every block can access to use this type of
data
2. PLC Tag table: tags in this table can be use by declare their symbolic names
3. Data Block (DB): is used to store values for instruction blocks. There are 2 types of DB:
I. Global DB: store the data that every instruction blocks can access to
II. Instance DB: is a unique DB of a Function Block. It is used to store the data/parameter of its own FB
4. Temp memory: is used as a place to store temporary data for some blocks and data in temp memory will
be reset in new execute.

Unrestricted © Siemens AG 2017


Slide 111 SLT / DF FA
Data type

Unrestricted © Siemens AG 2017


Slide 112 SLT / DF FA
4.5 Convert Data

Convert blocks is used to convert 1 type of data to another


type of data. Here is convert a number type Real to Integer.
The Real value 12.535 will be round to 13 which its type is
Integer.

Unrestricted © Siemens AG 2017


Slide 113 SLT / DF FA
4.6 Move

Drag and drop Move block to the ladder

Unrestricted © Siemens AG 2017


Slide 114 SLT / DF FA
4.7 Processing of analog values

Analog signal module will read the values from input or output with a range of ±10 V, ±5 V, ±2.5 V, 0 – 20 mA
, or 4 - 20 mA, which is calculated into analog input value, the range of analog input value is from -27648 to
27648. Below is the value of the temperature sensor with input range is 4mA to 20mA and the analog input
value range is from 0 to 27648 and the engineering units range is from 50 Celsius degree to 100 Celsius
degree.

4 mA
X Y

20 mA 27648 100%
(X – 0) (Y – 50) (X-0) * (100-50)
= Y = 50 + (27,648-0)
(27,648 – 0)
Unrestricted © Siemens AG 2017
(100 – 50)
Slide 115 SLT / DF FA
4.7 Processing of analog values

Use 2 blocks NORM_X and SCALE_X to normalize and scale the input value to out desired value.

Norm_x output value can be 0 or 1.

AI

Depended on Depended on
specification engineering
value
Unrestricted © Siemens AG 2017
Slide 116 SLT / DF FA
4.7 Processing of analog values

Unrestricted © Siemens AG 2017


Slide 117 SLT / DF FA
Analog Input / Output for CPU unit

Unrestricted © Siemens AG 2017


Slide 118 SLT / DF FA
Analog Input / Output for Signal module (SM 1231, SM 1232)

AI

AO

Unrestricted © Siemens AG 2017


Slide 119 SLT / DF FA
Analog Input / Output for Signal module (SM 1234)

Unrestricted © Siemens AG 2017


Slide 120 SLT / DF FA
Note : Using analog

Chanel 0 (AI 0) ➔ %IW64


Chanel 1 (AI 1) ➔ %IW66 : 0..10 Volt
Value Voltage
0 0
xxxx 3
27648 10

%IW66

Unrestricted © Siemens AG 2017


Slide 121 SLT / DF FA
Contents

Introduction to SIMATIC Step 7

Programming Procedure

Basic programming 1

Basic programming 2

PLC Concept & Programming Concept

Technical note

Appendix
Unrestricted © Siemens AG 2017
Slide 122 SLT / DF FA
5. PLC Concept & Programming Concept

PLC concepts

Programming concepts

Unrestricted © Siemens AG 2017


Slide 123 SLT / DF FA
5.1 PLC concepts

Execution of the user program

Data storage, memory areas, I/O and


addressing

Unrestricted © Siemens AG 2017


Slide 124 SLT / DF FA
5.1.1 Operating modes of the CPU

Siemens CPUs have 3 modes for operating

1. STOP mode: in this mode the CPU will not process the program. You can download the project to the CPU in this mode.

2. OB Startup: this OB will start first and the interrupt OB will be skipped during this OB is processing.

3. RUN mode: in this mode the system will process normally and interrupts will be processed in this mode

Unrestricted © Siemens AG 2017


Slide 125 SLT / DF FA
5.1.2 Programming concept

Linear programming Structured programming

Solutions for small Complex automation tasks


Main program Main program Subprograms
automation tasks can be can be more easily
programmed linearly in a handled and managed by
program cycle OB. This dividing them into smaller
Main 1 Main 1
is only recommended for sub-tasks that correspond
simple programs. to the technological Block 1
functions of the process or
The following figure
that can be reused. These
shows a linear program
sub-tasks are represented Block 2
schematically: The
in the user program by
"Main1" program cycle
blocks. Each block is then
OB contains the
an independent section of
complete user program.
the user program

Unrestricted © Siemens AG 2017


Slide 129 SLT / DF FA
5.1.3 Overview of the block types

Block type Brief description


Organization blocks (OB) Organization blocks define the structure of the user program.

Functions (FC) Functions contain program routines for recurring tasks. They have no
"memory".

Function blocks (FB) Function blocks are code blocks that store their values permanently in
instance data blocks, so that they remain available even after the block
has been executed.
Instance data blocks (DB) Instance data blocks are assigned to a function block when it is called
for the purpose of storing program data.

Global data blocks (DB) Global data blocks are data areas for storing data that can be used by
any blocks.
Unrestricted © Siemens AG 2017
Slide 130 SLT / DF FA
5.2 Programming concepts

Unrestricted © Siemens AG 2017


Slide 143 SLT / DF FA
5.2.1 FB and Instance DB

Name FB
2

Internal variable of function block

Choose FB
Choose program 3
language for FB

Unrestricted © Siemens AG 2017


Slide 145 SLT / DF FA
5.2.2 FB and Instance DB

M2

M2

M2

M2

Unrestricted © Siemens AG 2017


Slide 146 SLT / DF FA
5.2.2 Using blocks to structure your program

You can nest the block calls for a more modular structure. In the following example, the nesting depth is 3:
the program cycle OB plus 3 layers of calls to code blocks.

Main [OB1]
FB

Instance DB

Unrestricted © Siemens AG 2017


Slide 147 SLT / DF FA
Exercise – 6 : FB

3
4

Unrestricted © Siemens AG 2017


Slide 148 SLT / DF FA
5.2.3 Programming language

There are 3 programming language:


1.LAD (ladder logic)
2.FBD (Function Block Diagram)
3.SCL (structured control language)

Unrestricted © Siemens AG 2017


Slide 149 SLT / DF FA
Exercise – 7 : SCL

Unrestricted © Siemens AG 2017


Slide 150 SLT / DF FA
Exercise – 7.1 : SCL

Unrestricted © Siemens AG 2017


Slide 151 SLT / DF FA
Exercise – 7.1 : SCL

Unrestricted © Siemens AG 2017


Slide 152 SLT / DF FA
Exercise – 7.1 : SCL

Unrestricted © Siemens AG 2017


Slide 153 SLT / DF FA
Exercise – 7.1 : SCL

Unrestricted © Siemens AG 2017


Slide 154 SLT / DF FA
Exercise – 7.2 : SCL

Unrestricted © Siemens AG 2017


Slide 155 SLT / DF FA
Exercise – 7.2 : SCL

Unrestricted © Siemens AG 2017


Slide 156 SLT / DF FA
Exercise – 7.2 : SCL

Unrestricted © Siemens AG 2017


Slide 157 SLT / DF FA
Exercise – 8 : Char & String

4
3
Unrestricted © Siemens AG 2017
Slide 159 SLT / DF FA
THANK YOU

Thank you very much for you attention.

If you have any inquiries, please do not hesitate to contact us.

siemens.com

Unrestricted © Siemens AG 2017


Slide 188 SLT / DF FA
Contents

Introduction to SIMATIC Step 7

Programming Procedure

Basic programming 1

Basic programming 2

PLC Concept & Programming Concept

Technical note

Appendix
Unrestricted © Siemens AG 2017
Slide 189 SLT / DF FA
6.1 Program information

Unrestricted © Siemens AG 2017


Slide 190 SLT / DF FA
6.2 Set PG/PC Interface

Intel(R) 82574L Gigabit Network Connection.TCPIP.Auto.1 <Active>


1

3 Intel(R) PRO/1000 MT Network Connection.TCPIP.Auto.1 <Active>

4
Depended on your network adapters

Unrestricted © Siemens AG 2017


Slide 191 SLT / DF FA
6.3 Backup PLC Station

2
Create new project

Switch to Project view

Unrestricted © Siemens AG 2017


Slide 192 SLT / DF FA
Backup PLC Station

5 6

Update accessible devices


Upload project from PLC to back-up
Unrestricted © Siemens AG 2017
Slide 193 SLT / DF FA
Backup PLC Station

Unrestricted © Siemens AG 2017


Slide 194 SLT / DF FA
6.4 Factory reset

3
2

Unrestricted © Siemens AG 2017


Slide 195 SLT / DF FA
6.5 Update firmware

3
1

4
2
Choose the firmware

Unrestricted © Siemens AG 2017


Slide 196 SLT / DF FA
6.5 Update firmware

7
6

9
Unrestricted © Siemens AG 2017
Slide 197 SLT / DF FA
6.6 Web Server

3 4

Unrestricted © Siemens AG 2017


Slide 198 SLT / DF FA
User management

5. Add new user

5 6 7

Setting password
Unrestricted © Siemens AG 2017 Add user Setting
for user
authorized
Slide 199 user SLT / DF FA
User management

1. Add user 2. Setting authorized

3. Setting Password

New
FW4.2
7

Unrestricted © Siemens AG 2017 6


Slide 200 SLT / DF FA
Web server : Default web pages

Unrestricted © Siemens AG 2017


Slide 201 SLT / DF FA
Diagnostics

Unrestricted © Siemens AG 2017


Diagnostic Buffer
Slide 202 SLT / DF FA
6.7 Watch table

Unrestricted © Siemens AG 2017


Slide 203 SLT / DF FA
6.8 Enable Watch table in Web Server

3 4

1
Unrestricted © Siemens AG 2017
Slide 204 2 SLT / DF FA
Using Watch table in Web Server

Unrestricted © Siemens AG 2017


Slide 205 SLT / DF FA
Using Watch table in Web Server

Unrestricted © Siemens AG 2017


Slide 206 SLT / DF FA
TIA Portal Tutorial Center

Unrestricted © Siemens AG 2017


Slide 210 SLT / DF FA
STEP 7 Basic V14.0 : System Manual

Unrestricted © Siemens AG 2017


Slide 211 SLT / DF FA
Unrestricted © Siemens AG 2017
Slide 212 SLT / DF FA
SIMATIC Automation Tool

Entry type: Download, Entry ID: 98161300, Entry date: 10/01/2015

Download
Unrestricted © Siemens AG 2017 SIMATIC Automation Tool
Slide 213 SLT / DF FA
PRONETA
Commissioning and diagnostics tool for PROFINET networks

Entry type: Application example, Entry ID: 67460624, Entry date: 02/03/2016

Unrestricted © Siemens AG 2017


Slide 214 SLT / DF FA
Technical information

https://support.industry.siemens.com/cs/sc/3058/important
-issues-at-a-glance?lc=en-US
Unrestricted © Siemens AG 2017
Slide 215 SLT / DF FA
https://support.industry.siemens.com

1. Access Industry Online Support web site


https://support.industry.siemens.com/cs/products

2. Type product

3. Click to search

5. Click your expected information

Unrestricted © Siemens AG 2017


Slide 216
4. Click “CAx data” SLT / DF FA
CAx Data

6. Save file

Unrestricted © Siemens AG 2017


Slide 217 SLT / DF FA
Sales status and Technical data

Unrestricted © Siemens AG 2017


Slide 218 SLT / DF FA
SIMATIC BASIC HMI
Unrestricted © Siemens AG 2019 By: Nam Le Nguyen Hoang

Unrestricted
HMI Setup: Add HMI Device
Method 1 : Drag & Drop in network view

4 Drag & Drop


3

Choose your HMI with part-number

Basic information about HMI

Unrestricted © Siemens AG 20XX


HMI Setup: Add HMI Device
Method 1 : Drag & Drop in network view
Drag & Drop network connection
2
1

Then it will look like this

Drag & Drop


to connect HMI with Drag&Drop
PLC to create HMI connection 3

Unrestricted © Siemens AG 20XX


Page 3
HMI Setup: Add HMI Device
Method 1 : Drag & Drop in network view

After those steps, you can go to Connection


and check your connection

Unrestricted © Siemens AG 20XX


Page 4
HMI Setup: Add HMI Device
Method 2 : HMI Wizard

1
2 3

Remember checking here


5

Unrestricted © Siemens AG 20XX


Page 5
HMI Setup: Add HMI Device
Method 2 : HMI Wizard
After click OK, HMI
Wizard appears

Choose the controller


you want to connect with

3 2

Unrestricted © Siemens AG 20XX


Page 6
HMI Setup: Add HMI Device
Method 2 : HMI Wizard

Click

Your background
will be like this
Choose your
color 2

3
Unrestricted © Siemens AG 20XX
Page 7
HMI Setup: Add HMI Device
Method 2 : HMI Wizard

Check if you want to display


logo or date/time on HMI
and HMI will automatically put
Siemens logo
2

Your logo
1

Unrestricted © Siemens AG 20XX


Page 8
HMI Setup: Add HMI Device
Method 2 : HMI Wizard

Check if you want to


have alarm pages on Unacknowledged alarms display
your HMI alarm that is not acknowledged

Active system events provide


information of your system Pending alarms display acknowledged
alarms but still not solved

Unrestricted © Siemens AG 20XX


Page 9
HMI Setup: Add HMI Device
Method 2 : HMI Wizard

Or you can use these


commands

Double click here to


rename screen

Click here to add screen

Unrestricted © Siemens AG 20XX


Page 10
HMI Setup: Add HMI Device
Method 2 : HMI Wizard

Diagnostics

This screen shows your project


name, create time, author and
description

This screen shows table of user


administration

This screen shows system


information ( connection with
PLC, firmware… )
Check for screens you want to
display This screen shows some other
jobs ( switching online/offline,
stop run time… )

Unrestricted © Siemens AG 20XX


Page 11
HMI Setup: Add HMI Device
Method 2 : HMI Wizard

Right

Left

1 2
Drag & drop

3
Choose position of
button bar

Bottom
4
Unrestricted © Siemens AG 20XX
Page 12
HMI Setup: Add HMI Device
Method 2 : HMI Wizard

HMI automatically
generates screen buttons
Flow chart of your follow your screen flow
screens chart

Your system screens

Unrestricted © Siemens AG 20XX


Page 13
HMI
Coordinate & Ruler
Ex: Resolution (W x H in pixels) of HMI KTP 700 Basic is 800 x 480

x/w : 800 pixels


Coordinate ( 0, 0)

When you Drag & Drop object into


your screen this will show the
coordinate of the object
y/h: 480 pixels

Unrestricted © Siemens AG 20XX


Coordinate ( 800, 480)
Page 14
HMI
Grid

With grid 3 Without grid

Distance of 2 dots

Unrestricted © Siemens AG 20XX


Page 15
HMI – Graphic User Interface
Basic object

Text field

Unrestricted © Siemens AG 20XX


Page 16
HMI – Graphic User Interface
Basic object – Line ( appearance )

Drag & Drop


This is Arrow with This is Arrow with
1
Line end shape is Line end shape is
2 Round Flush

With style Dash you can choose Solid : you can choose
fill style Solid / Transparent Transparent
background color
Unrestricted © Siemens AG 20XX
Page 17
HMI – Graphic User Interface
Basic object – Line ( Layout )

Start point ( 200, 100)

60
150

1 2

Distance of Start & End


Position of Start point point in X direction

Distance of Start & End


If you know the coordinate
point in Y direction
of Start & End point of the
Line, you can input there
Unrestricted © Siemens AG 20XX
Page 18
HMI – Graphic User Interface
Basic object – Ellipse, Circle and Rectangle ( Appearance )

1
Drag & Drop 2
Click on the object

Unrestricted © Siemens AG 20XX


Page 19
HMI – Graphic User Interface
Basic object – Ellipse and Circle ( Layout )

Coordinate of Start Point For the Layout of


(191,72) Circle we only can
input the Radius

Diameter in X direction
1
2

Unrestricted © Siemens AG 20XX Diameter in Y direction


Page 20
HMI – Graphic User Interface
Basic object – Rectangle ( Layout )

Coordinate of Start Point


(227, 92)

The width of the object

Unrestricted © Siemens AG 20XX The height of the object


Page 21
HMI – Graphic User Interface
Basic object – Text field ( General )

2
Drag & Drop
Modify style of text

Input text here


4
5 7

Unrestricted © Siemens AG 20XX


Page 22
HMI – Graphic User Interface
Basic object – Text field ( Appearance - Layout )

1 2 4

6
5 X = 182

Y = 110

Unrestricted © Siemens AG 20XX


Page 23
HMI – Graphic User Interface
Basic object – Text field ( Text format )

2
1

Vertical left Vertical right

Left Top

Centered Middle
Horizontal

Unrestricted © Siemens AG 20XX


Right Down
Page 24
HMI – Graphic User Interface
Basic object – Text field ( Flashing)

2
1

Standard enabled Disabled

Unrestricted © Siemens AG 20XX


Page 25
HMI – Graphic User Interface
Basic object – Graphic view
Choose a graphic from
1 your computer
3

Drag & Drop Then, the graphic you


used appears on the
screen

Right click on the object


5
2

6 7

3D Border
Unrestricted © Siemens AG 20XX
Page 26
HMI Alignment

Choose all objects

1 3

Unrestricted © Siemens AG 20XX


Page 27
HMI Alignment

Unrestricted © Siemens AG 20XX


Page 28
HMI Alignment

3
2 5
Choose all object by
wrapping

3 4 5
1
Choose 1 object as
reference

Unrestricted © Siemens AG 20XX


Page 29
HMI Simulation

Unrestricted © Siemens AG 20XX


Page 30
HMI Elements
I/O Field

Drag & Drop 2

4
Choose the display
I/O must be assigned with a
format depend on type of
Tag ( PLC tag or HMI tag ).
tag you defined
Here we use tags with type INT
/ REAL for example
5
7
6

Type of I/O Field:


• Input can only assign (input ) value for tag
8 • Output can only display the value of tag
Unrestricted © Siemens AG 20XX • Input/Output can do both
Page 31
HMI Elements
I/O Field – Assign with PLC tag

1
2

6
5
3
4

You can also use 7


internal tags in HMI

Unrestricted © Siemens AG 20XX


Page 32
HMI Elements
I/O Field – Set format

2
Unrestricted © Siemens AG 20XX
Page 33
HMI Elements
I/O Field – Appearance

Setting Background and


Border you can take a look
a gain at Basic Objects.
Here

3 4 5

Add unit for your value


Unrestricted © Siemens AG 20XX
Page 34
HMI Elements
I/O Field – Animation
1

2
Tag should be Integer type
4 5
3

Set colors for ranges

7 6
Display -> Visibility

Visible : visible when value in set range


Invisible: invisible when value in set range
Choose the tag (similar
with Appearance)

Unrestricted © Siemens AG 20XX


Page 35
HMI Elements
I/O Field – Animation

1
HMI has these type of
movements

Choose the tag (similar


4 with Appearance) Result

Set the range for the


movement
5
Position can be input specific
coordinate or we can use Drag
6 & Drop objects to define

Unrestricted © Siemens AG 20XX


Page 36
HMI Elements
Button – Events

Drag & Drop


2 1

3
4

6
Choose your command

Unrestricted © Siemens AG 20XX


Page 37
HMI Elements
Button – Word events

Those are the actions of event


Work when press and release

Work when pressed Decrease a specific value of tag

Work when releases Increase a specific value of tag

Work when activated Proceed the equation Y=a*X + b but X


will be output

Work when deactivated


Proceed the equation Y=a*X + b and
Work when button
Y will be output
change state

Set a specific value to the defined


tag

Unrestricted © Siemens AG 20XX


Page 38
HMI Elements
Bar

Drag & Drop 1

2 5
6
3

Input upper/lower limits


4

Unrestricted © Siemens AG 20XX


Page 39
HMI Elements
Button – Example Word event with Bar

Tag “data_3” is
assign to the Bar Result

Unrestricted © Siemens AG 20XX


Page 40
HMI Elements
Button – Bit events

Simulation

1
3
4 2
6

5
Unrestricted © Siemens AG 20XX
7
Page 41
HMI Controls
Alarm
Alarm is a basic function of HMI, it will help the
engineers easier to operate the system with:
➢ Info text which can display the information
(what type of error and how to solve it )
defined by ourselves
➢ Separated colors depending on how
emergency error is

There are 2 type of alarm:


➢ Analog alarm: is set when a value of
parameters is out of set range
➢ Discrete alarm: is set when a boolean tag is
triggered

Unrestricted © Siemens AG 20XX


Page 42
HMI Controls
Alarm – Create an analog alarm

3 Input your alarm text / limit

4
1

6
You can input the information
of error and guide to solve

Unrestricted © Siemens AG 20XX


Page 43
HMI Controls
Alarm – Create an alarm view

Drag and Drop 2

Unrestricted © Siemens AG 20XX


Page 44
HMI Controls
Alarm – Create an alarm view
1

2 Status:
I : Incoming
3 A: Acknowledged
O: Outgoing

Button to open
Info-text Acknowledge button

Unrestricted © Siemens AG 20XX


Page 45
HMI Controls
Alarm – Simulation
Pop-up alarm that we
created by HMI wizard

Alarm text input


when create alarm Status: Incoming error
and already
acknowledged

Alarm view

Button to open Info text

Unrestricted © Siemens AG 20XX


Page 46
HMI Controls
Alarm – Set color for alarm

1 3

Alarm class. In this


Unrestricted © Siemens AG 20XX case we only set
Page 47 color for class Errors
HMI Controls
Alarm – Simulation color of alarm

IO : Alarm come and go without acknowledgement

IAO: Alarm comes and acknowledged and gone


(solved)

IA: Alarm comes and acknowledged but not solved

I: Alarm comes

Unrestricted © Siemens AG 20XX


Page 48
HMI Controls
Alarm – Discrete alarm – How is a Word made in TIA?

According to the picture we have:


➢ %M0.0 is %MW0.8
➢ %M0.7 is %MW0.15
➢ %M1.0 is %MW0.0
➢ %M1.7 is %MW0.7

Unrestricted © Siemens AG 20XX


Page 49
HMI Controls
Alarm – Discrete alarm – create a discrete alarm

Then we use these tag to


trigger the Alarm

Add some tag to PLC for alarm

2 Because we can only use data type


4 “word” for discrete alarm (D.A). So we
have to know exactly address of each bits
in a word.
In this case if we use M0.0 which belong
3 to MW0 to trigger the D.A, we have to
know the position of that bit in MW0. In
5 this case, it will be bit 8 of MW0.

1
6

Unrestricted © Siemens AG 20XX 7


Page 50
HMI Controls
Alarm – Discrete alarm – simulate alarm
Create some button
which event As you can see, when I press
setbit/resetbit to Alarm1-ON button, it will have 2 pop-
simulate the discrete up alarm views that we set in HMI
alarm wizard before and the alarms will
have color for each classes

Unrestricted © Siemens AG 20XX


Page 51
HMI Controls
Trend

2
Drag & drop
Number of time intervals,
you can set it in time axis
(above) 1

3
6

4
Display color limit
5 lines by setting limit
This is trend values for tag
Unrestricted © Siemens AG 20XX base on time intervals
Page 52
HMI Controls
Trend - simulation
Create some buttons
to simulation the
trend

Unrestricted © Siemens AG 20XX


Page 53
HMI Controls
HTML browser

1
2

Drag & drop

3 Input your desired HTML


here. In this case I will
4 access to the S7-1200
controller by its IP address

5
Unrestricted © Siemens AG 20XX
Page 54
HMI Controls
HTML browser – configure controller to be able to access

3
1

If we choose this option, our


link must be in HTTPS,
2 otherwise it can be any types.
However, Siemens recommend
customers should use HTTPS
type

Unrestricted © Siemens AG 20XX


Page 55
HMI Functions: Administration

Go to tab “User groups”

Double-click <Add
new> to create
1

You can choose 1 or more


authorizations for a group

Unrestricted © Siemens AG 20XX


Page 56
HMI Functions: Administration

Go back to tab “Users”

3
2

4
1

Unrestricted © Siemens AG 20XX


Page 57
HMI Functions: Administration

4
It means only users in groups which
have “Group 1 authorization” can use
1 this button

3
2

Unrestricted © Siemens AG 20XX


Page 58
HMI Functions: Administration
Buttons for Login/Logoff and show Username

3
2
4
1 9

8
5

6
7

Create a I/O Field to


show username

Unrestricted © Siemens AG 20XX


Page 59
HMI Functions: Recipe

2
Double-click <Add new> to
1 add your recipe ( Ex: Juice )

Add main elements of your recipe


3 (Ex: Water – Sugar – Ice)

Add recipe of some drinks which have different


portion of element
Unrestricted © Siemens AG 20XX (Ex: Orangejuice has 50ml Water 20mg Sugar 20 Ice
Page 60 Applejuice has 10ml Water 20mg Sugar 30 Ice )
HMI Functions: Recipe

1 Drag & drop

5
2
6
3
4
7

Unrestricted © Siemens AG 20XX


Page 61
DATALOG WITH HMI
Unrestricted © Siemens AG 2019 Support.industry.siemens.com

Unrestricted
Create Data logs

Configuration of Number of records


2
Data logs in 1 data log

Path of folder we want to store data logs in. Action when data
Default path: C:\USB_X60.1 logs is restarted

3
1

Create tags to be
logged • Cyclic: log at regular intervals. We can
choose the logging cycle ( smallest is 1s
and largest is 1h )
• On change: log as soon as the HMI device
Choose tag detects a change in the value of the tag
• On demand : log by calling the "LogTag"
system function.

Unrestricted © Siemens AG 20XX


Page 63
Data log with logging method : Circular log

➢ When the configured log size has been reached, the oldest entries are deleted.
➢ When the configured log size (data records) has been reached, approximately
20% of the oldest entries are deleted.

Data is logged every


2 sec

After we change HMI to runtime mode, there is 1 folder with


name in configuration contain our Data log file (.txt)

Then we stop runtime and start


again, new data is also logged
every 2 sec and overwritten with
old data

Unrestricted © Siemens AG 20XX


Page 64
Data log with logging method : Segmented circular log

➢ In a segmented circular log, multiple log segments of the


same size are filled in succession. When all logs are
completely full, the oldest log is overwritten.

We create a data log with 10 records for each log,


and maximum 6 log. If we have more than 6, the
oldest log will be overwritten

After we reached 6
data logs if we keep
logging data, new
data will be logged
and stored in new
data log which is
overwritten oldest
data logs

There are 6 data logs


created in the folder

Unrestricted © Siemens AG 20XX


Page 65
Data log with logging method : Trigger event

When a log is full the system will automatically


execute a function

1 2

3
4

6 You can choose your desired event when


the log is full. In this case we will choose
5 Setbit for a tag to inform us

Unrestricted © Siemens AG 20XX


Page 66
Data log with logging method : Circular log

➢ When a defined level is reached, such as 90 %, a system alarm is triggered.


When the log is 100% full, new tag values are not logged.

We created a data log with 10 records, the fill


level (%) is 69. That means when 7th record is
logged, a system alarm is triggered

7th record is at
11:12:46”

A system alarm is triggered at


the same time

Unrestricted © Siemens AG 20XX


Page 67
How a logging tag with Acquisition mode : On demand works

➢ With acquisition mode is “On demand”, The tag values


are logged by calling the "LogTag" system function.

Then, we need to
1 create a LogTag

3 Choose value tag we


want to log
4
7

6
5
Unrestricted © Siemens AG 20XX
Page 68
How a logging tag with Acquisition mode : On demand works

Last step, we had tag “demand_log”


with event “Value change” for logging
tag “data_cir3”. Now we are creating a
button with event to change value of
“demand_log” tag
1
2
3
4

The moment we click on


button “ Log tag” the data
“data_cir3” is logged to data
log

Unrestricted © Siemens AG 20XX


Page 69
Datalogging to USB via HMI

Create Data logs and Logging


tags in HMI by TIA Portal

1
Plug-in USB to HMI (USB
must be plugged in to HMI
before download program,
2 otherwise we need to re-
download program to HMI)

Download program to HMI,


then data will be automatically
3 logged to USB

Unrestricted © Siemens AG 20XX


Page 70
Datalogging to USB via HMI
Plug in/out USB while HMI is logging data
While HMI is logging data, if we want to plug out USB to take the data logs for report,
we need to create a button with events (must in that order):
1. Stop logging
2. Close all the data logs

Choose log type


(alarm/data log ) and RIGHT
data log we want to stop

Then plug in USB again to HMI and create a button with events (must in that order):
1. Open all the data log
2. Start logging

Unrestricted © Siemens AG 20XX


Page 71
Excel – Pivot table

➢ Drag&drop to Excel
➢ Open with Excel 5

2
Drag to choose data for Pivot table.
Here, we want to sort data base on: 6
3 name, time, value
4

Then we have a table


with data sorted by
name and time

Unrestricted © Siemens AG 20XX


Page 72
SIMATIC IOT2040
The intelligent Gateway
for Industrial IoT solutions

Unrestricted © Siemens 2018 siemens.com/iot2000


Content

• Introduction
• Setup boot image file to IOT2000
• Change IP address of IOT2000
• Set date & time
• Node-red and its application

Restricted © Siemens AG 20XX


Page 2
Introduction

Restricted © Siemens AG 20XX


Page 3
Introduction
IOT2020

Restricted © Siemens AG 20XX


Page 4 Author / Department
Introduction
IOT2040

Restricted © Siemens AG 20XX


Page 5 Author / Department
Introduction
IOT2000

Restricted © Siemens AG 20XX


Page 6
Introduction
Digital Input and Output

• Each of the 14 digital pins can be used as an input or output, using pinMode(), digitalWrite(),
and digitalRead() functions.
• They operate at 5 volts at nominal 20mA consumption.
• A maximum of 40mA is the value that must not be exceeded on any I/O pin to avoid permanent damage to the
microcontroller.

• In addition, some pins have specialized functions:


• Serial : 0 (RX) and 1 (TX). Used to receive (RX) and transmit (TX) TTL serial data.
• External Interrupts : 2 and 3. These pins can be configured to trigger an interrupt on a low value, a rising or
falling edge, or a change in value. See the attachInterrupt() function for details.
• PWM : 3, 5, 6, 9, 10, and 11. Provide 8-bit PWM output with the analogWrite() function.
• SPI : 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK). These pins support SPI communication using
the SPI library.
• LED : 13. There is a built-in LED driven by digital pin 13.
• TWI : A4 or SDA pin and A5 or SCL pin. Support TWI communication using the Wire library.

Restricted © Siemens AG 20XX


Page 7
Introduction
Analog Input

• Board has 6 analog inputs, labeled A0 through A5, each of which provide 10 bits of resolution
(i.e. 1024 different values).

• By default they measure from ground to 5 volts, though is it possible to change the upper end of
their range using the AREF pin and the analogReference() function. There are a couple of other
pins on the board:
• AREF : Reference voltage for the analog inputs. Used with analogReference().
• Reset : Bring this line LOW to reset the microcontroller. Typically used to add a reset button to shields
which block the one on the board.

Restricted © Siemens AG 20XX


Page 8
Introduction
IOT2000 Shield

Interfaces Description
ARDUINO GPIO (I2C and SPI free)
Digital Input 5 x DI (24V)
Speed of DI 20 Hz, delay < 1.5 ms
Electrical isolation Yes
Digital outputs 2x DO
Type Transistor
Electrical isolation Yes
Short-circuit protection Yes, 1A
Speed 10 Hz
Analog inputs 2x AI (0 … 10 V or 0 … 20 mA can be selected)
Restricted © Siemens AG 20XX
Resolution 9-bit
Page 9 Electrical isolation –
Introduction

Equipment you should have :

• Hardware
• IOT2000 : either IOT2020 or IOT2040
• Micro-SD card : to keep OS inside from 8GB - 32GB
• PC : as engineering station, with SD card slot and Ethernet port
• Power supply : 9-36V DC

• Software
• Win32 Disk Imager : to put OS image to Micro-SD card (download)
• PuTTY : to setup IOT2000 (download)
• Image file : OS image for IOT2000 (download)
• WinSCP : to transfer file between IOT2000 and PC (download)

• Content after this will assume that you already install all mentioned software and hardware.

Restricted © Siemens AG 20XX


Page 10
Setup boot image file to IOT2000

Restricted © Siemens AG 20XX


Page 11
Setup boot image file to IOT2000

1. Install Win32 Disk Imager

2. Open ima ge file

Download
image file

Restricted © Siemens AG 20XX


Page 12
Setup boot image file to IOT2000

3. Choose image file

Restricted © Siemens AG 20XX


Page 13
Setup boot image file to IOT2000

• After Win32 Disk Imager is successful, remove SD card from PC and insert in SD card slot of
IOT2000.

Restricted © Siemens AG 20XX


Page 14
Setup boot image file to IOT2000

• Power on IOT2000, ready state after power up 30 seconds LED should shown as in photo.

Restricted © Siemens AG 20XX


Page 15
Change IP address of IOT2000

Restricted © Siemens AG 20XX


Page 16
Change IP address of IOT2000

• IOT2000 has static IP address by default.


• The address is “192.168.200.1”

• To configure IOT2000, please set IP address of PC to the same subnet as the IOT2000.

192.168.200.xxx

192.168.200.1

Ethernet cable

Restricted © Siemens AG 20X X


Page 32
Change IP address of IOT2000

• Plug Ethernet cable to X1 P1 port of IOT2000

Restricted © Siemens AG 20XX


Page 33
Change IP address of IOT2000

• Open PuTTY and connect to IP address of IOT2000

Restricted © Siemens AG 20XX


Page 19
Change IP address of IOT2000

• Login as “root”

Restricted © Siemens AG 20XX


Page 20
Change IP address of IOT2000

• Change IP: Use “iot2000setup”

Restricted © Siemens AG 20XX


Page 40
Change IP address of IOT2000

• Change IP: Use “iot2000setup”

Restricted © Siemens AG 20XX


Page 41
Change IP address of IOT2000

• Change IP: Use “iot2000setup”

Restricted © Siemens AG 20XX


Page 42
Change IP address of IOT2000

• Change IP: Use “iot2000setup”

Reset IOT2000 to make sure it activates new settings

Restricted © Siemens AG 20XX


Page 43
Change IP address of IOT2000

• Now we can change IP of PC to the same subnet as IOT2000 again and test connection with ping
command.

• We should ping to new IP address successfully.

192.168.0.xxx

192.168.0.10

Ethernet cable

Restricted © Siemens AG 20XX


Page 44
Set date and time

Restricted © Siemens AG 20XX


Page 45
Set date and time

• Some feature such as email sending in node-red needs to set correct system time. Otherwise, it
might show “Certification is not yet valid” when you’d like to send email for example.

• Command format is “date MMDDhhmmYYYY”


• Then set time to hardware by “hwclock --systohc --utc”

Restricted © Siemens AG 20XX


Page 46
Set date and time

• Check time by using “date” command.


• Please note that date and time is set in UTC

Restricted © Siemens AG 20XX


Page 47
Enable Node-red

Restricted © Siemens AG 20XX


Page 48
What is Node-red?

• A visual tool for wiring the Internet of Things

Restricted © Siemens AG 20XX


Page 49
Enable Node-red

• Login by PuTTY, and type “iot2000setup”

Restricted © Siemens AG 20XX


Page 50
Enable Node-red

Choose “Software” Choose “Manage Autostart Options”

Restricted © Siemens AG 20XX


Page 51
Enable Node-red

• Activate “Auto Start node-red”, then Done and quit from this setup.

Restricted © Siemens AG 20XX


Page 52
Enable Node-red

• Exit from PuTTY and reboot IOT2000 to activate autostart of node-red

Restricted © Siemens AG 20XX


Page 53
Enable Node-red

• Open web browser, type in a format of “IP address:1880”

Restricted © Siemens AG 20XX


Page 54
Introduction to Node-red

Restricted © Siemens AG 20XX


Page 55
Introduction to Node-red
Dashboard

Dashboard is a part to display website

Restricted © Siemens AG 20XX


Page 56 XX.XX.20XX Author / Department
Introduction to Node-red
Dashboard

Dark Light

Page
Theme

Group

Node
Restricted © Siemens AG 20XX
Page 57 XX.XX.20XX Author / Department
Introduction to Node-red
Creating Tab

Restricted © Siemens AG 20XX


Page 58
Introduction to Node-red
Creating Group

Restricted © Siemens AG 20XX


Page 59
Introduction to Node-red
Dashboard

Restricted © Siemens AG 20XX


Page 60
Introduction to Node-red
Dashboard

Dark theme

Restricted © Siemens AG 20XX


Page 61
Introduction to Node-red
Dashboard

Light theme

Restricted © Siemens AG 20XX


Page 62
Dashboard
Button

• Button : To force data/value when click the button

Location of button in
dashboard

Restricted © Siemens AG 20XX


Page 63 XX.XX.20XX Author / Department
Dashboard
Button

• Note:
• Payload can be changed to proper data type to be used.

Restricted © Siemens AG 20XX


Page 64
Dashboard
Button

• Adjust parameter of button

Result when click this button

Restricted © Siemens AG 20XX


Page 65
Dashboard
Button

• Create 1 more button to turn OFF

Restricted © Siemens AG 20XX


Page 66
Dashboard
Button

• Result after Deploy

Restricted © Siemens AG 20XX


Page 67
Dashboard
Text

• Text : To show status in text format

Restricted © Siemens AG 20XX


Page 68
Dashboard
Text

Restricted © Siemens AG 20XX


Page 69 XX.XX.20XX Author / Department
Dashboard
Slider and Gauge

Show 2 decimal point

Restricted © Siemens AG 20XX


Page 70 Author / Department
Dashboard
Slider and Gauge

Restricted © Siemens AG 20XX


Dashboard
Chart

Restricted © Siemens AG 20XX


Dashboard
Chart

Restricted © Siemens AG 20XX


Dashboard
Notification

Restricted © Siemens AG 20XX


Dashboard
Notification

Restricted © Siemens AG 20XX


Connect IOT2000 to internet

Restricted © Siemens AG 20XX


Connect IOT2000 to internet

• For IOT2020, it has only 1 Ethernet port so it has no doubt to connect everything to X1 port.

• But IOT2040 has 2 Ethernet ports, so there are several methods to connect IOT2040 to internet.

Restricted © Siemens AG 20XX


Connect IOT2000 to internet

• Use port X1 as static IP to machine and port X2 to connect internet

192.168.0.200

192.168.1.1
X1: 192.168.0.10 X2: 192.168.1.xx
Default setting DHCP
Internet

Restricted © Siemens AG 20XX


Connect IOT2000 to internet

• Use port X1 as static IP to machine and port X2 to connect internet


• Port X1 : connect to local machines and PC
• Port X2 : connect to router and internet on different subnet as X1.

OR

Restricted © Siemens AG 20XX


Example of internet connection

Restricted © Siemens AG 20XX


Connect IOT2000 to internet
Example 1 : both ports in same subnet

UNABLE TO CONNECT INTERNET

192.168.0.100

192.168.0.1
X1: 192.168.0.10 X2: 192.168.0.xx
Just set static IP + gateway DHCP
Internet

Restricted © Siemens AG 20XX


Connect IOT2000 to internet
Example 2

ABLE TO CONNECT INTERNET

192.168.0.100

192.168.0.1
X1: 192.168.0.xx
DHCP or Static IP
Internet

Restricted © Siemens AG 20XX


Connect IOT2000 to internet
Example 3

ABLE TO CONNECT INTERNET

192.168.0.xx

192.168.1.1
X1: 192.168.0.10 X2: 192.168.1.xx
Static IP DHCP
Internet

Restricted © Siemens AG 20XX


Connect IOT2000 to internet

• IOT2000 communicates to PLC: OK


• Send email from IOT2000 : OK
• PC station can edit and monitor PLC.

192.168.0.xx

192.168.1.1
X1: 192.168.0.1 X2: 192.168.1.xx
DHCP
Internet

192.168.0.99

Restricted © Siemens AG 20XX


Connect IOT2000 to internet

• IOT2000 communicates to PLC: OK


• Send email from IOT2000 : OK
• But PC station cannot monitor and edit PLC

192.168.0.xx

192.168.1.1
X1: 192.168.0.1 X2: 192.168.1.xx
DHCP
Internet

192.168.1.99

Restricted © Siemens AG 20XX


Node-red to S7 connection

Restricted © Siemens AG 20XX


Node-red to S7 connection

192.168.0.101

192.168.1.1
X1: 192.168.0.10 X2: 192.168.1.xx
DHCP
Internet

192.168.0.99

Restricted © Siemens AG 20XX


Node-red to S7 connection
Add library to Node-RED

• To install library in Node-red, INTERNET connection required !!!

• Recommend to set Ethernet port to DHCP before install S7 library.

Restricted © Siemens AG 20XX


Node-red to S7 connection
Add library to Node-RED

• Install node-red-contrib-s7 per commands shown:

If no internet, it will
fail at this step.

Restricted © Siemens AG 20XX


Node-red to S7 connection

• Now we can see S7 part in node-red

Restricted © Siemens AG 20XX


Node-red to S7 connection

• Prepare data in PLC -> “Permit access with PUT/GET communication for remote partner”

Restricted © Siemens AG 20XX


Node-red to S7 connection

• Prepare data in PLC -> Data block must be “Non-Optimized block access”

Restricted © Siemens AG 20XX


Node-red to S7 connection

Restricted © Siemens AG 20XX


Node-red to S7 connection

Port 102

Note: In case of S7-300, use Rack0 and Slot 2


Restricted © Siemens AG 20XX
Node-red to S7 connection

• To link data between Data block and Node-red variable

Restricted © Siemens AG 20XX


Node-red to S7 connection

• To link data between %M and node-red variable

Use Mx.x, MWx, MDx without %


But MD will only show as double integer only (even
data type is real).

Restricted © Siemens AG 20XX


Node-red to S7 connection

• UDT data type is also possible.

Restricted © Siemens AG 20XX


Node-red to S7 connection

192.168.0.102:1880/ui/#/1

Restricted © Siemens AG 20XX


Node-red to S7 connection

• Example address identified in IOT2040 for S7 connection

Boolean : M0.0 or DB2,X3.0


Integer : MI18 or DB3,INT2
Real : MR18 or DB3,REAL4
String : DB3,S8.10
S -> String
8 -> Offset of start string
10 -> Length of string
Array : DB10,INT6.2 - DB10.DBW6 and DB10.DBW8 in an array with length 2)
DB10,S20.30.3 - Array of 3 strings at offset 20, each with length of 30
DB10,C22.30 - Character array at offset 22 with length of 30

Restricted © Siemens AG 20XX


Send email

Restricted © Siemens AG 20XX


Send email

Restricted © Siemens AG 20XX


Send email

Restricted © Siemens AG 20XX


Node-red MQTT

Restricted © Siemens AG 20XX


MQTT Concept

• No matter the devices are, all can talk each other with same interested topics.

Topic: mysensor

Restricted © Siemens AG 20XX


Node-red MQTT
MQTT publish

Identify “Topic” of MQTT to publish

Restricted © Siemens AG 20XX


Node-red MQTT
MQTT publish

Restricted © Siemens AG 20XX


Node-red MQTT
MQTT subscribe

Identify “Topic” of MQTT to subscribe

Restricted © Siemens AG 20XX


Node-red MQTT
MQTT subscribe

Restricted © Siemens AG 20XX


Check IP address of Ethernet port by Node-red

Restricted © Siemens AG 20XX


Check IP address of Ethernet port by Node-red

In case we forget or we don’t know the IP address of the SIMATIC IOT2040, we can use this way to get IP
address of SIMATIC IOT2040 whenever it is started

Restricted © Siemens AG 20XX


Check IP address of Ethernet port by Node-red
1. Simple method

IOT2040 has 2 port eth0, eth1. In


this “eth0”
case we access to IOT2040
or “eth1”
via port eth0, soitwe
For IOT2020, hasonly
onlyneed to
1 Ethernet
know port,
thesoIPit’saddress
“eth0” only.
of eth0

ifconfig command appended


with eth1

Restricted © Siemens AG 20XX


Check IP address of Ethernet port by Node-red
1. Simple method - result

Result in debug Result in email

Restricted © Siemens AG 20XX


Export/Import Node-red

Restricted © Siemens AG 20XX


Import/Export Node-red

• Source data of Node-red is kept in text file.

• To export / import node-red program, just use copy and paste by any text-based program to
import / export.

Restricted © Siemens AG 20XX


Export Node-red

1. Click on any node, otherwise Export function will be disable.

Restricted © Siemens AG 20XX


Export Node-red

2. Click on any node, Export -> Clipboard

Restricted © Siemens AG 20XX


Export Node-red

3. Select “all flows” and “formatted”, then Export to clipboard. Copy to any text file such as
Notepad. This is the source file of Node-red program.

Restricted © Siemens AG 20XX


Import Node-red

1. Copy your Node-red source code, select all and copy it.

Restricted © Siemens AG 20XX


Import Node-red

2. In Node-red, select Import -> Clipboard

Restricted © Siemens AG 20XX


Import Node-red

3. Paste the copied source code in Import nodes as new flow. Now all nodes and flows are imported.

Restricted © Siemens AG 20XX


Import Node-red

4. Delete unused flow by double click flow tab, and delete.

Restricted © Siemens AG 20XX


More on node-red

Restricted © Siemens AG 20XX


More library

• https://flows.nodered.org/

Restricted © Siemens AG 20XX


Dashboard location

Restricted © Siemens AG 20XX


Dashboard location

• Dashboard is in “/usr/lib/node_modules/node-red-dashboard/dist”

Restricted © Sieme ns AG 20XX


Page 233
Change password for root

Restricted © Siemens AG 20XX


Change password for root

• Use command “passwd” to set password.

Restricted © Siemens AG 20XX


Change password for root

• Next login will ask for password.

Restricted © Siemens AG 20XX


Thank you for your attention

Le Nguyen Hoang Nam


Sale specialist
Mobile: 0917017744
Email: [email protected]

Errors excepted and subject to change without prior notice. The information provided in this document contains merely general descriptions
or characteristics of performance which in case of actual use do not always apply as described or which may change as a result of further development of the
products. An obligation to provide the respective characteristics shall only exist if expressly agreed in the terms of contract.
All product names can include registered trademarks or other rights of the Siemens group
or third parties, the unauthorized use of which may infringe the rights of the owner.

siemens.com/iot2000

You might also like