Skip to content

Instantly share code, notes, and snippets.

@agutenkunst
Last active May 27, 2021 06:56
Show Gist options
  • Save agutenkunst/0594cbde6fd85b367028600e2f30559d to your computer and use it in GitHub Desktop.
Save agutenkunst/0594cbde6fd85b367028600e2f30559d to your computer and use it in GitHub Desktop.
Controlling USB-Relay using Ubuntu

Controlling an USB-Relay using Ubuntu

Hardware

https://www.amazon.de/ARCELI-SRD-05VDC-SL-C-Relais-Modul-Kostenloser-Intelligent/dp/B07JL4YB8R

Software

  • Tested with Ubuntu 20

Requirements

sudo apt install usbrelay

Usage

Read the state

sudo usbrelay

which will output something like

Device Found
  type: 16c0 05df
  path: /dev/hidraw0
  serial_number: 
  Manufacturer: www.dcttech.com
  Product:      USBRelay2
  Release:      100
  Interface:    0
  Number of Relays = 2
1_1=0
1_2=0

Set the state

Use the information obtained by getting the state to set the variables (in this case 1_1 and 1_2, I saw these be different initially, not sure why)

To enable relay 1 do

sudo usbrelay 1_1=1

Further information and more detailed usage

https://github.com/darrylb123/usbrelay

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment