100% found this document useful (1 vote)
157 views67 pages

Node-Red - Basic

1. The document provides instructions on setting up a SIMATIC IOT2000 as an industrial IoT gateway, including required hardware, software, and configuring the initial setup. 2. Setting up the IOT2000 requires writing a provided example image file to a microSD card using Win32 Disk Imager, inserting the microSD card into the IOT2000, and connecting it to an engineering PC. 3. The engineering PC must be configured with a static IP address on the same subnet as the IOT2000's preconfigured address of 192.168.200.1 in order to establish an SSH connection for initial configuration of the IOT2000.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
157 views67 pages

Node-Red - Basic

1. The document provides instructions on setting up a SIMATIC IOT2000 as an industrial IoT gateway, including required hardware, software, and configuring the initial setup. 2. Setting up the IOT2000 requires writing a provided example image file to a microSD card using Win32 Disk Imager, inserting the microSD card into the IOT2000, and connecting it to an engineering PC. 3. The engineering PC must be configured with a static IP address on the same subnet as the IOT2000's preconfigured address of 192.168.200.1 in order to establish an SSH connection for initial configuration of the IOT2000.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 67

MODULE 031-Part A

SIMATIC IOT2000 as
Industrial IoT Gateway
Prerequisite & Required Hardware and Software
Prerequisite

You should hands-on with all previous modules in order to integrate


SIMATIC IOT2000 with SIMATIC S7-1200.

Required Hardware and software


1. Engineering Station: Requirements are hardware and operating
system
2. Software for writing the example image on the SD card, e.g.
Win32 Disk Imager
3. Software for SSH access, e.g. PuTTY
4. Software for SFTP/SCP file transfer, e.g. WinSCP
5. SIMATIC IOT2000 controller, e.g. IOT2040 with MicroSD Card
6. Ethernet connection between the engineering station and
controller
7. Node-red Software Controller executable on IOT2020 and
IOT2040
8. SIMATIC S7-1200 controller, e.g. CPU 1215C AC/DC/RELAY –
firmware V4.2 or higher

Unrestricted© Siemens AG 2016 03/2016


Introduction to SIMATIC IOT2000

• Micro PC system based on Intel X1000 SoC (System on Chip)


• It used Linux operating system which can be oriented to individual requirements with the help of the Yocto
Project.
• It provides an Arduino UNO-compatible header for optimal adaption to its application.
• The GPIOs (General Purpose Input/Outputs), which are accessible from the outside with the help of the
header, can be programmed and used in many ways, e.g. Java or C++, but also using the TIA Portal.

Unrestricted© Siemens AG 2016 03/2016


Product Range / Models

SIMATIC IOT2020 SIMATIC IOT2040


• Intel Quark X1000 processor • Intel Quark X1020 processor
• 512 MB RAM • 1 GB RAM
• 1 x Ethernet interface • 2 x Ethernet interfaces
• 2 x RS232/422/485 interface
• Battery-buffered real-time clock

Unrestricted© Siemens AG 2016 03/2016


Product Range – IOT2050

6ES7647-0BA00-0YA2 6ES7647-0BA00-1YA2

• TI SOC AM6528 GP Dual • TI SOC AM6548 HS


Core Quad Core
• with High Security
possibility
• 1 GB RAM (DDR4) • 2GB RAM (DDR4)
• No eMMC • 16 G eMMC

• No Battery-buffered real- • Has battery-buffered


time clock real-time clock

Unrestricted© Siemens AG 2016 03/2016


Product Range / Model

• An Arduino UNO-compatible header is available in each version and can be used to put any Arduino
shields into operation. The option also exists to develop and use your own shields.
• The programming is different, depending on the shield. The TIA Portal is only able to use the individual
GPIOs (General Purpose Input/Outputs) as pure digital and analog inputs and outputs. Higher functions,
such as I²C (Inter-Integrated Circuit) or SPI (Serial Peripheral Interface), are not usable.
• A MicroSD card is needed for the operating system. The "Operating system from Siemens" needs a
minimum of 2 GB.

Unrestricted© Siemens AG 2016 03/2016


SIMATIC IOT2040
Top side of the IOT 2040

Top View

1) Openings for push-in lugs for wall


mounting
2) Markings for installation of
antennas
3) Connection for the power supply
(24 V)
4) COM interfaces (RS232/422/485)

Unrestricted© Siemens AG 2016 03/2016


Front side of the IOT2040

Front view

5) LED display
6) Left cover
7) Right cover
8) Securing device
9) RESET button for the CPU
10) USER button, programmable (not
via the TIA Portal)

Unrestricted© Siemens AG 2016 03/2016


Bottom side of the IOT2040

Bottom View

11) Ethernet interface 10/100 Mbps


12) Ethernet interface 10/100 Mbps,
prepared for PoE (Power over
Ethernet)
13) USB type Micro-B
14) USB type A

Unrestricted© Siemens AG 2016 03/2016


Micro SD card

The micro SD card keeps the operating system


Isomeric View
at the ready and provides space for programs
and data. Any micro SD card can be used here.
Without a card with a compatible system, the
IOT2000 is not executable.
1) Open the right cover.
2) Carefully press down the micro SD bracket
and fold it forward.
3) Slide the micro SD card with correct
orientation into the bracket frame. The
contacts of the micro SD card must
point in the direction of the motherboard.
4) Fold back the bracket frame and
carefully push the frame upward until it
engages.

Unrestricted© Siemens AG 2016 03/2016


LED display

The LEDs on the front side of the


device indicate the operating state:
• The PWR (green) LED indicates
whether the system is supplied with
voltage.
• The SD (green) LED indicates
accesses to the SD card. LED
• The USB (green) LED indicates displays
whether 5 V is available for the
USB port
• The OC (red) LED lights up if the
supply voltage is too high
• The USER (green/red/orange) LED
can be programmed via the
operating system (not via the TIA
Portal)
Unrestricted© Siemens AG 2016 03/2016
SIMATIC IOT 2000 Initial
Setup
Creating the SD card

The example image must be unpacked and written to


the SD card with the help of the Win32 Disk Imager.
Connect the SD card to the computer or insert it into
the SD card reader.
Unpack the example image
"109741799_Example_Image_V2.2.0.zip" via the
shortcut menu and "Extract All…" ( Extract All…) Select a destination path and click "Extract"
( Extract)

Unrestricted© Siemens AG 2016 03/2016


Creating the SD card

For the Image File, select the example image


Start Win32 Disk Imager "example-v2.2.0.wic" you just unpacked. Be sure to
select the file type "*.*"

Unrestricted© Siemens AG 2016 03/2016


Creating the SD card

Select the device, making sure that it is the


micro SD card. Then click on "Write". Read the warning and confirm it with "Yes":

Close the Win32 Disk Imager after the successful


write operation.
Disconnect the SD card from the computer and
insert it into the – disconnected from the voltage
source – IOT2000.
Reconnect the IOT2000 to the voltage supply.

Unrestricted© Siemens AG 2016 03/2016


Setting the IP address of the engineering station

• Now that the SD card has been written with the 1. Locate the network icon in the task bar at
operating system and inserted in the IOT2000, the bottom and click on  "Network & Internet
the operating system can be configured. This is settings".
done using an SSH connection. The example
image has a preconfigured IP address:
192.168.200.1/24*.

• For the PC and SIMATIC IOT2000 to


communicate with one another via IP, it is
important that the IP addresses of both devices
match.

• First, it is shown here how the IP address of a PC


can be set with the Windows 10 operating
system.

Unrestricted© Siemens AG 2016 03/2016


Setting the IP address of the engineering station

2. In the Network settings window


that opens, click on  "Change
adapter options".

Unrestricted© Siemens AG 2016 03/2016


Setting the IP address of the engineering station

3. Select the desired  "LAN connection" you want 4. Select  "Properties" under 
to use to connect to the controller and right-click  "Internet Protocol Version 4
"Properties". (TCP/IP)".

Unrestricted© Siemens AG 2016 03/2016


Setting the IP address of the engineering station

5. You can now use the following IP


address, for example,  IP address:
192.168.200.99  Subnet mask
255.255.255.0 and accept the settings
( "OK")

Unrestricted© Siemens AG 2016 03/2016


Establishing an SSH connection

1. Start Putty
2. Under Host Name (or IP address), enter the IP
and the Port of the IOT2000 ( Host Name:
192.168.200.1  Port: 22)
3. Select the SSH item under Connection type (
Connection type: SSH)
4. Click on Open ( Open)

Unrestricted© Siemens AG 2016 03/2016


Establishing an SSH connection

5. Confirm the fingerprint of the IOT2000 with


Yes (  Yes)

Unrestricted© Siemens AG 2016 03/2016


Establishing an SSH Connection

6. Command window like in the figure will be


appear.

7. Enter the user name root for the login and


confirm the entry with ENTER (  Login as: root,
 Enter )

Unrestricted© Siemens AG 2016 03/2016


Establishing the SCP/SFTP connection for the file transfer

To transfer files from the local programming device


to the IOT2000, the SSH connection is also used.
Here, there are programs that can transmit and
receive with SCP and SFTP files via the SSH
connection. WinSCP is used in the next steps.

1. Start WinSCP

Unrestricted© Siemens AG 2016 03/2016


Establishing the SCP/SFTP connection for the file transfer

2. Enter the IP and the Port of the IOT2000 ( 


Host Name: 192.168.200.1  Port: 22).
3. Enter the username root under User name ( 
User name: root).
3. Leave the Password field empty.
4. Click Login (  Login)

Unrestricted© Siemens AG 2016 03/2016


Establishing the SCP/SFTP connection for the file transfer

5. Confirm the fingerprint of the IOT2000


(  Yes)

6. You should now have two file browsers side-by-side.


On the left side is the local programming device and on
the right side is the IOT2000 with its directories.
Unrestricted© Siemens AG 2016 03/2016
Setting the IP address using iot2000setup

1. Login into the system through Putty.


2. Enter the command iot2000setup in the shell and
confirm the command with the Enter key ( 
iot2000setup ↵)

3. Then, blue screen window like this will be


appeared.
4. Use the arrow, tab and Enter keys to navigate to
menu item  Networking  Configure Interfaces.

Unrestricted© Siemens AG 2016 03/2016


Setting the IP address using iot2000setup

4. To change the address of SIMATIC, enter any


address in eth0 interface.
(e.g.  eth0: 192.168.0.1).
5. Confirm the changes using the OK field (  OK)

Note: The IP address is immediately changed, and a


new connection can only be established again when
the programming device is also in the corresponding
subnet!

Unrestricted© Siemens AG 2016 03/2016


Setting the IP address using iot2000setup

6. Adapt the address of the engineering station to


the new subnet and establish an SSH connection
to the IOT again.
7. Configure WLAN
• Networking  Configure Interface  wlan0
as dhcp  OK
• Networking  Connect Wifi  Enter the
SSID and Key  OK
• SSID = Connection‘s name
• Key = Password connection

Unrestricted© Siemens AG 2016 03/2016


Setting the IP Address ( with nano command)

For more experienced users, you can setting the IP


1
address by directly edit the file in the shell, e.g. with
nano command.

1. (still in window command – putty) Start nano and 2


transfer the file path /etc/network/interfaces as the
parameter ( nano /etc/network/interfaces ↵) as in
figure 1.
2. Edit the script as in figure 2.
3. You can exit the program again with key
combination Ctrl+X. (  Ctrl+X)
4. Any changes can be accepted with Y or discarded
with N.

Unrestricted© Siemens AG 2016 03/2016


Setting the IP address ( with WinSCP )

 Establish an SCP connection to the IOT2000


using WinSCP.

 Change to the /etc/network folder on the right


side.

 Right-click on the interfaces file and select the


Edit menu item.

Unrestricted© Siemens AG 2016 03/2016


Setting the IP address ( with WinSCP )

 Adapt the desired values in the editor and click


on Save at the top left (Ctrl+S).

 The file is now automatically saved on the


IOT2000 (see main window)

Main WinSCP window

Unrestricted© Siemens AG 2016 03/2016


Node-RED setup

 Open putty  use ip 198.168.200.1


1
1. login as : root 2

2. in root@iot2000:~# line enter node


/usr/lib/node_modules/node-red/red & to start

Unrestricted© Siemens AG 2016 03/2016


Node-RED Setup

Enable Auto Start Node-red


 Access system using putty
 Enter the command: iot2000setup 
Software  Manage Autostart Options 
Select (with spacebar) Auto Start Node-red
 Done

Unrestricted© Siemens AG 2016 03/2016


Node-RED (Software Part)
Introduction to Node-Red

1. Node-RED is a programming tool for wiring together hardware devices, APIs and online services in
new and interesting ways.
2. It provides a browser-based editor that makes it easy to wire together flows using the wide range of
nodes in the palette that can be deployed to its runtime in a single-click.
3. It is originally developed by IBM’s Emerging Technology Services team and now a part of the JS
Foundation.
4. Node-RED is an open-source program.

Unrestricted© Siemens AG 2016 03/2016


Accessing the Node-RED

To access the Node-RED of IOT2000, following


steps are required

1). Open any Internet Browser (e.g.


Chrome/Mozila/Safari/Intenet Explore)

2). Accessing Node-RED in Browser by entering


ethernet or Wi-Fi IP address of IOT2000 (Default
ethernet IP address of IOT2000 is
http://192.168.200.1:1880 )

Unrestricted© Siemens AG 2016 03/2016


Basic Features in Node-RED
Workspace Header
• Place where flow is • Contain deploy button
created and main menu.

Sidebar
• Contain
information of
the node,
Palette Debug,
• Contain the configuration
node,
node
Context data.
available to
be used.
Unrestricted© Siemens AG 2016 Editor Window 03/2016
Basic Features in Node-Red
3

Node-RED Description 4
features
1. Flow a) Tab name of the workspace (changeable)
b) Informally describe a single set of connected nodes
2. Node Input, output and functional point that used to create
flows.
3. Wires A line used to connect two or multiple point.
4. Subflow A collection of nodes that are collapsed into a single node
in the workspace.
Unrestricted© Siemens AG 2016 03/2016
Basic Node (Inject & Debug Node)

• The Inject node can initiate a flow with a specific


Input Node
payload value. The default payload is a timestamp.
Inject node also support strings, numbers,
booleans, JavaScript objects, JSON object or
flow/global context values.

• Debug node displays selected message properties


Output Node
in the debug tab. By default it displays msg.payload,
but can be configured to display any property, such
as complete message or the result of a JSON data
expression.

Unrestricted© Siemens AG 2016 03/2016


Basic Node (Inject Node)

1) Drag and drop inject node

2) Double click on inject node

3) Select timestamp (under Payload)

Unrestricted© Siemens AG 2016 03/2016


Basic Node (Debug Node)

1. Drag and drop debug node

2. Double click on debug node

3. Just Click Done, no changes required.

Unrestricted© Siemens AG 2016 03/2016


Inject node & Debug node

1. Wire the inject and debug node as shown in


figure

2. Deploy the flow

3. Inject the data

4. You will get the timestamp data in debug


window.

Debug window

Unrestricted© Siemens AG 2016 03/2016


Basic node (Delay node)

Delay node used to delay each message


passing through the node or limits the rate at
which they can pass.

1) Add the delay node in your existing node-


red flow and wire as figure below

Unrestricted© Siemens AG 2016 03/2016


Delay node

1) Double click on the delay node

2) Set the time as 5 seconds and click on


Done.

Unrestricted© Siemens AG 2016 03/2016


Delay node

1) Deploy the flow

2) Click the inject node and see the result in


debug window.

Msg.payload will be appeared on debug window


after 5s delay

Unrestricted© Siemens AG 2016 03/2016


Basic node (Trigger node)

Trigger node generate a message, when input


message occurs. Optionally it can also send
second message, unless extended or reset.
(e.g when any message arrived, generate one
second beep).

Delete you delay node after testing and Add


the trigger node by

1. Drag and drop the node. And wire the


nodes as figure shown below.

2. Double click on that node


Unrestricted© Siemens AG 2016 03/2016
Trigger node

• See the properties

I. Send: set to string type and


data is ‘1’

II. Select “wait for”

III. Change the time into 1


seconds

IV. Then send ‘0’

Unrestricted© Siemens AG 2016 03/2016


Trigger node

1) Deploy the flow

2) Click inject node

3) See the debug message

Unrestricted© Siemens AG 2016 03/2016


TASK 1

Create a flow to send ‘1’ for 5 seconds and ‘0’ for 2


seconds continuously

Unrestricted© Siemens AG 2016 03/2016


Task 2

We have 3 lamp
1st lamp will ‘on’ for a second and ‘off’ for a second then
2nd lamp will ‘on’ for a second and ‘off’ for a second
3rd lamp will ‘on’ for a second and ‘off’ for a second
This will continuously loop

Display: lamp1 – on1,off1;


lamp2 – on2, off2;
lamp3 – on3, off3
Unrestricted© Siemens AG 2016 03/2016
Basic node (Change node)

Change node can be used to change, set,


delete and move the properties of the
input. This node can set several rules
depend on the programme.

1) Add the change node and create the flow


as shown below

2) Place the debug node after two inject


nodes and before debug node.

Unrestricted© Siemens AG 2016 03/2016


Change node

1 2

1) Double click first inject

2)Change from timestamp to


Boolean. Then select - true

Unrestricted© Siemens AG 2016 03/2016


Change node

1) Double click the second inject

2) Repeat the step from the previous


inject but select - false

Unrestricted© Siemens AG 2016 03/2016


Change node

1) Set this to Change node by double click it.


2) Change this from string to Boolean and type the
payload of first inject which is “true”.
3) Replace it with “1” in number format.
4) Type the payload of the second input “false” and
replace it with “0”.
5) Deploy the flow and inject the both data and see the
result in debug window.

• In this example all inputs with the word “true” will


be replaced with “1” and all inputs with word
“false” will be replaced with “0”.
• Make sure the digit to be replaced with is different
for every rule
Unrestricted© Siemens AG 2016 03/2016
Basic node (Switch Node)

Switch node act as a comparator. It compare the


input based on the rules that have been set in the
node. When a message (input) arrives, the node
will evaluate each of the defined rules and
forward the message to the corresponding
outputs of any matching rules. The node can be
set to stop evaluating rules once it finds one that
matches.

Unrestricted© Siemens AG 2016 03/2016


Switch node

 Double click on the node to set the rules.  The properties that can be set are divided
There are several rules can be set into the into four parts which are value rules,
node. sequence rules, JSONata Expression and
otherwise.

Unrestricted© Siemens AG 2016 03/2016


Switch node

• A JSONata Expression can be provided that


• Value rules are evaluated against the
will be evaluated against the whole message
configured property
and will match if the expression returns a true
• Sequence rules can be used on message value.
sequences, such as those generated by the
• An Otherwise rule can be used to match if
Split node
none of the preceeding rules have matched.

Unrestricted© Siemens AG 2016 03/2016


Basic node (Range node)

• Range node maps a numeric value into a


different range.

Unrestricted© Siemens AG 2016 03/2016


Range node

1. Set the properties of the range node 2. The input value must be in number
format. The output will be mapped based
by double click on the node on the range
3. There are several actions can be applied
to the node

• The first action which is scale the message property by


default is the result is not constrained to the range defined
in the node.
• Scale and limit to target range means that the result will
never be outside the range specified within the result
range.
• Scale and wrap within the target range means that the
result will be wrapped within the result range.
Unrestricted© Siemens AG 2016 03/2016
Task 3

1. Display message “device1” when value below


than 5
2. Display message “device2” after 3 seconds when
value between 6 – 10
3. Display message “device3 on” when value more
then 10 and display “device3 off” after 2 seconds.
4. This system run using switch node.
Unrestricted© Siemens AG 2016 03/2016
Export & Import Node-Red

• Node-red makes it easy to save, share and move flows between computers using the export
and import features
• Flows are exported as JSON file and imported from a JSON file.
• Export can be done for a part of a flow or the entire flow.

EXPORTING FLOWS
1. Press CTRL and click each node in the flow
that you want to export. The nodes will be
highlighted.
Note: Use CTRL+A to select all nodes in
the workspace.
Click export Click Menu tab
2. Then click on Menu >export

Unrestricted© Siemens AG 2016 Select all flow 03/2016


3. The content of the export file will be
displayed. Selected Flow to
4. There are three tabs on the screen copy
with the selected nodes tab selected.
You can change it to export the current
flow or all flows in the workspace.

 User can export the node to the


clipboard or local library or download
Click
it in JSON file.
where to Click download to
 To save the code in notepad, user save the Click copy
download the code
can copy to clipboard and Ctrl-V flows to clipboard
in json file
(paste) to the notepad and save as
text file.

Unrestricted© Siemens AG 2016 03/2016


IMPORT FLOW
1. Click
Menu>Import

Click import Click Menu tab

Unrestricted© Siemens AG 2016 03/2016


2. Import window will be appeared. Choose how
3. User can paste flow json or select a .json to import
file to import in the box. flow
 User also can choose from the library or
example tab.
4. Then, click import.
Paste the
code here

Flow save
in local
Flow save library
by user and
previously. example.
Click import

Unrestricted© Siemens AG 2016 03/2016


 Simple example node that
demonstrate how it can be
used is provided in the
Examples section of the
import menu. Example flows
by node-red

 The packaged node that


been install sometime also
come with this simple
example flow.

Unrestricted© Siemens AG 2016 03/2016


Copy and Paste to copy Nodes

1. Copy and paste can be used to copy nodes between flows in the node-red workspace.
2. Select the nodes to copy using CTRL key to select individual nodes together into a group
or CTRL+A to select all nodes in the workspace.
3. CTRL+C to copy.
4. Moves to the place on the workspace or open the workspace where you want to copy the
nodes to and use CTRL+V to paste the nodes/ flow into the workspace

Note: This only works for flows in the same workspace.

Unrestricted© Siemens AG 2016 03/2016

You might also like