Moxa ioLogik E2200 series

From SpinetiX Support Wiki

Jump to: navigation, search

Moxa-iologik-e2200-application.png

Description

Moxa’s ioLogik E2200 is an Ethernet micro RTU controller for data acquisition and I/O device control. It can receive data from other devices (like sensors and meters) and automatically report the I/O status or trigger actions based on user-specified conditions.

Such a device can be used in two scenarios with the HMP:

  • As input device, where a push of a button would trigger for instance some specific information (like evacuation instructions) to be displayed by the player.
  • As output device, where for instance an action done on the player side would trigger an event in the real world, such as an alarm or lights switching.
Note Note:
For the tutorials below, the Moxa ioLogik E2214 model was used, but other models from the Moxa’s Smart Ethernet I/O product series can be used as well; the selection of the model is determined by the number and type of input / output interfaces.

Configuration

This tutorial shows the steps required to do the basic configuration of the ioLogik device. The cabling of the ioLogik device is outside the scope of this tutorial.

  • Difficulty: Medium.
  • Total duration: 15 - 20 minutes.
  • Requirements:
    • Moxa ioLogik E22xx device (preferably using the latest firmware);
    • Moxa ioAdmin program;

Getting started

Auto Search dialog
Login screen
  1. Connect the network and power supply cables to the Moxa device.
  2. Download the "ioAdmin Configuration Utility for ioLogik I/O Server Series" from the Moxa web site.
  3. Install the ioAdmin application on your PC.
  4. Start the ioAdmin application. The auto search dialog opens automatically.
  5. Click the "Start Search" button to find your ioLogik device. Your Moxa device should appear in the left panel of ioAdmin.
  6. Click on the name of your device (e.g., E2214), if it is not already selected.
  7. Click on "Server Settings" tab in the main panel.
  8. Enter the device's password (by default it is empty) and click the "Login" button. This enables more tabs in ioAdmin.

Configure the time

Time settings

It is important to configure the time settings of the ioLogik device to work seamlessly with the HMP; this should be set automatically when you log in for the first time, just refresh to be certain.

To set up the time, follow these steps:

  1. Under the "Server Settings" tab:
    • Set the local date and time.
    • Set the timezone.
    • Set the NTP server. It is recommended to use the same NTP server as the one used for the HMP in NTP settings.
  2. Click the "Update" button.
  3. Right-click the device name in the left panel and select "Restart System".

Configure the IP address

IP configuration

As the ioLogik and the HMP need to communicate to each other via IP, it is important to have fixed IP addresses, both for the HMP and for the ioLogik device.

To set up the Ip address, follow these steps:

  1. Go to the "Network" tab.
  2. Set the "IP Configuration" option to "Static".
  3. Set the "IP Address", the "Subnet Mask" and the "Gateway" fields according to your network settings.
  4. Click the "Update" button.
  5. Right-click the device name in the left panel and select "Restart System".

Control HMP from ioLogik

Moxa ioLogik E2214 setup

This tutorial shows how to set up the ioLogik device in order to relay the push of an external button (dry contact), connected to the device's input port, towards the HMP (via network triggers) and have the HMP display a predefined content when that happens.

  • Difficulty: Medium.
  • Total duration: 30 minutes.
  • Requirements:
    • Moxa ioLogik E22xx (preferably using the latest firmware);
    • An HMP350 (preferably using the latest firmware);
    • Moxa ioAdmin program;

Enable the Network API

Network API
  1. Open HMP Control Center and go to Advanced Applications > Network API page.
  2. For firmware 4.3.0 or above, click "Enable secure server", then "Enable legacy unprotected server" option. For firmware below 4.3.0, click "Network API" option.
  3. If necessary, change the default "1234" port.
  4. Click the "Apply" button.

Configure the Click&Go logic

Click&Go tab
Set up Logic
Configure DI trigger
Configure CGI Command

Each input port of the ioLogik can be configured independently. Moreover, it is possible to setup multiple events for each input. In this example a single event will be setup when the user click on the input button. However the same process may be repeated for each one of the button.

  1. Start the ioAdmin application.
  2. Open on "Click&Go Logic" tab.
    • If you already have have a project in your ioLogik, it can be retrieved from the device using the Retrieve button.
  3. Select the first row (#0), and click on it to configure it.
  4. Enable the logic
  5. In the group box "IF"
    • Select the trigger to be a button (DI)
    • Using the edit button, select the the first button (DI-0)
    • Select to trigger an action when the button goes from OFF to ON. i.e. the user has pressed the button.
  6. In the group box "Then"
    • Select the action to be a CGI Command
    • Click on the edit button to configure the CGI Command.
    • Check the GET method
    • Write down the HMP350 IP address followed by your port 1234 and the update path. (see Shared Variable HTTP interface)
    • Enter the name of the variable to be modified and the new value (e.g. "di0=click")
    • Press OK to close the dialog
  7. Press the Upload to ioLogik button to save your changes to the ioLogik device

Elementi project

Action to Switch - properties
Action to Switch - mapping

The final step is to create a simple Elementi Project to display an image when the button is pressed.

In the example bellow, an Action to Switch widget is used to display some specific text when the button is pressed. The text can be replaced by an image, a video, an Elementi Playlist or even an Elementi Layout.

  1. Create a new project.
    For more on this subject, see the tutorial My first Elementi project
  2. Drag and drop the Action to Switch widget from the Interactive widgets folder.
  3. In the Properties tab of the Action to Switch
  4. In the Mapping tab of the Action to Switch
    • Set the default content. (In this example a text layer is used)
    • Set the content for the Action click (as configured in the ioAdmin application). (In this example a text layer is used)
  5. Save your work and publish it on a player.

When the button is pressed, the text "Thank you for pressing the button" is displayed on the screen.

Control ioLogik from HMP

Moxa ioLogik E2214 setup

This tutorial shows how to use the Click to Script widget within an interactive project to send CGI commands to the ioLogik device (via its /setParam.cgi interface) for simple output control, like closing a specific relay circuit which could trigger alarm or lights switching.

  • Difficulty: Medium.
  • Total duration: 20 minutes.
    • Moxa IoLogik E22xx (preferably using the latest firmware);
    • An HMP300 or HMP350 (preferably using the latest firmware);

Elementi project

Using Click to Script
  1. Create a new project.
    For more on this subject, see the tutorial My first Elementi project
  2. Drag and drop the Click to Script widget from the Interactive widgets folder.
  3. Drag and drop the javascript file created in the step above from Windows explorer to your project.
  4. Open the "Click to Script" widget
    • Configure the "JavaScript source file" as moxa.js. The content of this file is detailed below.
  5. Open the Mappings tab
    • Add 2 text layers for the two buttons. (Note that you can also use images for instance)
    • For the "ON" button, enter the following javascript code: moxa_set_do({ 0: true });
    • For the "OFF" button, enter the following javascript code: moxa_set_do({ 0: false });
  6. Save your work.
  7. Publish to the HMP300 / HMP350.
Note Note:
You can test the project in Elementi by clicking on the "hand" button within the Preview panel. For more details on this subject, see how to test an interactive project.

Scripting

To control the ioLogik, some custom javascript code need to be used. The code needs to send some commands to the ioLogik device using AJAX.

  1. Open a text file editor (such as notepad++)
  2. Create a file called 'moxa.js
  3. Paste the code bellow into the file.
  4. Save the file on your hard drive.
var ip_address = '172.21.3.170'; // replace by the IP address of the ioLogik

function moxa_set_param( kv ) {
    var url = 'http://' + ip_address + '/setParam.cgi';
    var first = true;
    for ( var k in kv ) {
        if ( first )
            url += '?';
        else
            url += '&';
        url += encodeURIComponent( k ) + '=' + encodeURIComponent( kv[k] );
    }
    if ( url.length > 200 )
        $.warn( 'Maximum MOXA command length exceeded' );
    $.info( 'Sending: ' + url );
    $.ajax( {
        url: url,
        dataType: 'text',
        success: function ( data, textStatus, jqXHR ) {
            $.info( 'Success: ' + jqXHR.status + ' ' + jqXHR.statusText + ' (' + data + ')' );
        },
        error: function ( jqXHR, textStatus, errorThrown ) {
            $.info( 'Error: ' + jqXHR.status + ' ' + jqXHR.statusText + ' (' + errorThrown + ')' );
        }
    } );
}

function moxa_set_do( relays ) {
    var kv = {}, send = false;
    for ( var num in relays ) {
        var n = Number( num );
        if ( isFinite( n ) && n >= 0 ) {
            var name = n.toFixed();
            if ( name.length == 1 )
                name = '0' + name;
            kv['DOStatus_' + name] = relays[num] ? 1 : 0;
            send = true;
        }
    }
    if ( send )
        moxa_set_param( kv );
}


Note Note:
The code above let you send a command to the ioLogik using moxa_set_do(...);.
For instance moxa_set_do({ 0: true }); enables the relay 0 and moxa_set_do({ 0: false }); disables the relay 0.
This page was last modified on 27 October 2023, at 11:59.