Cross-platform project for controlling USB relay modules based on HID technology.
Ubuntu | Windows
Clone main project:
git clone https://github.com/nkh-lab/usb-relay-module.git
Clone submodule projects:
git submodule update --init
The following describes how to build and use CLI applications: getrelay
and setrelay
.
If you also want to use GUI application - relaybox
, follow the GUI Application guide.
Install depedencies, e.g. for Ubuntu:
sudo apt-get install libudev-dev
Build:
mkdir build && cd build
cmake ..
make
The following describes how to build the project from the command line for the compiler from Visual Studio.
Add msbuild
to PATH
environment variable if it's unset:
set PATH=%PATH%;<path to msbuild>
Build:
mkdir build && cd build
cmake -G "Visual Studio 17 2022" ..
cmake --build . --config Release
To be able to use the output binaries outside of the project, use the appropriate scripts from the tools folder to build the portable package (build/portable and its archive build/usbrelaymodule-portable.tar.gz), for example for Ubuntu:
./tools/build-portable-linux.sh
These are CLI applications, use --help
command to see usage description.
Example: Get information about detected module
./getrelay
path: /dev/hidraw6
vendor_id: 0x16c0
product_id: 0x05df
serial_number:
release_number: 256
manufacturer: www.dcttech.com
product: USBRelay2
interface_number: 0
module_name: R3
channel_1: 0
channel_2: 0
Example: Set first channel to 1
(ON) then to 0
(OFF) of module R3
./setrelay R3_1=1
...
./setrelay R3_1=0
Example: Rename module R3
to Mod4
./setrelay R3=Mod4
Troubleshooting documentation is available at:
And here is the contents page of all available documentation: