IOT 2040 – Node Red
HARDWARE COMPONENTS
1)   IOT 2040
2)   S7 1200 (Any CPU , Any Firmware version) OR S7 200 smart (Any)
3)   PC/Laptop
4)   Ethernet Switch
                           CONNECTIONS
1)   Two LAN ports of IOT as LAN X1 P1 and LAN X2 P2. Connect X1 port with
     PC/Laptop for communication of IOT (also with PLC or any other device ,
     left port will be used).Port X2 is for connecting internet through LAN
     cable.
2)   Power supply – 24vdc
                             REQUIREMENTS
 HARDWARE
       1. SD CARD (empty Any)
       2. Internet Connection :- Through LAN cable
SOFTWARE
       1. Putty (For initial set up of IOT) Click here .
        Download the first option under heading Download PuTTY and after that
        choose out of 32 bit and 64 bit files options as per your laptop/PC
        configuration
       2. Win32diskImager Click here
 FILE
       1. Example Image for installing SD card - Click here
                                   PROCEDURE
   Installing the SD-Card Example Image
    Insert the µSD-Card via SD-Card Adapter in the SD-Card Slot of your Laptop/PC.
    Unzip the downloaded SD Card image .zip-file.
    Run the Win32 Disk Imager which you have earlier installed.
    Click on the folder as shown below:-
                                    PROCEDURE
   Installing the SD-Card Example Image
    Browse to the retrieved storage location of the image file and on right side
     bottom select “*.*” , it will show the file named “iot2000-example-image-
     iot2000.wic. Select the file
                                         PROCEDURE
   Select the drive letter of your SD
    Card .
   Click the “Write” button then
    after.
                                              You will get the pop up so Confirm the warning
                                               message by pressing “Yes”.
                      You will get successful message, press “OK”.
                      After this remove the SD card from PC/Laptop.
                              PROCEDURE
   Insert the SD card into IOT slot.
   Slide the locking down
                                             Open the Locking
         Insert the SD card
         Close the locking and slide it up
                         READY FOR FIRST COMMISSIONING
   Power up the IOT
   PC/Laptop’s LAN port is connected to Left port (X1 P1) of IOT.
    The default IP address of IOT is 192.168.200.1 of X1 P1 port so make your PC/Laptop
    in same range for first connection.
    Run the Putty software used for
    accessing the IOT.
   Make the following settings:-
    *Choose the Connection Type “SSH” .
    *Enter the IP address 192.168.200.1,
     Port will be 22 by default.
    *After these settings, single click “Default
     Settings” and Click “Save”.
    *Click “Open”.
           READY FOR FIRST COMMISSIONING
   Such window will open ->
                                  For 1st time connection, it will
                                   show warning ,so click “Yes”
                                   button
                       READY FOR FIRST COMMISSIONING
   If once confirmed a login dialog
    appears .
   Type “root” and press the Enter key,
    the login was successful.
   Type “passwd” for setting a password
    for login.
   Write the new password(nothing will
    be visible so u have to keep on typing
    your password).
   Again type for Confirm password
    asked(input is again hidden).
                                       IOT SETTINGS
    For changing the settings of IOT , we need to enter into the setup from putty itself.
     Type “iot2000setup” and press Enter.
    Now If you want to change the IP address of X1 P1 port from default , then Click on
     “Networking”.
    Go to “Configure
     Interfaces” and press
     “Enter”
*****NOTE – For navigating and selection in the setup , use up/down and right/left and enter
  keys from the keyboard. (Mouse will not work)
                                       IOT SETTINGS
  There will be 2 options :
   1)eth0 for X1 P1 - 192.168.200.1 (default for Engineering). Change as per required
   2)eth1 for X2 P2 - dhcp (default). Always remember that this port is used for Internet
     connection so do not assign an IP address to it and keep “dhcp” as it is.
After changing ,press “OK”
   In same way all other settings , for ports like serial (RS 232 and RS 485 ) ,
    Peripherals(I/O) ,etc. can be done in the same setup window.
                       Communication with Siemens PLC
   For this connect the IOT’s left side LAN port, also S71200 and your PC/Laptop, all to a
    Ethernet switch. Connect Internet to X2 P2 port of IOT .
   Ping and check the connection is established or not ,to both IOT and PLC.
   PLC – *First Add one Data block with attribute as “Un-optimized” and add 2 or 3
    random tags of Integer type(any data type can be given).
     *In hardware configuration check the Get/Put permission box.
     *Download the PLC program.
   Now run putty again as per previous method and log in as “root”.
   It will ask for password, so enter the new password which you have set during first
    commissioning.
   After successful login , type the command “cd /usr/lib/node_modules “ and press
    enter. (This is to enter into the node red directory).
   Now type “npm install node-red-contrib-s7 “. This is for installing s7 nodes.
                       Communication with Siemens PLC
   Installation will take place so wait till again “root@iot2000:usr/lib/node_modules#”
    comes.
   After successful installation, for starting node red type,
    “node /usr/lib/node_modules/node-red/red &” and press enter.
Communication with Siemens PLC
                       Communication with Siemens PLC
   After running that command , it will take some time to start the node. After that you
    will see that its written on putty window that server now running at
    http://127.0.0.1:1880/.
   Once this comes , open Web browser and type the IP address of IOT with Port number
    like this : “192.168.200.1:1880” and press Enter.
   Once the Node-red page opens ,you will see different nodes listed on left hand side.
                       Communication with Siemens PLC
   Now for configuring the Node-red :-
    *Choose “s7 in” node on the left hand side and add it per Drag & Drop to the middle .
    *Double click on Node , a window like below will open.
                        Communication with Siemens PLC
   Add a new end point with IP address, Port, Rack- and Slot number of the S7-PLC and a
    reading cycle time. (Only change the IP address as Port will always be 102 for siemens
    PLC. For S71200 keep Slot no. and Rack as it is.
          Then Click on “Variables” tab 
                       Communication with Siemens PLC
   Add the variables you want to read out from the 1200 PLC. The one which you have
    defined in the data block in PLC.
Press “Add” button in variables section. Add the variables you want to read out and
give them a name. The address is “DB,DatatypeOffset”.
                       Communication with Siemens PLC
* Absolute address is important and not name (name can be anything ,irrespective of what
  given in PLC).Syntax is – DBX,Real0 i.e. DB number then comma and then data type with
  offset number.
                                                                             If
                                                                             If PLC
                                                                                PLC is  is 200
                                                                                           200 smart:-
                                                                                                smart:-
                                                                                 1)
                                                                                 1) Slot Slot no.
                                                                                               no. == 22
                                                                              2)
                                                                              2) Variable
                                                                                      Variable syntax
                                                                                                 syntax
                                                                                      for
                                                                                      for MM memory
                                                                                               memory
                                                                                       will
                                                                                       will be as
                                                                                             be as itit is
                                                                                                        is
                                                                                     “MW0”,      but
                                                                                     “MW0”, but for     for
                                                                                      V
                                                                                      V memory,
                                                                                         memory, it   it is
                                                                                                          is
                                                                                         DB1,WORD0”
                                                                                     ““ DB1,WORD0
                                                                              If
                                                                              If its
                                                                                 its Real
                                                                                      Real type
                                                                                             type then
                                                                                                    then
                                                                                    instead     of
                                                                                    instead of WordWord
                                                                                        ,write
                                                                                        ,write “Real”
                                                                                                “Real”
                                                                                       and
                                                                                       and same
                                                                                             same wayway
                                                                                       for
                                                                                       for other
                                                                                            other data
                                                                                                   data
                                                                                          types  too.
                                                                                          types too.
                                                                             “DB1”
                                                                             “DB1” will be
                                                                                         will be as
                                                                                                  as itit is
                                                                                                          is
                                                                                            always
                                                                                            always
* Like this keep on Pressing “+Add” for multiple tags and finally Press top right corner “Add”
  to complete the addition of all variables.
                       Communication with Siemens PLC
   Mode – Its nothing but you can select that whether to read selected variable from the
    list or all the variables. The one you defined in the variables list.
   Name – Any name can be given to the node ,which will be shown as a label.
                        Communication with Siemens PLC
   Now from the Node list on left side, search “Debug” node and drag & drop on the
    Screen.
   After that you will be seeing two nodes on the Flow, S7 read and Debug. Connect these
    two by dragging line from one to another.(In the image below the node is different and
    not debug node)
   After that Click on “Deploy”. This will download the flow to IOT(SD card).
   You will see a message of “Successfully Deployed” on the top of web browser.
   If the connection gets established , then you should be able to see the variable’s value
    on the S7 read node.
                               NODE RED DASHBOARD
   Node red gives a Dashboard where you can design the control and monitoring of any
    PLC or device as per your requirement.
   For this there are nodes present in the list on left side like gauge/Level Indicator/Lamps
    etc. Drag & Drop these and connect to the S7 read write values for showing those on
    dashboard.
   For running the dashboard Click on “Dashboard” tab (highlighted in yellow) and then
    click on the right side Arrow .
   This will redirect you to another web page showing the elements selected on the Flow
    by you.