The reference packet for these devices is snap7-iot-quark
The tests were made with:
|
Intel Galileo Gen 2 |
|
Siemens SIMATIC IOT2040 6ES7 647-0AA0-1YA2 |
This development board is a microcontroller board based on the Intel
Quark™ SoC X1000 (@400MHz) application processor, a
32-bit Intel Pentium brand system on a chip (SoC). It
is the first board based on Intel architecture designed to be hardware and
software pin-compatible with shields designed for the Arduino
Uno R3.
The Ethernet port is managed directly by a dedicated subsystem so,
despite to its clock (lower than that of Raspberry 3), I found it very fast.
It is an intelligent gateway designed to meet the new industry standard
4.0 in terms of IoT. There are two models with
different hardware.
|
IOT2020 |
IOT2040 |
CPU |
Intel Quark X1000 |
Intel Quark X1020 |
RAM |
512 MB |
1GB |
Ethernet Adapters |
1 |
2 |
USB Adapters |
2 (1 Type A + 1 mini B) |
2 (1 Type A + 1 mini B) |
RS232/485 |
- |
2 |
Other |
- |
Battery buffered RTC |
OS |
Yocto Linux |
These devices are a re-engineered version of Galileo Gen 2, in fact,
since I’m curious like a monkey J, I flashed
the official Siemens uSD image into a Galileo board
and worked flawless.
Regardless of the developing tool that you want to use for your
programs, Snap7 library must be compiled with the GNU toolchain.
You can choice either to compile it yourself or to use the deployed
libsnap7.so.
To build Snap7, the GNU toolchain must be
present into your device. Both the Siemens uSD image
and the official Intel Image contain everything you need.
1.
Copy or download the latest release of snap7-iot-quark-<release> into /home/root
2.
Go to /build/unix and execute make –f i586_linux.mk install
The compilation must be completed with 0 Errors and 0 Warnings.
It’s not mandatory to rebuild the library, you can use libsnap7.so
supplied whith the package.
So, if you don’t want to rebuild the library or you are using a shrinked distro that does not
contain GNU toolchain, you can simply copy
libsnap7.so into /usr/lib
I tested these devices with C and C++ but you can program them also
using other languages like Java, Python or Node.JS. Please refer to Snap7
documentation for them.
Arduino IDE
Unluckily I didn’t find the way to use this tool with Snap7. Basically
I didn't find the linker options for including snap7 as external library.
GNU C/C++
There are some examples ready to run, you can find them into /examples/cpp or /examples/plain-c
To compile them, just go to /examples/cpp/i586-linux
(or /examples/plain-c/i586-linux ) and execute make all
Intel System Studio IoT Edition
It’s a free Eclipsed based IDE, it’s much more advanced than Arduino IDE. This is the official tool suggested by Siemens
for programming IOT2000.
To use it, you must first copy libsnap7.so into \iss-iot-win\devkit-x86\sysroots\i586-poky-linux\usr\lib
Notice that the same libsnap7.so must be present both in /usr/lib of the device and in \iss-iot-win\devkit-x86\sysroots\i586-poky-linux\usr\lib
of the host PC.
Into workspace_snap7 archive you will find some examples, to use them
you must import them into your workspace.
File->Import->General->Existing Projects into Workspace then select the root directory (i.e. workspace_snap7) and
flag the option “Copy projects into workspace”.
For new projects written from scratch, remember to add snap7 as symbol
into Project properties ->
Paths and Symbols as in
figure.
Case study : How to connect a S7 HMI to SIMATIC IOT2000 or Galileo
SIMATIC IOT2000 is not a PLC, if you have a plant which has a SCADA
system as supervisor, with a few lines of code you can communicate with your
IOT2000 without using a different way such as a web server or a SSH console.
Using the object Snap7Server, every SCADA System (Siemens HMI panel,
OPC Server, SCADA and so on) can see your device as a S7315 2PN/DP CPU.
For a detailed explanation of Snap7Server please see here.
Into the workspace you will find the project Snap7HmiTest which
simulates the production data collection from some PLCs using Snap7Client and
presents them in some words of DB1, calculating also the Quality Rate.
The data collection is simulated, or to run the demo you should have
had to connect to the network 3 PLC, anyhow, there is the example
Snap7ClientTest into the same folder that explains how to do it.
To test the system I wrote a simple HMI Project using WinCC.
This is the connection:
These are the Tags:
And this is the runtime in action:
Notice that in the figure the Panel is connected to a different port of
IOT2000 only to show that it’s connected directly to the device and not to the
PLCs, but this in a real application is not necessary. The panel can
communicate with S7Server also if it’s connected to the switch. So a single
Ethernet port board (Galileo or IOT2020) is perfectly suitable.