Siemens SIMATIC IOT2000 Series to Ubidots + Arduino IDE

by UbiMaker in Circuits > Linux

3415 Views, 6 Favorites, 0 Comments

Siemens SIMATIC IOT2000 Series to Ubidots + Arduino IDE

siemens_iot2020.jpg

The simplicity of Arduino combined with the reliability and history of Siemens makes the SIMATIC IOT2000 series a perfect choice for an industrial gateway in factories and institutions exploring connectivity and retrofitting options. New sensors on old machines or simply upgrading the sensors currently in use, the SIMATIC IOT2000 series harmonizes, analyzes, and forwards data efficiently with common protocols like MQTT and Modbus. Based on a Yocto Linux, the SIMATIC IOT2000 series includes the IoT2020 and IoT2040 models which are compatible with most Arduino Sketches and can be uploaded directly from the Arduino IDE. The IOT2040 is ideal for factories while the IOT2020 is best in educational institutions with its additional peripherals and communication protocols.

The below tutorial demonstrates how to setup the SIMATIC IOT2000 series using the Arduino IDE and a sample code to send an HTTP request to Ubidots for front-end interpretation.

Requirements

Setting Up the SIMATIC IOT2000 Series

First, you must register with or have access to Siemens Support Portal to download all initial configurations. This Portal will also provide troubleshooting and support from Siemens on any hardware related inquires. The entire IOT2000 series is setup the same way, please follow this tutorial for any devices in the series.

Burn and Install the SD-Card

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.

  • Insert the microSD-Card into the SD-Card slot of your computer (an adaptor may be needed).
  • Unzip the downloaded image and burn it to the SD-Card. Microsoft users click here or how to burn images to your SD-Card. Linux users please continue reading.

Burning an image to the SD-Card using 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 displayed above above. NOTE: If you get an error running the command above, verify the name of the file downloaded is the same.

3. Verify the location of the SD-card to unmount 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:

unmount /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 should look similar to the following:

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

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

Install Your SD-Card

Screenshot_20171214_145348.png.jpeg

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

First Commissioning of the SIMATIC IOT2000

The following steps show how to access the SIMATIC IOT2040 using the static IP to setup the gateway's network. At this point is important to mention that the SIMATIC IOT 2040 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 your 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 assigned to the SIMATIC 2000, we highly recommend you use fing which is easy to use and is available in both Google's Play Store and Apple's App Store. :)

Arduino IDE and Sample Code

The SIMATIC IOT2000 is compatibly with the Arduino IDE using the Intel Galileo package. Please follow the steps below to setup the board properly:

1. Open the Arduino IDE

2. Open Boards Manager from Tools -> Board -> Boards Manager and install the galileo package. To find the correct device, search "Intel i5" within the search bar. Download and install the latest version.

3. Select your Intel Galileo gen2 from Tools > Board menu.

4. Attach the Micro USB to your IOT2000 and select the port com assigned from Tools > Port > Intel Galileo. If your working on Windows and your PC does not recognizes your IOT2000, you must update the drivers manually.

5. Now with everything configured, upload the Blink Sketch to verify that everything is working properly. Go to File > Examples > Basics > Blink and compile the code.

6. Once the code is properly updated the USER LED will start blinking.

Visualizing Your Data in Ubidots

Screenshot_20171222_140411.png.jpeg
Screenshot_20171222_140348.png.jpeg

Once you are able to compile the Blink code into the SIMATIC IOT2000 you can continue with the following steps:
1. Copy and paste this code below in your Arduino IDE. Once you have pasted the code be sure assign the unique Ubidots TOKEN where indicated. If you don't how to your Ubidots TOKEN, please reference this article.

IMPORTANT DEPLOYMENT NOTE: The code above is a sample code demonstrating how to send HTTP POST request to Ubidots using the EthernetClient library. To implement your own code, please reference the Ubidots REST API Reference and Siemens Support for additional resources.

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

3. To visualize the response of the server and its connectivity with the device, open the Serial Monitor of the Arduino IDE. Display the serial monitor by selecting the "magnifying glass" icon in the top right corner of our Arduino IDE.

Confirm your code by going to your Ubidots account to find the new device created called "simatic-iot2000" containing a variable called "humidity" which the reading the A0 input from the Arduino Shield contained by the SIMATIC IOT2000.

Results

In just a few minutes, we integrated an industrial device, the Siemens SIMATIC IOT2000 with Ubidots, and only needing basic knowledge about the hardware and functionality of the Arduino IDE.

Now its time to create Ubidots Dashboards to visualize and interpret your data to control processes or mitigate errors.