Driver-less USB relays (HID interface)
relay2.jpg
relay1.jpg
relay8.jpg

The goal of this project is providing open-source API for several USB HID relay models sold on eBay
(search for "USB Relay Programmable Computer Control For Smart Home").

They sell one, two, eight-channel models; there possibly are also four-channel models.

The device has a status LEDs for each relay, and state of the relays can be read back.

These relays currently have only the API for Windows, only in binary DLL form.

We've discovered the HID commands for the relay and provide source for the Windows DLL, and source for libusb (Linux and whatever else).

The source repository and documentation is on GitHub.

Downloads are on the releases page of the GitHub project.

WHY

Why we are doing this? We've bought some of these relays on eBay, liked them - but need to use them with a Linux machine.
Even for Windows, we prefer that the source is available.

WHY HID?

HID - based interface does not require any drivers to install, and no simulated COM-ports.
It is easy to detect connected devices and address them.
The USB identifiers for these relays conform to the "Free USB-IDs for shared use" document by Objective Development (objdev.at).

LICENSE

The license for the API library is not decided yet, but it won't be GPL. We'd like to make it free from GPL limitations.

FIRMWARE, HARDWARE

No firmware and hardware design is included in this project.

HARDWARE COMPATIBILITY ISSUES

This is possibly because V-USB (or just the models which we have) somehow deviates from the USB electrical spec.
However, Linux 3.x (Ubuntu or Redhat) in our tests always recognises these devices on the same PCs.

Workaround: when connected thru a hub these devices are properly detected.


Details of the device

The HID device name (as returned by a HID descriptor request) is "USBRELAYn" (n=1,2,4,8?).

Every board has an unique "serial number" which can be used to select a device, if several of them are connected to the host.
Note: this is not a standard HID 'serial number'! Both USB and HID 'serial number' string (obtained by HID API) on these devices are null.
On all of our devices, the 'serial number' consists of 5 ASCII characters.

The firmware has only two commands: HID Get Feature and Set Feature, with feature code = 0.
The Set Feature requests sets the relays state, for one or all relays on the board.
The Get Feature request returns the 5-character "serial number" and state of all relays as a bit mask.
Format of these requests can be found in the source.

There possibly is a command to program the "serial number", but we did not find it (actually, not tried).

Our devices have red-colored boards, square USB connectors and are USB-powered only; no external power input.

Other models on eBay (blue-colored) have micro-USB connector, some have serial interface besides of USB, and some have external power connector.

We have not tested on those other models.


All projects on the wiki Objective Development's projects based on V-USB.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License