I/O Configuration¶
The I/O Configuration panel lets you select and configure hardware I/O providers for each engine context. Open it from Tools > I/O Configuration or the Tools toolbar.
I/O Providers¶
PiPLC supports multiple I/O providers through a plugin architecture. Providers are either built-in (static) or loaded at runtime (dynamic plugins).
| Provider | Type | Platform | Description |
|---|---|---|---|
| Virtual | Built-in | All | Software simulation with configurable input/output counts |
| GPIO | Built-in | Linux | Generic libgpiod-based GPIO mapping with board descriptors |
| Explorer HAT Pro | Plugin | Linux (RPi) | Pimoroni Explorer HAT Pro with fixed hardware mapping |
| Modbus TCP Client | Plugin | All | Modbus TCP client for connecting to Modbus devices |
| Composite | Built-in | All | Combines multiple providers for simultaneous use |
Configuring a Provider¶
- Open Tools > I/O Configuration
- Select a provider from the Provider dropdown
- Configure provider-specific settings (pin mappings, connection details, etc.)
- Click Apply to activate the configuration
Each context can have its own independent I/O configuration. Switching contexts in the IDE switches the displayed I/O configuration.
Virtual Provider¶
The default provider for development and testing. Configures in-memory simulation with:
- Input count — number of simulated input bits
- Output count — number of simulated output bits
Use the Simulation Panel to toggle virtual inputs and force values during runtime.
GPIO Provider¶
Maps PLC addresses to physical GPIO pins via libgpiod. Requires Linux with /dev/gpiochipN access.
- Configure digital pins with GPIO line number, direction, active-low, and bias settings
- Configure analog channels with ADC/DAC channel, scaling, and N: region mapping
- Optional board descriptor for predefined pin layouts
Explorer HAT Pro¶
Fixed hardware mapping for the Pimoroni Explorer HAT Pro on Raspberry Pi:
- 4 digital inputs, 4 digital outputs (ULN2003A), 4 LEDs
- 8 capacitive touch channels (CAP1208): 4 touch pads + 4 crocodile clips
- 4 analog input channels (ADS1015 ADC)
- 2 motor outputs with PWM speed control (DRV8833)
No pin configuration required — the hardware mapping is fixed. See the Explorer HAT Pro Guide for details.
Modbus TCP Client¶
Connects to external Modbus TCP servers to map Modbus registers to PLC addresses:
- Host, port, unit ID, timeout, and poll interval settings
- Discrete input mappings (FC02) to
I:region - Coil mappings (FC01/05/15) to
O:region - Input register mappings (FC04) to
N:region - Holding register mappings (FC03/06/16) to
N:region
See the Modbus TCP Guide for configuration examples.
Composite I/O Provider¶
The Composite I/O provider combines multiple providers to run simultaneously, enabling mixed hardware configurations.
Use Cases¶
- Virtual + GPIO: Simulate some I/O while using real hardware for others
- GPIO + Modbus TCP: Control local GPIO pins and remote Modbus devices from the same PLC program
- Explorer HAT Pro + Modbus TCP: Use the HAT's physical I/O alongside networked Modbus devices
Address Claim System¶
Each child provider in a composite configuration claims specific PLC addresses. The address claim system prevents conflicts:
- Input bits (
I:region) — each provider claims specific word/bit pairs - Output bits (
O:region) — each provider claims specific word/bit pairs - Analog input words (
N:region) — each provider claims specific word indices - Analog output words (
N:region) — each provider claims specific word indices
If two providers attempt to claim the same address, a conflict is reported and the configuration is rejected.
How It Works¶
During each scan cycle:
- Read inputs: Each child provider's claimed
I:bits are read and overlaid into a unified input buffer - Write outputs: The full
O:vector is distributed to all children (each provider reads only its owned positions) - Read analog inputs:
N:values from all children are merged by claimed word index - Write analog outputs: Values are routed to the correct child provider based on address claims
Configuring Composite I/O¶
- Select Composite from the Provider dropdown in the I/O Configuration panel
- Click Add Provider to add child providers
- Configure each child provider individually
- Address claims are validated automatically — conflicts are flagged before you can apply
The configuration is fully serialized with the project in a backward-compatible format.
CSV Import/Export¶
The I/O Configuration panel supports CSV import and export for bulk editing of pin mappings:
[DigitalPins]
gpioLine,direction,activeLow,bias,plcWord,plcBit,label
17,Input,false,PullDown,0,0,Start Button
22,Output,false,Disabled,0,0,Motor Relay
[AnalogChannels]
channel,direction,plcNWord,rawMin,rawMax,scaledMin,scaledMax,label
0,Input,10,0,4095,0,10000,Temperature Sensor
Configuration Files¶
I/O configurations are saved as .ioconfig JSON files, independent of project files. This allows the same ladder program to run with different hardware configurations.
See the File Formats reference for the full .ioconfig schema.
See Also¶
- Virtual Simulation — using the simulation panel with virtual I/O
- Explorer HAT Pro Guide — hardware setup for Explorer HAT Pro
- Modbus TCP Guide — Modbus client/server configuration
- Deployment Modes — headless engine with I/O configuration