Skip to content

Minimal Example IP20 EC DI8 DO8

Christian edited this page Mar 5, 2026 · 2 revisions

A complete software walkthrough for the Elrest IP20-EC-DI8-DO8


Table of Contents

  1. Introduction
  2. Requirements
  3. Hardware Setup
  4. Software Setup
  5. Demo
  6. References
  7. Software Architecture

1. Introduction

The IP20-EC-DI8-DO8 Minimal Example demonstrates how to control and monitor digital I/O on a Elrest IP20-EC-DI8-DO8 EtherCAT Fieldbus Controller using the QiTech machine framework.

The device provides:

  • 8 digital outputs (DO1–DO8) — controllable from the dashboard
  • 8 digital inputs (DI1–DI8) — readable in real time

Unlike Beckhoff EtherCAT terminal stacks (which require an EK1100 bus coupler), the Elrest IP20-EC-DI8-DO8 is a standalone EtherCAT device that connects directly to the EtherCAT master.


2. Requirements

Hardware

  • Elrest IP20-EC-DI8-DO8 EtherCAT Fieldbus Controller
    • Vendor ID: 0x741
    • Product ID: 0x117b6722
    • Revision: 0x1
  • 24 V DC power supply
  • Linux PC as EtherCAT master
  • Standard Ethernet cable
  • Wiring tools and appropriate conductors

Software

See Device Example Basics for software prerequisites.


3. Hardware Setup

3.1 Overview

The Elrest IP20-EC-DI8-DO8 combines a fieldbus coupler and I/O in a single unit. It connects directly to your Linux PC via Ethernet and requires a 24 V DC power supply.

3.2 Power Wiring

The device requires 24 V DC on its power terminals. Refer to the official Elrest documentation for the exact terminal layout of your hardware revision.

⚠️ Always disconnect power before wiring. See Device Example Basics for the safe wiring procedure.

3.3 Digital Outputs (DO1–DO8)

The 8 digital outputs switch 24 V DC loads. Connect the load between the corresponding output terminal and the 0 V (GND) reference terminal.

3.4 Digital Inputs (DI1–DI8)

The 8 digital inputs sense 24 V DC signals. Connect the signal source between the corresponding input terminal and the 0 V (GND) reference.

3.5 Ethernet

Use a standard LAN cable to connect your PC directly to the EtherCAT (X1) port of the IP20-EC-DI8-DO8.


4. Software Setup

See Device Example Basics to install and run the software, then return here for the device-specific demo steps.


5. Demo

5.1 Assigning Devices in the Dashboard

Once the backend and frontend are running, the IP20-EC-DI8-DO8 will appear in the device discovery view.

Steps:

  1. Click Assign on the IP20-EC-DI8-DO8
  2. Select IP20 Test V1 as the machine type
  3. Enter a serial number
  4. Click Write

5.2 Using the Control Interface

Navigate to Machines → IP20 Test.

The control page has four panels:

Panel Description
Digital Outputs Toggle each of the 8 outputs (DO1–DO8) individually between On and Off
Digital Inputs Live view of each of the 8 inputs (DI1–DI8), displayed as HIGH or LOW
Master Output Control Turn all 8 outputs On or Off simultaneously

6. References

(SoonTM)


7. Software Architecture

Backend (Rust)

Located in machines/src/ip20_test_machine/.

File Description
mod.rs Defines IP20TestMachine struct; holds 8-element arrays for inputs, outputs, digital input (dins) and output (douts) HAL wrappers
new.rs Initializes the IP20EcDi8Do8 device, creates DigitalInput / DigitalOutput wrappers for all 8 channels
api.rs Handles SetOutput { index, on } and SetAllOutputs { on } mutations; emits StateEvent (outputs) and LiveValuesEvent (inputs) via Socket.IO
act.rs Real-time loop: reads inputs, emits state at 30 Hz, emits live values at 10 Hz

The HAL device driver is located in ethercat-hal/src/devices/wago_modules/ip20_ec_di8_do8.rs.

Frontend (TypeScript/React)

Located in electron/src/machines/ip20testmachine/.

File Description
useIP20TestMachine.ts Custom hook; manages optimistic state and sends SetOutput / SetAllOutputs mutations to the backend
IP20TestMachineControlPage.tsx UI with output toggle controls, live input badges, master on/off, and input summary
ip20TestMachineNamespace.ts Socket.IO namespace handler; updates the Zustand store with incoming StateEvent and LiveValuesEvent messages

Clone this wiki locally