Skip to content

Bottlecaps Example Machine

Ingo Reitz edited this page Apr 17, 2026 · 1 revision

Hardware + Software Walkthrough


Table of Contents

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

1. Introduction

This example machine combines combines a WAGO 750-671 Stepper Controller with an Elrest IP20-EC-DI8-DO8 EtherCAT Fieldbus Controller to sort bottle caps by color.

While the Stepper Motor powers a conveyor belt, the inputs will be powered by an external algorithm, such as imaging AI, to determine if a bottlecap with the right color is at the right position. Powering an Inputs will simply set the corresponding output to HIGH to be used with, for example, pressured air to sort the bottle cap.


2. Requirements

Hardware

  • 24 V DC power supply, for example WAGO 2787-2144
  • WAGO 750-354 EtherCAT Coupler
  • WAGO 750-602 EtherCAT Power Terminal
  • WAGO 750-671 (alternatively 750-672) EtherCAT Stepper Controller Terminal
  • WAGO 750-600 EtherCAT End Module
  • Elrest IP20-EC-DI8-DO8 EtherCAT Fieldbus Controller
  • Linux PC as EtherCAT master
  • Standard Ethernet cables
  • Wiring tools and appropriate conductors

Software

See Device Example Basics for software prerequisites.


3. Hardware Setup

⚠️ Always disconnect power before wiring. See Device Example Basics for the safe wiring procedure.
Ensure motor power voltage does not exceed the rated maximum for your terminal model.

3.1 Stepper

See Hardware Setup of Wago 750-671 and 750-672 on how to set up the stepper motor with WAGO 750-354, 750-602, 750-671 and 750-600.

3.2 IP20-EC-DI8-DO8

See Hardware Setup of Elrest IP20-EC-DI8-DO8

3.3 Ethernet

Use standard LAN cables to connect your PC to the EtherCAT X1 port of the WAGO 750-354. Connect the IP20-EC-DI8-DO8 to the 750-354 EtherCAT X2 Port.

Picture of the setup on a test bench


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, you should see:

  • 750-354 (Coupler)
  • 750-671 (Stepper Controller Terminal)
  • IP20-EC-DI8-DO8

Steps:

  1. Click Assign on the IP20-EC-DI8-DO8
  2. Select Bottlecaps Example V1 as the machine type
  3. Enter a serial number
  4. Click Write
  5. Repeat for the 750-354 using the same serial number

5.2 Using the Control Interface

Navigate to Bottlecaps Example on the left.

The control page has five panels:

Panel Description
Digital Inputs Live view of each of the 8 inputs (DI1–DI8), displayed as HIGH or LOW
Input Overrides Overrides for each of the 8 inputs to force the corresponding output to ON
Stepper Speed Control the stepper motor speed
Frequency Prescaler Control the Frequency Prescaler
Acceleration Factor Control the Acceleration

6. References

To do


7. Software Architecture

Backend (Rust)

Located in machines/src/bottlecaps_test_machine/.

File Description
mod.rs Defines BottlecapsTestMachine 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 mutations; emits StateEvent via Socket.IO
act.rs Real-time loop: reads inputs, emits state

Frontend (TypeScript/React)

Located in electron/src/machines/bottlecaps_test_machine/.

File Description
useBottlecapsTestMachine.ts Custom hook; manages optimistic state and sends mutations to the backend
BottlecapsTestMachineControlPage.tsx UI with toggle controls, live input badges, input summary and stepper motor controls
BottlecapsTestMachineNamespace.ts Socket.IO namespace handler; updates the Zustand store with incoming StateEvent messages

Clone this wiki locally