The reliability and expectations of a Siemens standard now contains the ease-of-use components any integrator can enjoy. Siemens is the industrial gateway of choice in factories and institutions. Exploring the SIMATIC IOT2000 series, engineers can harmonizes, analyzes, and forwards data efficiently with common protocols like MQTT and Modbus to any Cloud or proprietary visualization service. Based on a Yocto Linux, the SIMATIC IOT2000 series includes the IoT2020 and IoT2040 model. This incredible gateway harmonizes the communication between various data sources effectively over long distances and in electrically noisy environments, analyses it, and forwards it to the corresponding recipients, offering a solution that can be easily implemented and perfect for retrofitting.

Available in two versions, the IoT2020 designed for educational institutions and public spaces while the IoT2040 is optimized for Industrial environments. If you'd like to learn more check out the SIMATIC IoT2000 support and forums

In this guide we detail the integration of a HVAC System with the SIMATIC IOT2000, using an Arduino UNO which is the one in charge of takes the sensors readings and send the data to the Siemens Gateway through RS-485 interface. Plus, continue the tutorial by adding your own automation and control events for additional piece of mind with improved efficiency.

Requirements

3. SIMATIC IoT2000 Setup

First, you must register with or have access to Siemens Support Portal to download all initial configurations. The entire IOT2000 series is setup the same way, please follow this tutorial for any devices in the series.

3.1. Burn the SD-Card image

1. Begin by burning the SD-Card with the image provided by the Siemens Industry Online Support page. Please, download and save Example_Image_V2.1.3 for later.

2. Insert the microSD-Card into the SD-Card slot of your computer (an adaptor may be needed).

3. Unzip the downloaded image and burn it to the SD-Card. Microsoft users click here for how to burn images to your SD-Card. Linux users please continue reading.

IMPORTANT NOTE: Make sure the SD-Card is formatted before burn the image into it.

  • Linux:

1. Open your computer terminal and go to the folder where the zip file was. downloaded using the cd command. e.i: I downloaded the file into the "Downloads" directory:

cd Downloads

2. Unzip the downloaded file running the command below: 

sudo unzip 109741799_Example_Image_V2.1.3.zip

Once the zip file is properly unzipped you will see a file named example-V2.1.3.wic as is shown above.

NOTE: If you get an error running the command above verify if the name of the file downloaded is the same one in the command, if not replace it with the correct name.  

3. Verify the location of the SD-card to umount it and burn the image. Run the command below to verify the location: 

df -h

The SD-card should be located it the directory /dev/... ; in my case the sd card is located in the following directory /dev/mmcblk0

 4. Unmount the SD-Card running the command below: 

umount /dev/mmcblk0

5. To burn the image, replace the name of the file unzipped and the location of the SD-Card; the structure of the command is as follows:

sudo dd bs=1M if={name_of_the_image} of={SD_location}

Once the parameters are replaced with the correct ones, the command will look similar to the following:  

sudo dd bs=1M if=example-V2.1.3.wic of=/dev/mmcblk0

NOTE: Running this command may take a couple minutes, please be patient :)

3.2. Install the SD-Card image

Connect your SD-Card in the hardware. Below we have installed the SD-Card into the SIMATIC 2000 where indicated.

3.3. First commissioning of the SIMATIC IOT2000

The following steps show how to access the SIMATIC IOT2000 using the static IP to setup the gateway's network. At this point is important to mention that the SIMATIC IOT2040 brings DHCP Address by default in the Ethernet Port - X2P1, if your desire you can access directly using the IP address assigned. 

1. Power off and Connect one end of the Ethernet Cable to your computer and the other to the Ethernet Port- X1P1 of the SIMATIC IOT2000 device. 

CAUTION: Only use a DC 9-36V power supply! 

2. Once the SIMATIC IOT2000 is powered on, you will see the following behavior on the LEDs of the gateway:

  • PWR: Solid; device turned ON 
  • SD: Intermittent.... then Solid turned OFF
  • USB: Solid; device turned ON

The SD LED will be intermittent because is resizing the SD card with the image, wait until the SD LED change it status to Solid turned OFF to access to the gateway.

3. The SIMATIC IOT2000 lets you access to via Serial, SSH or Telnet; this guide uses the SSH connection. 

The SIMATIC IOT2000 has a static IP address by default -> 192.168.200.1. To establish a SSH connection, your computer have the same subnet as the SIMATIC IOT2000.

If you are working with Microsoft, please reference this getting started guide for how to access the gateway. Linux users please continue with the following steps.  

4. Once the network of your computer is configured on the same subnet of the SIMATIC IOT2000, verify its connectivity with a ping:

ping 192.168.200.1
expected result:
PING 192.168.200.1 (192.168.200.1) 56(84) bytes of data.
64 bytes from 192.168.200.1: icmp_seq=1 ttl=64 time=1.04 ms
64 bytes from 192.168.200.1: icmp_seq=2 ttl=64 time=1.03 ms
64 bytes from 192.168.200.1: icmp_seq=3 ttl=64 time=1.00 ms

If you receive the expected result, the SIMATIC IOT2000 is properly connected.

5. Access to the gateway running the command below: 

ssh root@192.168.200.1

Upon first accessing the Gateway you will be prompted to approve the security message. Send the command yes and press enter to approve and continue. Once access is properly established you will see the following root in your terminal:

root@iot2000:~#

6. As mentioned above, the static IP address of the SIMATIC IOT2000 is set to 192.168.200.1  . Thus, if another static IP address or DHCP address is required, this can be set in the "interfaces" file in the "/etc/network" directory. 

To do this, enter to the directory specified with the command below:

cd /etc/network/

Open the interfaces file using nano editor running the following command:  

nano interfaces

The content of the interfaces file by default be the same as below.

/etc/network/interfaces -- configuration file for ifup(8), ifdown(8)
The loopback interface
auto lo
iface lo inet loopback
wired
interfaces
auto eth0
iface eth0 inet static
        address 192.168.200.1
        netmask 255.255.255.0

auto eth1
iface eth1 inet dhcp

As mentioned above, If you are working with the SIMATIC IOT2040 the DHCP Address is configure by default on the second port (X2 P1LAN). Ensure that the Ethernet cable is connected to the second Ethernet port and reboot the gateway.

If you are working with the SIMATIC IOT2020 and desire to setup DHCP Address, you must modify the interfaces file as is shown below, then reboot the gateway:

/etc/network/interfaces -- configuration file for ifup(8), ifdown(8)
The loopback interface
auto lo
iface lo inet loopback

Wired interfaces
auto eth0
iface eth0 inet dhcp

Once the DHCP Address is configured you can use a network scanner app to know the new IP address is assigned to the SIMATIC 2000. We highly recommend using Fing which Google's Play Store and Apple's App Store to easily locate a device’s IP address.

3.4. SIMATIC IOT2000 with Node-RED

Before starting with the Node-RED flow, we must establish some configurations in the SIMATIC IOT2000. Please follow the steps below carefully to ensure the right functionality.

3.4.1. Package manager

1. Go to the opkg directory:

cd /etc/opkg

2. Edit the opkg.conf file using nano -> nano opkg.conf  . Then, add the lines below at the end of the file:

src iotdk-all http://iotdk.intel.com/repos/2.0/iotdk/allsrc iotdk-i586 http://iotdk.intel.com/repos/2.0/iotdk/i586src iotdk-quark http://iotdk.intel.com/repos/2.0/iotdk/quarksrc iotdk-x86 http://iotdk.intel.com/repos/2.0/iotdk/x86

3. Next, edit the arch.conf file using nano -> nano arch.conf . 

Then, add the lines below at the end of the file: 

arch i586 12
arch quark 13
arch x86 14

4.  Update the configurations made with:

opkg update

5. Write iot2000setup to open the setup interface and configure the X30 COM as RS-485.

To do this, select Peripherals > Configure External COM Port > X30 > RS485:

6. Assign the baud-rate to the port with the command below: 

stty -F /dev/ttyS2 9600

7. Reboot the SIMATIC to save the changes with the command reboot

3.4.2. Node-RED

1. To start Node-RED type the command below:

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

With Node-RED, you will see the behavior below in your SIMATIC IOT2000, this will take a couple of minutes - please be patient.

3. Once the Node-RED has started, open a web-browser (firefox, preferably) and write the IP Address of the SIMATIC IOT2000 and the port 1880 (i.e http://192.168.200.1:1880) to open the Node-RED web interface.

4. Next, click on Node-RED menu in the upper right corner, then “Import” -> “Clipboard” and paste the code below:

[{"id":"3740cae8.aee83e","type":"serial in","z":"707c997d.74c3c8","name":"rs-485","serial":"22b59e44.024bfa","x":132,"y":249,"wires":[["b621bf61.959b7"]]},{"id":"b621bf61.959b7","type":"function","z":"707c997d.74c3c8","name":"parse function","func":"var payload = msg.payload;\n/* Splits the incoming data */\nvar values = payload.split(\",\");\n/* Saves the sensor readings */\nvar temp_value = values[0]; // temperature in celsius\nvar temp_value_f = (temp_value*1.8) + 32; // temperature in fahrenheit\nvar hum_value = values[1].replace('\\r\\n', '');\n\nvar data = {}\n/* Builds the payload to be published */\ndata.payload = {\"temperature-c\": temp_value, \"humidity\": hum_value, \"temperature-f\": temp_value_f};\ndata.topic = \"/v1.6/devices/siemens\";\nreturn data;\n\n","outputs":1,"noerr":0,"x":336,"y":249,"wires":[["288319d7.13aa06","764e3eb0.baea8"]]},{"id":"288319d7.13aa06","type":"mqtt out","z":"707c997d.74c3c8","name":"","topic":"","qos":"","retain":"","broker":"6375a8fe.40ce","x":591,"y":250,"wires":[]},{"id":"764e3eb0.baea8","type":"debug","z":"707c997d.74c3c8","name":"","active":true,"console":"false","complete":"payload","x":553.5,"y":325,"wires":[]},{"id":"22b59e44.024bfa","type":"serial-port","z":"","serialport":"/dev/ttyS2","serialbaud":"9600","databits":"8","parity":"none","stopbits":"1","newline":"\\n","bin":"false","out":"char","addchar":false},{"id":"6375a8fe.40ce","type":"mqtt-broker","z":"","broker":"things.ubidots.com","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"willTopic":"","willQos":"0","willPayload":"","birthTopic":"","birthQos":"0","birthPayload":""}]

5. Assign your Ubidots TOKEN as username in the security tab of the MQTT-broker node. If you don't know how to get your Ubidots TOKEN see this guide

PROTIP: Before assigning the Ubidots TOKEN, select the Server for your Ubidots account; if you using Ubidots core platform select industrial.api.ubidots.com, if you are under the Educational Platform select things.ubidots.com

Once the Ubidots TOKEN is assigned in the MQTT-broker node, let’s program the Arduino UNO to start sending data. 

DEPLOYMENT NOTE: At this point, DO NOT press the “Deploy” button in NodeRED. Once the Arduino starts sending data to the SIMATIC IOT2000, you can press the deploy button to save the changes made.

4. Arduino Setup

To establish the communication between the end device and the Siemens SIMATIC IOT2000, we decided to choose an Arduino UNO which is one the most common microcontroller in the market, easy to use and easy to setup. It offers different kinds of shields and can connect via almost any protocol in your IoT repotrur.

The Arduino will be in charge of take the sensor readings (temperature and humidity) and send them to the SIMATIC IOT2000 through RS-485 using a RS-485 Shield. To get a better idea, reference the diagram below: 

4.1 Hardware connections

  1. First attach the Arduino RS-486 shield to the top of the Arduino UNO. Result in something like the image below:

2. Connect the AM2305 sensor following the diagram below:

NOTE: Before connecting the sensor, note that the sensor has a pullup resistor, please see this guide to learn how to setup the sensor properly if you have not done so before.

AM2305 - Arduino UNO
Yellow wired - pin 10
Red wired - 3.3 V
Black wired - GND

3. [OPTIONAL] Locate the Arduino UNO + RS-485 Shield inside a case, and make the modifications to the case for the sensor and power cable. To give you a better idea, reference to the images below:

3. Now connect the RS-486 Arduino shield with the SIMATIC IOT2000. The X30 COM and X31 COM allow you work with RS232/RS422/RS485 interfaces. In this case, we are going to work with the X30 COM - RS485. For more detailed information about the SIMATIC IOT2000 operating instructions, click here.

 Connector Pinout:

4. Follow the table below to make the connection between the Arduino RS485 shield and the SIMATIC IOT2000:

4.2. Firmware Setup

1. Open Arduino IDE. 

2. Select the Arduino UNO from Tools > Board  menu 

3. Download the DHT Library in the following link. Then, click on Sketch -> Include Library -> Add .ZIP Library. Select the .ZIP file of the library previously downloaded and press “Accept” or “Choose”.

4. Connect the Arduino UNO to your computer and select the port COM assigned from Tools > Port > Arduino UNO.

5. Now with everything configured, copy and paste the code below in the Arduino IDE.

/********************************
 * Libraries included
 *******************************/
#include <SoftwareSerial.h>
#include <DHT.h>

/********************************
 * Constants and objects
 *******************************/
#define DHTPIN 10     // what pin we're connected to
#define DHTTYPE DHT22   // DHT 22 - (AM2305)

float hum;  //Stores humidity value
float temp; //Stores temperature value

// Space to store values to send
char sensor_values[20];
char str_val_temp[10];
char str_val_hum[10];

DHT dht(DHTPIN, DHTTYPE);
SoftwareSerial mySerial(3,2);

/********************************
 * Main Functions
 *******************************/
void setup() {
  mySerial.begin (9600);
  Serial.begin(9600);
  dht.begin();
}
 
void loop() {
  /* Takes the sensor readings */
  temp = dht.readTemperature(); // Read temperature as Celsius (the default)
  hum = dht.readHumidity(); // Read humidity
 
  /*---- Transforms the values of the sensors to char type -----*/
  /* 4 is mininum width, 2 is precision; float value is copied onto str_val*/
  dtostrf(temp, 4, 2, str_val_temp);
  dtostrf(hum, 4, 2, str_val_hum);

  /* Concatenates the readings and save them in one variable */
  sprintf(sensor_values, "%s,%s", str_val_temp, str_val_hum);
  /* Send the values via serial (RS-486) */
  mySerial.println (sensor_values);
  /* Prints the values in the Serial Monitor */
  Serial.print("temp, hum: ");
  Serial.println(sensor_values);
  /* update the value every */
  delay(5000);

6.  Verify and upload the code choosing the "check mark" icon and then the "right-arrow" icon beside the check mark icon.

Now your Arduino UNO is sending data through RS-485 properly. If your desire to check the values sent, open the serial monitor by selecting the "magnifying glass" icon in the top right corner of our Arduino IDE.

7. Go back to the NodeRED Flow, press Deploy and the status of the serial and mqtt node should appear as connected. Also, if you wish to visualize the sensor value received, just press the debug tab:  

5. NodeRED Auto Start

To run NodeRED in the autostart mode, please follow the next steps:

1. In the SIMATIC IoT2000 terminal write the following command:

iot2000setup

2. In the window below using the keyboard arrows, locate the cursor in the “Software”option and press enter:

3. Then, select “Manage Autostart Options” :

4. Locate the cursor in the option “Auto Start node-red” and press the bar space to select the option:

5. To finish, press the “Done”, and reboot the SIMATIC IOT2000 with the command below:    

reboot

6. Data visualization 

1. Go to the device section of your Ubidots account and see a new device created:   

2. Enter to the device and you will see the variables temperature-c, temperature-f, and humidity created with the real-time data of the sensor connected:

3. If you desire to change the device name to a friendly one and you don’t know how, please reference the following guide. Also, you can change the device description icon, to learn how to modify it reference to the following guide

Once the names and icons are updated to your liking, launch your application. 

Results

In what felt like too easy of a process for hardware, we just integrated the Siemens SIMATIC IOT2000 with starter equipment and simple know-how. With the right devices for your environment, you too can launch industrial applications in a matter of days instead of months. 

Now it's time to create Ubidots Dashboards to visualize and interpret your data to control and monitoring your machines and environments remotely - keeping your clients happy and productions at its peak.

Don't forget to checkout the Control and Automation with Ubidots to make life a little easier and more comfortable by giving your data value and using it to automate other machines or processes.

For additional insights to the Siemens IoT2040 device and Ubidots position in the Industrial IoT Landscape, check out the April 10th, Webinar: Data Drives Decisions; how to extract value from the IIoT and the Cloud.

Did this answer your question?