Overview #
NORVI X is a next generation modular industrial controller designed to power smart automation and IoT solutions. Built around a CPU module and a range of plug and play expansion modules, the platform scales from a handful of I/O points up to 200, giving system integrators, OEMs, and industrial engineers a flexible foundation for automation, remote monitoring, and data acquisition projects.
The NORVI X-R4 is a 4 channel relay output expansion module built for this platform. It provides electrically isolated relay outputs suitable for industrial control, automation, and power switching applications. Relay outputs are controlled through a PCA9538 I2C I/O expander, which keeps the module simple to add without using up extra MCU pins on the CPU module.
The X-R4 is not a standalone device. It needs to be paired with a NORVI X CPU module, such as the CPU ESPS3 X1, to be programmed and operated.
This guide covers everything needed to confidently install, wire, and commission the module, including safety requirements, technical specifications, terminal and address configuration, wiring steps, software setup, diagnostic test code, and troubleshooting.
Key Features #
- 4 electromechanical relay outputs, each with a COM and NO terminal
- Controlled through a PCA9538 I2C I/O expander, so only SCL and SDA are used from the CPU
- Suitable for both AC and DC load switching
- Rated switching current of 5 A per channel, up to 250 V AC or 30 V DC
- Onboard DIP switch for I2C address selection, allowing multiple relay modules on the same bus
- DIN rail mountable enclosure with spring terminals
- Plug and play connection to the CPU module through the expansion bus
- One status LED per input channel
- CE / EMC compliant
Safety Information #
- Install and wire this module only if you are a qualified electrician or trained technician familiar with industrial control equipment.
- Confirm the host CPU is running from a regulated 24 V DC supply.
- Never exceed 250 V AC or 30 V DC, or the rated switching current of 5 A on any channel.
- Mount the module on a DIN rail inside a suitably rated enclosure.
- The module has an IP20 protection rating and is not designed for direct outdoor or wash down exposure.
- Keep the operating environment within minus 40 to plus 85 degrees C and avoid condensing humidity.
- Do not connect or disconnect the module from the expansion bus while the system is powered.
- Follow applicable local and national electrical codes.
Technical Specifications #
Electrical #
| Rated Supply Voltage | 24V DC |
| Current Consumption | 80mA @ 24V DC |
Output Specifications #
| Number of Outputs | 4 x relay outputs |
| Output Type | Single pole normally open relay |
| Isolation Voltage | 750 Vrms between open contacts |
| Rated Switching Voltage | 250 V AC / 30 V DC |
| Maximum Switching Voltage | 277 V AC |
| Rated Switching Current | 5 A |
| Limiting Continuous Current | 5 A |
| Breaking Capacity (max) | 1250 VA (AC) / 750 W (DC) |
| Initial Contact Resistance | 30 mΩ or less (5 VDC, 100 mA) |
| Mechanical Endurance | 10 x 10⁶ operations |
| Power Supply | 24V DC, shared with CPU through the expansion port |
| Communication Bus | Internal expansion bus (I2C) |
| Status Indicators | 4 LED output indicators |
| Connector Type | Spring terminal |
Hardware Layout & GPIO Map #
The table below lists the terminals on the X-R4 and how they map into the PCA9538 port expander. None of the host CPU’s GPIO pins are claimed directly by the relay channels themselves. Only SCL and SDA are shared across the I2C bus.
| Terminal | Function |
|---|---|
| NO1 | Relay 1 normally open |
| COM1 | Relay 1 common |
| NO2 | Relay 2 normally open |
| COM2 | Relay 2 common |
| NO3 | Relay 3 normally open |
| COM3 | Relay 3 common |
| NO4 | Relay 4 normally open |
| COM4 | Relay 4 common |
Each channel is a single pole, normally open contact. To switch a load, wire the load in series between the COM terminal and the field supply, and connect the NO terminal to the load itself so the circuit closes only when that channel is energized.
I2C Address Selection #
The X-R4 connects to the host CPU’s I2C bus using SCL on IO9 and SDA on IO8. DIP switches 3 and 4 are not used for addressing. Set each stacked X-R4 module to a different address so the CPU can communicate with each module individually.

| Address Selection | ||||
|---|---|---|---|---|
| DIP 1 | DIP 2 | DIP 3 | DIP 4 | Address |
| OFF | OFF | × | × | 0x73 |
| ON | OFF | × | × | 0x72 |
| OFF | ON | × | × | 0x71 |
| ON | ON | × | × | 0x70 |
Wiring Guide #
GPIO pin assignments for the I2C bus are listed in the Expansion Port table below. This section covers how to physically wire the module.
Power Connection #
The X-R4 requires no separate power supply. It receives 24V DC from the CPU module through the shared expansion port connector, provided the CPU is powered from a regulated 24V DC source rated at least 1 A.
Relay Output Wiring #
- Each of the four channels is an isolated, normally open contact.
- Connect one side of the field supply to the COM terminal of the channel you are using.
- Connect the load between the NO terminal and the return of the field supply.
- The load receives power only when the relay channel is switched on by the firmware.
- Keep AC and DC wiring runs separated and clearly labeled if the panel uses both.
- Confirm total load current draw stays within the enclosure and supply design limits.

Mounting and Connecting the Module #
- Power off the entire system before touching any wiring or seating the module.
- Mount the X-R4 on the DIN rail next to the CPU module or another expansion module already in the chain, and seat it firmly onto the expansion bus connector.
- The default I2C address is 0x73 with both addressing DIP switches OFF. Leave this setting for a single X-R4. If multiple I2C addressed modules are used, configure each with a unique address.
- Wire the field loads to RO1 through RO4, using the COM and NO terminals. Confirm that the load remains within 5 A, 250 V AC or 30 V DC.
- Power the system back on.
- Upload the module’s test sketch from the NORVI GitHub repository and confirm that each relay channel switches correctly.

Expansion Port (50 pin) #
The X-R4 connects to the CPU through the shared 50 pin expansion bus. The pins used by this module are SCL, SDA, GND, 24V, and 5V. The remaining pins pass through for other expansion modules.
| PIN INDEX | Purpose | GPIO | SOURCE |
|---|---|---|---|
| 1 | MOSI | IO11 | ESP32-S3 |
| 2 | MISO | IO13 | |
| 3 | SCLK | IO12 | |
| 4 | GND | —- | |
| 5 | SCL | IO9 | |
| 6 | SDA | IO8 | |
| 7 | GND | —- | |
| 8 | RX1 | IO18 | |
| 9 | TX1 | IO17 | |
| 10 | GND | —- | |
| 11 | D+ | —- | |
| 12 | D- | —- | |
| 13 | GND | —- | |
| 14 | CS1 | P1_0 | PCA9539 I2C Address 0x75 |
| 15 | CS2 | P0_7 | |
| 16 | CS3 | P0_6 | |
| 17 | CS4 | P0_5 | |
| 18 | IO1 | IO1 | ESP32-S3 |
| 19 | IO2 | IO2 | |
| 20 | IO4 | IO4 | |
| 21 | IO5 | IO5 | |
| 22 | IO6 | IO6 | |
| 23 | IO7 | IO7 | |
| 24 | IO10 | IO10 | |
| 25 | IO11 | IO35 | |
| 26 | IO12 | IO36 | |
| 27 | IO13 | IO37 | |
| 28 | IO14 | IO14 | |
| 29 | RS485_TX | IO15 | |
| 30 | GND | —- | |
| 31 | GND | —- | |
| 32 | RS485_RX | IO16 | |
| 33 | P1_1 | P1_1 | PCA9539 I2C Address 0x75 |
| 34 | P1_2 | P1_2 | |
| 35 | IO21 | IO21 | PCA9538 Reset |
| 36 | GND | —- | |
| 37 | GND | —- | |
| 38 | P1_3 | P1_3 | PCA9539 I2C Address 0x75 |
| 39 | P1_4 | P1_4 | |
| 40 | P1_5 | P1_5 | |
| 41 | IO39 | IO39 | ESP32-S3 |
| 42 | IO40 | IO40 | |
| 43 | NC | —- | |
| 44 | NC | —- | |
| 45 | NC | —- | |
| 46 | GND | —- | |
| 47 | 5V | 5V | |
| 48 | GND | GND | |
| 49 | 24V | 24V | |
| 50 | 24V | 24V |
Software Setup (Arduino IDE) #
The NORVI X-R4 is read through the host CPU using the Arduino IDE with the ESP32 board package. Firmware examples and required libraries are maintained in the NORVI GitHub repository.
Board Configuration #
-
Install Arduino IDE
Install the Arduino IDE and add ESP32 board support:
Tools → Board → Boards Manager → ESP32 -
Connect the Controller
Connect the NORVI X CPU to your computer using the USB interface.
-
Select Board and Port
Configure the board and communication port:
Tools → Board → ESP32 Arduino → ESP32S3 Dev ModuleTools → Port → Select the corresponding COM/serial port

Configure Board Settings #
Under the Tools menu, configure the following settings:

| Setting | Selection |
|---|---|
| USB CDC On Boot | Enabled |
| Flash Size | 16MB (128Mb) |
| PSRAM | QSPI PSRAM |
Test Code Examples #
Required Libraries #
Install these via Arduino IDE → Sketch → Include Library → Manage Libraries before compiling any of the examples below:
- Wire
- WiFi
- SPI
- PCA9538
- TFT_eSPI
- CST816S
- Free_Fonts
Install the Required Library #
Install the Wire library through:
Search for Wire and install it if required.

Open and Upload the Test Sketch #
- Open the X-R4 test sketch from the NORVI GitHub repository .
- Verify the board and port selections.
- Click Upload to upload the test sketch to the NORVI X CPU.
I2C Bus Scan #
Run this first after wiring and setting the DIP switch address to confirm that the PCA9538 on the X-R4 is being detected before testing relay switching.
void I2C_SCAN() {
byte error, address;
int deviceCount = 0;
Serial.println("Scanning...");
for (address = 1; address < 127; address++) {
Wire.beginTransmission(address);
error = Wire.endTransmission();
if (error == 0) {
Serial.print("I2C device found at address 0x");
if (address < 16) {
Serial.print("0");
}
Serial.print(address, HEX);
Serial.println(" !");
deviceCount++;
delay(1);
}
else if (error == 4) {
Serial.print("Unknown error at address 0x");
if (address < 16) {
Serial.print("0");
}
Serial.println(address, HEX);
}
}
if (deviceCount == 0) {
Serial.println("No I2C devices found\n");
}
else {
Serial.println("Scanning complete\n");
}
}Depending on the DIP switch setting, the expected device address is 0x70, 0x71, 0x72, or 0x73.
Relay Toggle Test #
This sequence switches each of the four channels in order through the PCA9538. It can be used to verify the physical relay channel mapping before connecting real loads.
#include <Wire.h>
#define PCA9538_ADDR 0x73
#define PCA9538_OUTPUT_REG 0x01
#define PCA9538_CONFIG_REG 0x03
void setRelayConfig() {
Wire.beginTransmission(PCA9538_ADDR);
Wire.write(PCA9538_CONFIG_REG);
Wire.write(0x00);
Wire.endTransmission();
}
void setRelays(byte state) {
Wire.beginTransmission(PCA9538_ADDR);
Wire.write(PCA9538_OUTPUT_REG);
Wire.write(state);
Wire.endTransmission();
}
void relayTest() {
setRelayConfig();
for (int i = 0; i < 4; i++) {
byte state = 1 << i;
Serial.print("Switching relay ");
Serial.println(i + 1);
setRelays(state);
delay(1000);
}
setRelays(0x00);
}Validating the Full Test Sketch #
When the complete test sketch runs successfully with the X-R4 attached, you should see:
- I2C scan: The PCA9538 appears at the configured address, 0x73 by default.
- Relay outputs: Each of the four channels switches on and off in sequence.
- Display and touch: If the CPU display libraries are included, the TFT initializes and touch input responds.
- No I2C errors: The Serial Monitor shows no failed transmissions or address conflicts.
If a relay does not switch, or the PCA9538 does not appear during the I2C scan, check the expansion connection and DIP switch address before connecting field loads.
Troubleshooting #
| Symptom | Suggested Action |
|---|---|
| Module not detected on I2C scan | Reseat the module on the expansion bus, confirm the DIP switch address does not conflict with another module, and check that the CPU has sufficient power supply current headroom. |
| Relay does not switch despite firmware command | Confirm the I2C address in your sketch matches the DIP switch setting, and rerun the I2C bus scan to confirm the PCA9538 is responding. |
| Relay clicks but load does not switch | Check the load current and voltage against the rated switching limits, and confirm wiring is through both COM and NO. |
| Wrong channel activates | Confirm the register bit order in your firmware matches the physical channel order from RO1 to RO4. |
| Address conflict with another I2C module | Change the DIP switch setting on one of the modules so each I2C device has a unique address. |
| Relay chatters or does not hold | Check for a loose expansion bus connection or insufficient power headroom on the shared 24V supply. |
| System resets unexpectedly under load | Check the CPU power supply current rating, especially when several expansion modules are attached to the same bus. |
| TFT display blank or not working | Check three settings under Tools: USB CDC On Boot set to Enabled, Flash Size set to 16MB (128Mb), and PSRAM set to QSPI PSRAM. |