Skip to content

Commit bd9b9ee

Browse files
authored
First Upload
0 parents  commit bd9b9ee

25 files changed

+740
-0
lines changed

LICENSE.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# **Legal information**
2+
3+
## **Use of application examples**
4+
5+
Application examples illustrate the solution of automation tasks through an interaction of several components in the form of text, graphics and/or software modules. The application examples are a free service by Siemens AG and/or a subsidiary of Siemens AG (“Siemens”). They are non-binding and make no claim to completeness or functionality regarding configuration and equipment. The application examples merely offer help with typical tasks; they do not constitute customer-specific solutions. You yourself are responsible for the proper and safe operation of the products in accordance with applicable regulations and must also check the function of the respective application example and customize it for your system.
6+
7+
Any change to the application examples is your responsibility. The application examples are not required to undergo the customary tests and quality inspections of a chargeable product; they may have functional and performance defects as well as errors. It is your responsibility to use them in such a manner that any malfunctions that may occur do not result in property damage or injury to persons. Siemens reserves the right to make changes to the application examples at any time without notice. The application examples of this repository are licensed under the MIT License (see below).
8+
9+
## **MIT License**
10+
11+
Copyright 2021 Siemens AG
12+
13+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
14+
15+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
16+
17+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
18+
19+
## **Security information**
20+
21+
Siemens provides products and solutions with industrial security functions that support the secure operation of plants, systems, machines and networks. In order to protect plants, systems, machines and networks against cyber threats, it is necessary to implement – and continuously maintain – a holistic, state-of-the-art industrial security concept. Siemens’ products and solutions constitute one element of such a concept. Customers are responsible for preventing unauthorized access to their plants, systems, machines and networks. Such systems, machines and components should only be connected to an enterprise network or the Internet if and to the extent such a connection is necessary and only when appropriate security measures (e.g. firewalls and/or network segmentation) are in place.
22+
For additional information on industrial security measures that may be implemented, please visit [https://www.siemens.com/industrialsecurity](https://www.siemens.com/industrialsecurity).
23+
24+
Siemens’ products and solutions undergo continuous development to make them more secure. Siemens strongly recommends that product updates are applied as soon as they are available and that the latest product versions are used. Use of product versions that are no longer supported, and failure to apply the latest updates may increase customer’s exposure to cyber threats.
25+
26+
To stay informed about product updates, subscribe to the Siemens Industrial Security RSS Feed at: [https://www.siemens.com/industrialsecurity](https://www.siemens.com/industrialsecurity).

README.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# **IOT2050-Example-Serial-Modbus-Connection**
2+
3+
- [**IOT2050-Example-Serial-Modbus-Connection**](#iot2050-example-serial-modbus-connection)
4+
- [**Overview**](#overview)
5+
- [**Hardware**](#hardware)
6+
- [**Software**](#software)
7+
- [**Prepare the IOT2050 & Examples**](#prepare-the-iot2050--examples)
8+
- [**Related Links**](#related-links)
9+
- [**Contribution**](#contribution)
10+
- [**License and Legal Information**](#license-and-legal-information)
11+
12+
## **Overview**
13+
14+
This application shows two ways to exchange data via a serial port between PC (Windows/Linux) and the IOT2050. In the first example a pure serial transmission is used, while in the second example the communication protocol Modbus RTU is used additionally.
15+
16+
![Overview](docs/graphics/overview.png)
17+
18+
## **Hardware**
19+
20+
The following hardware components are required for the application:
21+
22+
- **SIMATIC IOT2050 Advanced or Basic**
23+
- **USB to Serial Converter** (in this example: DIGITUS USB 2.0 to serial Converter, RS485 incl. USB A Cable 80cm)##
24+
25+
## **Software**
26+
27+
- **Example 1: Virtual Machine with Linux OS on Windows PC:** In this example VMWare Workstation 16 Player and Linux Debian 10 is used
28+
- working internet connection on the VM
29+
- install **picocom** with the terminal-command 'sudo apt-get install picocom' (in this manual version 3.1 is used)
30+
- **Example 2: PyModSlave on Windows PC:** You can download it [here](https://pypi.org/project/pyModSlave/) (in this manual version 0.4.4 is used)
31+
32+
## **Prepare the IOT2050 & Examples**
33+
34+
You can find the instructions for preparing the IOT2050 and the both examples in the following links:
35+
36+
- [**Prepare the IOT2050**](docs/README-Prepare-the-IOT2050.md)
37+
- [**Example 1: Sending ASCII-characters using a serial connection**](docs/README-Example-1.md)
38+
- [**Example 2: Sending array-packages using modbus-protocol**](docs/README-Example-2.md)
39+
40+
## **Related Links**
41+
42+
||Topic|
43+
|-|-|
44+
|1|SIMATIC IOT2050 forum: [https://support.industry.siemens.com/tf/ww/en/threads/309](https://support.industry.siemens.com/tf/ww/en/threads/309)|
45+
|2|SIMATIC IOT2050 Getting Started: [https://support.industry.siemens.com/tf/ww/en/posts/238945/](https://support.industry.siemens.com/tf/ww/en/posts/238945/)|
46+
|3|Operating Instructions: [https://support.industry.siemens.com/cs/ww/en/view/109779016](https://support.industry.siemens.com/cs/ww/en/view/109779016)|
47+
48+
## **Contribution**
49+
50+
Thanks for your interest in contributing. Anybody is free to report bugs, unclear documenation, and other problems regarding this repository in the Issues section or, even better, is free to propose any changes to this repository using Merge Requests.
51+
52+
## **License and Legal Information**
53+
54+
Please read the [Legal information](LICENSE.md).

docs/README-Example-1.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# **Example 1: Sending ASCII-characters using a serial connection**
2+
3+
Make sure the following nodes are activated in Node-Red (the modbus-nodes must be deactivated):
4+
5+
![Example 1 Node-Red](graphics/nodered-example-1.png)
6+
7+
You can enable/disable nodes as follows: Double-Click on the node -> Change Enabled / Disabled -> Click Done -> Press Deploy to apply the changes
8+
9+
Open the Virtual Machine on your PC connected to the IOT2050. If not already done, open a terminal and install picocom (in this manual version 3.1 is used) with the following command:
10+
11+
sudo apt-get install picocom
12+
13+
With the following command you can then check if the installation was successful:
14+
15+
which picocom
16+
17+
The terminal should show the output on the image:
18+
19+
![Picocom success](graphics/check-picocom.png)
20+
21+
Remove the USB to serial converter from your PC and plug it in again. Make sure that the USB device now connects to the virtual machine. The following message appears in VMWare Workstation 16 Player:
22+
23+
![device detected](graphics/device-detected.png)
24+
25+
Start picocom with the following command:
26+
27+
sudo picocom /dev/ttyUSB0 -c -b 115200
28+
29+
## **Sending from Virtual Machine to IOT2050**
30+
31+
Once picocom is ready, characters can be entered and then transmitted. The split input timeout is set to 2000ms by default. The output can then be viewed in Node-Red under "debug messages".
32+
33+
![sending serial from VM to IOT2050](graphics/sending-serial-vm-to-iot2050.png)
34+
35+
## **Sending from IOT2050 to Virtual Machine**
36+
37+
Make sure that picocom is enabled so that a signal can be received. Then, in node-red, the output can be triggered by clicking on the inject-node. The text "Example-123" is configured in the inject-node by default.
38+
39+
![sending serial from IOT2050 to VM](graphics/sending-serial-iot2050-to-vm.png)
40+
41+
You can exit the picocom-command by pressing CTRL+A and CTRL+Q.
42+
43+
## **Other documents**
44+
45+
- [**Application-Overview**](../README.md)
46+
- [**Prepare the IOT2050**](README-Prepare-the-IOT2050.md)
47+
- [**Example 2: Sending array-packages using modbus-protocol**](README-Example-2.md)

docs/README-Example-2.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# **Example 2: Sending array-packages using modbus-protocol**
2+
3+
At the beginning, please make sure that the USB to Serial converter is connected directly to your PC and not passed through to a VM (especially if [**Example 1**](README_Example_1) was done before).
4+
5+
If not already done install PyModSlave on your Windows PC: You can download it [here](https://pypi.org/project/pyModSlave/) (in this manual version 0.4.4 is used).
6+
7+
Make sure the following nodes are activated in Node-Red (the serial-in/out-nodes must be deactivated):
8+
9+
![Example 2 Node-Red](graphics/nodered-example-2.png)
10+
11+
You can enable/disable nodes as follows: Double-Click on the node -> Change Enabled / Disabled -> Click Done -> Press Deploy to apply the changes
12+
13+
## **Sending from PC to IOT2050**
14+
15+
Open the application pyModSlave -> Click the "Modbus RTU" settings-button -> Adjust the settings as in the following picture -> Press "OK"
16+
17+
![pyModSlave Modbus RTU Settings](graphics/pymodslave-modbus-rtu-settings.png)
18+
19+
Now switch to the "Input Registers" tab -> Click the "Connect"-button -> The connection should now be displayed as active (green circle at the bottom left) -> The numerical values of the sending array can now be adjusted as desired
20+
21+
![pyModSlave connecting](graphics/pymodslave-connecting.png)
22+
23+
The modbus-in node in Node-Red should now receive this array and output it via the debug node:
24+
25+
![Modbus Input Node-Red](graphics/modbus-in-output-node-red.png)
26+
27+
The transmission can be terminated by clicking the connect-button again.
28+
29+
## **Sending from IOT2050 to PC**
30+
31+
Open the application pyModSlave -> Click the "Modbus RTU" settings-button -> Adjust the settings as in the following picture -> Press "OK"
32+
33+
![pyModSlave Modbus RTU Settings](graphics/pymodslave-modbus-rtu-settings.png)
34+
35+
Now switch to the "Holding Registers" tab -> Click the "Connect"-button -> The connection should now be displayed as active (green circle at the bottom left) -> Then, in node-red, the output can be triggered by clicking on the inject-node. The array "[1,2,3,4" is configured in the inject-node by default. -> In pyModSlave you can now see how the first registers has adapted
36+
37+
![sending modbus from IOT2050 to pyModSlave](graphics/sending-modbus-iot2050-to-pymodslave.png)
38+
39+
## **Other documents**
40+
41+
- [**Application-Overview**](../README.md)
42+
- [**Prepare the IOT2050**](README-Prepare-the-IOT2050.md)
43+
- [**Example 1: Sending ASCII-characters using a serial connection**](README-Example-1.md)

docs/README-Prepare-the-IOT2050.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# **Prepare the IOT2050**
2+
3+
## **Installing Example-Image & First commissioning**
4+
5+
Follow [SIMATIC_IOT2050_Setting_up.md](https://github.com/SIMATICmeetsLinux/IOT2050-SmartFarming-Application/blob/main/docs/SIMATIC_IOT2050_setting_up.md) for the following steps:
6+
7+
- Installing the SD-Card Example Image (in this example the image V1.1.1 was used)
8+
- First commissioning of the SIMATIC IOT2050: Remote access with Putty SSH Connection (login as root)
9+
- Network connection to open Node-Red
10+
11+
## **Adjust Peripherals on IOT2050 Basic**
12+
13+
Use the following command to get into the setup:
14+
15+
iot2050setup
16+
17+
Perform the following steps:
18+
19+
Peripherals -> Configure External COM Ports -> RS485 -> Select "Turn on terminate resistor" (spacebar) -> Confirm with "Ok" -> Confirm the Changes -> Exit setup-menu and reboot the IOT2050
20+
21+
## **Adjust Peripherals on IOT2050 Advanced**
22+
23+
Use the following command to get into the setup:
24+
25+
iot2050setup
26+
27+
Perform the following steps:
28+
29+
Peripherals -> Configure External COM Ports -> RS485 -> Select "Turn on terminate resistor" (spacebar) -> Confirm with "Ok"
30+
31+
The setup- and hold-values must be adjusted as follows (0x0005):
32+
33+
![adjust setup- and hold-values](graphics/setupholdtime.png)
34+
35+
Confirm with "Ok" -> Cornfim again with "Ok"
36+
37+
![power cycle IOT2050 Advanced](graphics/power-cycle-iot2050.png)
38+
39+
**Important:** After the changes to the **IOT2050 Advanced**, it is **essential to perform a manual reboot**: To do this, disconnect the power cable from the device for a few seconds and reconnect it. A conventional reboot is not sufficient for this!
40+
41+
## **Connect the hardware-devices**
42+
43+
Connect the computer and the IOT2050 using the USB to serial converter. Make sure that the pins are assigned correctly. The pin assignment on the IOT2050 is as follows:
44+
45+
![serial connection](graphics/serial-connection.png)
46+
47+
For more information please visit the [SIMATIC IOT2050 support page](https://support.industry.siemens.com/cs/document/109779016/simatic-iot2050).
48+
49+
**Important:** Please also pay attention to the pinout of your converter!
50+
51+
## **Import Node-Red Flow**
52+
53+
On the Example Image version 1.1.1 (used in this manual) Node-Red is already preinstalled and autostart is enabled. To access it, open a browser on your PC connected to the IOT2050 and open the URL `http://<IP of the IOT2050>:1880/`.
54+
55+
Download the ready-made JSON-File: [iot2050-example-serial-modbus-connection.json](../src/iot2050-example-serial-modbus-connection.json)
56+
Import the flow and press the "deploy-button":
57+
58+
Menu -> Import -> Select a file to import -> Press the Import-Button
59+
60+
If all configurations are set correctly, the flow will look like the following.
61+
62+
![overview node-red](graphics/overview-node-red.png)
63+
64+
Depending on the IOT2050 (basic or advanced) used, the appropriate flow must be selected and activated:
65+
66+
Double-Click on the basic-/advanced-tab -> Change "Disabled" to "Enabled" -> Click Done -> Press Deploy to apply the changes
67+
68+
## **Other documents**
69+
70+
- [**Application-Overview**](../README.md)
71+
- [**Example 1: Sending ASCII-characters using a serial connection**](README-Example-1.md)
72+
- [**Example 2: Sending array-packages using modbus-protocol**](README-Example-2.md)

docs/graphics/check-picocom.png

4.54 KB
Loading

docs/graphics/device-detected.png

8.33 KB
Loading
3.28 KB
Loading

docs/graphics/node-modbus-in.png

2.95 KB
Loading

docs/graphics/node-modbus-out.png

2.49 KB
Loading

0 commit comments

Comments
 (0)