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

In this examples we have connected a Raspberry Pi 4 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 Raspberry Pi OS



3. This example uses Raspberry Pi OS Lite

4. Choose Storage

5. Set hostname, enable ssh (and WiFi credential if needed)

6. Press Save

7. Press Write



ssh pi@bevrlink.local

replace “pi” with the user you wrote in the settings earlier, “bevrlink” with the hostname you wrote earlier. 

Enable i2c


sudo raspi-config

10. Select 3 Interface Options and then  I5 I2C. A prompt will appear asking Would you like the ARM I2C interface to be enabled?, select Yes, press Enter, Press enter to OK and navigate down to <Finish> press Enter and reboot.


 sudo reboot


Install i2c and Python libraries


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


13. test if it works

sudo i2cdetect -y 1


14. Example with chip 9554A used in 4 ch relay


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(1) # Create the i2c bus object

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

# Registers
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))



15. CTRL+C to stop script