GPIO (General Purpose Input/Output)

Integrates GPIO (General Purpose Input/Output) ports into OpenEMS for digital input and output control on ARM-based single-board computers using Linux filesystem communication.

Overview

This bundle provides integration for GPIO (General Purpose Input/Output) ports available on ARM-based computing platforms. The component communicates with GPIO ports via Linux filesystem interfaces (/sys/class/gpio), enabling digital input and output control for automation and IoT applications.

The GPIO integration supports multiple hardware platforms, with primary focus on ModBerry X500 CM4 models based on the Raspberry Pi Compute Module 4. The component provides dynamic GPIO pin discovery and management, with configurable input and output channels for flexible system integration.

All GPIO operations are performed through the Linux kernel GPIO subsystem, providing reliable and standardized access to GPIO pins across compatible hardware platforms.

Supported Devices

Components

This bundle implements the following OpenEMS Component:

IO GPIO

Name: IO GPIO

Factory-PID: io.openems.edge.io.gpio

Implemented Natures/Interfaces
  • DigitalInput

  • DigitalOutput

  • OpenemsComponent

Configuration Parameters
  • id (String): Component ID for unique identification (default: "io0")

  • alias (String): Human-readable alias for the component

  • enabled (Boolean): Enable/disable this component (default: true)

  • gpioPath (String): Path to the GPIOs on the Linux filesystem (default: "/sys/class")

  • hardwareType (HardwareType): The hardware platform type (required) - Supported values: MODBERRY_X500_M40804_MAX, MODBERRY_X500_M40804_WB, MODBERRY_X500_M4S, MODBERRY_X500_M4S_F, MODBERRY_X500_M3

Hardware Platform Information

ModBerry X500 CM4 Models

The module supports all ModBerry X500 CM4 models. Each variant provides different features and form factors:

  • M40804 Max: Full-sized Compute Module 4 with maximum GPIO availability

  • M40804 WB: Compute Module 4 with integrated WiFi and Bluetooth connectivity

  • M4S: Compact form factor variant of Compute Module 4

  • M4S-F: Fanless compact variant for passive cooling environments

  • M3: Legacy support for Compute Module 3 (older generation)

Pin-out descriptions and GPIO mappings are available in the ModBerry documentation: ModBerry X500 CM4 Datasheet

Prerequisites / Dependencies

System Requirements

  • Linux-based operating system with GPIO support (kernel 4.8 or later)

  • Proper GPIO kernel module loaded (gpio-bcm2835 on Raspberry Pi)

  • File system access to /sys/class/gpio directory (typically requires root or GPIO group permissions)

  • ARM-based processor (Raspberry Pi Compute Module 3 or 4)

Hardware Setup

  1. Ensure the GPIO kernel module is loaded: lsmod | grep gpio

  2. Verify GPIO filesystem is accessible: ls /sys/class/gpio

  3. Configure appropriate user permissions for GPIO access:

    • Option 1: Run OpenEMS as root user

    • Option 2: Add OpenEMS user to gpio group: usermod -a -G gpio openems

    • Option 3: Configure udev rules for GPIO device access

  4. Identify the correct hardware type from your ModBerry platform documentation

  5. Connect GPIO devices (LEDs, switches, sensors, etc.) to appropriate GPIO pins

GPIO Path Configuration

The default GPIO path /sys/class/gpio is appropriate for standard Linux GPIO access. Alternative paths may be used for:

  • Non-standard GPIO implementations

  • Custom GPIO virtualization layers

  • Testing and simulation environments