Get Started With BEVRLink 8 Channel Relay - Raspberry PI Manager Python

Get Started With BEVRLink 8 Channel Relay - Raspberry PI Manager Python

Reading Get Started With BEVRLink 8 Channel Relay - Raspberry PI Manager Python 3 minutes Next Get Started With BEVRLink 4 Channel Relay with 4 Inputs - Raspberry PI Manager Python

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 8 Channel Relay V1 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 0x55 converted to binary number 01010101 turns on relay 1,3,5 and 7

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

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 = 0x20 # Address of relay card 1  
i2caddress_Relay_2 = 0x21 # Address of relay expansion card 

# Registers
INREG = 0x09 # Input read register
OUTREG = 0x0A # Output write register    
IOCONF = 0x00 # Configure IO as Input or Output register

# Config all pins as outputs
i2cbus.write_byte_data(i2caddress_Relay_1, IOCONF, 0x00)
i2cbus.write_byte_data(i2caddress_Relay_2, IOCONF, 0x00)

while (True): # Loop
    # Turn on half the relays
    i2cbus.write_byte_data(i2caddress_Relay_1, OUTREG, 0x55) 
    i2cbus.write_byte_data(i2caddress_Relay_2, OUTREG, 0x55) 
    time.sleep(1) # Wait 1 second
    # Turn on the other half
    i2cbus.write_byte_data(i2caddress_Relay_1, OUTREG, 0xAA) 
    i2cbus.write_byte_data(i2caddress_Relay_2, OUTREG, 0xAA) 
    time.sleep(1) # Wait 1 second


15. CTRL+C to stop script