Hi GEECAB!
I agree it doesn't look that simple, I found comments on their manufacturer's website (
https://www.sainsmart.com/products/8-channel-12v-usb-relay-module#idTab3) with examples like below:
Python code to help get started :
import serial
import time
# how to use python for this
# documentation is a bit misleading for this. This is how I got it to work.
usbrelay = [
[bytearray([0xff, 0x01, 0x00]), bytearray([0xff, 0x01, 0x01])], # channel-0
[bytearray([0xff, 0x02, 0x00]), bytearray([0xff, 0x02, 0x02])], # channel-1
[bytearray([0xff, 0x03, 0x00]), bytearray([0xff, 0x03, 0x03])], # channel-2
[bytearray([0xff, 0x04, 0x00]), bytearray([0xff, 0x04, 0x04])], # channel-3
[bytearray([0xff, 0x05, 0x00]), bytearray([0xff, 0x05, 0x05])], # channel-4
[bytearray([0xff, 0x06, 0x00]), bytearray([0xff, 0x06, 0x06])], # channel-5
[bytearray([0xff, 0x07, 0x00]), bytearray([0xff, 0x07, 0x07])], # channel-6
[bytearray([0xff, 0x08, 0x00]), bytearray([0xff, 0x08, 0x08])], # channel-7
[bytearray([0x00]), bytearray([0xff])], # all channels
]
# fun fact, you can just write a bitmask in place of this to command custom channel combos in 1 write instruction
def get_bit_mask(channels : list):
mask = 0x00
for value in channels:
mask |= value
return bytearray(mask)
serial_port = serial.Serial(
'COM13',
9600
)
# first index is channel, 2nd is on/off (0 or 1
channel=0
global_channel=8
off_on=1
serial_port.write(usbrelay[channel][off_on])
# serial_port.write(usbrelay[global_channel][off_on]) # command all
# serial_port.write(get_bit_mask([ 1, 3, 5, 7])) # turn on all odds
time.sleep(1) # wait before closing serial port
serial_port.close()
and for the record,
I don't have a PowerShell command, all this is done via a small software (USB 8 Relay Manager v.1.4) from the manufacturer to be able to power this or that relay
I couldn't connect it because the card is delivered without cord....
I ordered it and I receive it on Wednesday
If too complicated I can return the card it's on amazon no worries and if you can then direct me to another relay card no worries knowing that you shouldn't use the CH340 driver for hardware conflict (because of my steering wheel)
Looking forward to reading you
big thank you GEECAB!!