Get the FREE Ultimate OpenClaw Setup Guide →

industrial

npx machina-cli add skill beriberikix/zephyr-agent-skills/industrial --openclaw
Files (1)
SKILL.md
2.3 KB

Zephyr Industrial Protocols

Build robust, industry-standard communication systems using Zephyr's modular industrial protocol stacks.

Core Workflows

1. Modbus RTU (Serial)

Implement serial-based industrial communication for meters, PLCs, and sensors.

  • Reference: modbus_rtu.md
  • Key Tools: CONFIG_MODBUS, RS-485 DE/RE handling, Register Mapping.

2. Modbus TCP

Bridge industrial data over standard Ethernet or Wi-Fi networks.

  • Reference: modbus_tcp.md
  • Key Tools: Port 502, TCP/IP networking, Client/Server patterns.

3. CANopen Basics

Integrate with complex automation networks using the CANopenNode stack.

  • Reference: canopen_basics.md
  • Key Tools: Object Dictionary (OD), PDO/SDO, Network Management (NMT).

Quick Start (Modbus RTU Server)

# prj.conf
CONFIG_MODBUS=y
CONFIG_MODBUS_SERIAL=y
// Initialize a server on a serial device
const struct device *dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_modbus_serial));
struct modbus_iface_param param = {
    .mode = MODBUS_MODE_RTU,
    .server = { .node_addr = 1, .cb = &my_callbacks },
    .serial = { .baud = 115200, .parity = UART_CFG_PARITY_NONE },
};
modbus_init_server(dev, param);

Professional Patterns (Reliability & Safety)

  • RS-485 Hardware Handling: Always use the devicetree uart-rs485 property to handle transceiver direction signals automatically at the driver level.
  • Isolated Communication: Use galvanically isolated transceivers for both serial and CAN lines in factory environments to prevent damage from ground loops.
  • Watchdog Integration: In industrial control, always pair your communication loops with the watchdog_reliability pattern (see specialized skill) to ensure the system enters a fail-safe state on protocol lockup.

Resources

  • References:
    • modbus_rtu.md: Serial Modbus master/slave setup.
    • modbus_tcp.md: Ethernet Modbus client/server patterns.
    • canopen_basics.md: Object Dictionary and PDO mapping.

Source

git clone https://github.com/beriberikix/zephyr-agent-skills/blob/main/skills/industrial/SKILL.mdView on GitHub

Overview

This skill provides Zephyr-based implementations of industrial communication stacks. It covers Modbus RTU over serial, Modbus TCP over Ethernet/Wi-Fi, and CANopen basics, helping you connect meters, PLCs, sensors, and automation equipment reliably.

How This Skill Works

The skill uses Zephyr's modular protocol stacks. Modbus RTU runs over serial with RS-485 control via DE/RE; Modbus TCP uses standard TCP/IP client/server patterns over Ethernet or Wi-Fi; CANopen basics leverage the CANopenNode stack with an Object Dictionary, PDO/SDO, and Network Management.

When to Use It

  • Deploy Modbus RTU to connect meters, PLCs, and sensors over RS-485.
  • Expose data over Modbus TCP for Ethernet/Wi-Fi networks in SCADA setups.
  • Integrate CANopen networks for complex automation using OD, PDO/SDO, and NMT.
  • Ensure isolated communication with galvanic isolation and robust fault handling.
  • Build medical equipment interfaces requiring robust, standards-based industrial links.

Quick Start

  1. Step 1: Enable Modbus in prj.conf (CONFIG_MODBUS=y, CONFIG_MODBUS_SERIAL=y).
  2. Step 2: Initialize a Modbus RTU server on a serial device (set mode RTU, node_addr, and callbacks).
  3. Step 3: Build and test against a Modbus master, verify addresses and data exchange.

Best Practices

  • Use the UART RS-485 DE/RE control (uart-rs485) in the device tree to automate transceiver direction signals.
  • Implement galvanic isolation on serial and CAN lines in factory environments to prevent ground loops.
  • Pair communication loops with the watchdog_reliability pattern to ensure fail-safe behavior on protocol lockup.
  • Document Modbus registers and CANopen Object Dictionary mappings clearly; maintain a consistent address space.
  • Refer to and reuse patterns from references/modbus_rtu.md, references/modbus_tcp.md, and references/canopen_basics.md for reliable implementations.

Example Use Cases

  • Factory automation controller using Modbus RTU to talk to meters and PLCs.
  • Industrial sensors reporting data over Modbus RTU to a centralized controller.
  • Modbus TCP bridge exposing field devices to a SCADA system over Ethernet/Wi-Fi.
  • CANopen-based automation network across a production line.
  • Medical equipment interface requiring robust, standards-based industrial communication.

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers