Controlling Relay over USB

I’m considering buying ‘USB Relay with 5 or 10 Amp Relays’ but i’m was hoping to confirm some of my thoughts.

I just want to be able to control the relay with a command from a linux machine ( ubuntu would be nice ). I would essentially just like to be able to turn on and off a specific relay with a simple command, preferably with Ruby.

It seems possible from what i’ve read and the videos i’ve watched but I would love to know if anyone else had luck doing this.

Or if there is a better direction someone could suggest, i’d would love to hear that as well.

Yes, you can control the usb relays using linux machine ( including ubuntu).
for example to turn on a relay you will need to send this command — 254 108 1
and to turn off a relay you will need to send this command — 254 100 1 through a serial port.
All the relay control command docs can be found on the product page under resources.
Let us know if you have any other questions.

Thanks

Awesome Bhaskar! Thanks for your reply. Im going to go ahead and give it a try then!

I’m not having much luck controlling the relay we bought over USB at the moment. We have a SainSmart controller that i’ve managed to get control via CLI. Although it seems really slow.

I’m sure there is a way to get this controller working, but I can’t seem to get it to respond to anything i’ve tried.

Any resources to getting this working would be greatly appreciated. I’ve looked around at some videos and checked the forum with not much luck so far.

I’m trying to using

echo 254 108 1 > /dev/ttyUSB0

But it seems to show tx and then nothing happens.

what tis the communication baudrate ?
the default baudrate is 115200, does the TX led blinks when you send command on usb module and the relay board.

here is a python lib which might be helpful

product docs can be found here

Thanks

Hey @Bhaskar, thanks for the help!

I managed to get a ruby script working to control the relays. I haven’t setup any of the Analog Detection, but you can control a relay one at a time.

If anyone wants to see it, I just copied as much logic as I could from NCD’s python version ( python2, python3 throws a error BTW )

1 Like