The example below is only one way how to set up the Relay Module.

In this examples we have connected a Rock Pi 4C Plus to the BEVRLink Manager HAT V2 with BEVRLink 4 Channel Relay and 4 manual test buttons 12V. With this relay module board you need the BEVRLink Power Supply 12V 2A

Optional for a safe setup we recommend to use case for both the manager and relay boards: BEVRLink Cases

Install Ubuntu Server for Rock

1. Download the image for your board, this guide assume you download Ubuntu Server for Rock 4C Plus:

2.Use Balena Etcher to flash the image to an SD Card.

5. Insert the SD Card to the Rock and

6. Connect the Rock to Ethernet

 After the board has booted

7. Open a terminal and ssh into it.

ssh rock@rock-4c-plus


Enable i2c


sudo nano /boot/hw_intfc.conf

9. Change intfc:i2c7=off to on to turn on i2c on channel 7 that is used by BEVRLink to communicated with the relay boards.


sudo reboot

Install i2c and Python libraries


sudo apt update
sudo apt install python3-smbus python3-dev i2c-tools

12. Test if i2c works

sudo i2cdetect -y 7

13. Example with chip MCP23008 used in 8 ch relay


sudo nano

Each relay is a bit in the sent byte, so 0x05 converted to binary number 00000101 turns on relay 1,3.

Add a jumper to position 1 on the expander to increase the address to 0x39

Remove or add lines contaning the i2c address for each relay board removed or added

from smbus import SMBus # Import the i2c library
import time # Import time library to use sleep

i2cbus = SMBus(7) # Create the i2c bus object on channel 7

i2caddress_Relay_1 = 0x38 # Address of relay card 1  
i2caddress_Relay_2 = 0x39 # Address of relay card 2 

# Registers for PCA9554A
INREG = 0x00 # Input read register
OUTREG = 0x01 # Output write register    
IOCONF = 0x03 # Configure IO as Input or Output register

# Config 4 first pins as outputs and 4 last as inputs
i2cbus.write_byte_data(i2caddress_Relay_1, IOCONF, 0xF0)
i2cbus.write_byte_data(i2caddress_Relay_2, IOCONF, 0xF0)

while (True): # Loop
    # Read the inputs and copy it to the output
    input1 = i2cbus.read_byte_data(i2caddress_Relay_1, INREG)     
    input2 = i2cbus.read_byte_data(i2caddress_Relay_2, INREG) 
    i2cbus.write_byte_data(i2caddress_Relay_1, OUTREG, ~(input1 >> 4))
    i2cbus.write_byte_data(i2caddress_Relay_2, OUTREG, ~(input2 >> 4)) 

sudo python3


15. CTRL+C to stop script