Skip to content

Spidersbox/Relay

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

relay

Control one or more HID API USB relay cards



### Usage

relay [-i] card information
relay [relay number] check the state of the relay.
relay [relay number] [on | off] to set the state of the relay.
relay [relay number] [pulse] to turn on for 10 seconds, then off.

relay [all] returns the state of all relays.
relay [all] [on | off] to set the state of all the relays.
relay [all] [pulse] to turn on all relays for 10 seconds, then off.

Examples

In these examples, I have two relay cards plug into my Banana PI.
Each card has two relays.

  • relay -i
 Device Found
   Type: 16c0 05df
   Path: 0004:0002:00
   Number of Relays = 2
   Device ID: X162W
   relay 1 is OFF
   relay 2 is OFF
  
Device Found Type: 16c0 05df Path: 0002:0002:00 Number of Relays = 2 Device ID: 78J67 relay 3 is OFF relay 4 is OFF
  • relay all
 Relay 1 is OFF
 Relay 2 is OFF
 Relay 3 is OFF
 Relay 4 is OFF
  • relay 3 on
 this does not print out any thing, but if you do 'relay all' again:
 Relay 1 is OFF
 Relay 2 is OFF
 Relay 3 is ON
 Relay 4 is OFF



Installation

The installation procedure is usually perfomed directly on the target system.
Therefore a C compiler and dependencies should already be installed.
Otherwise a cross compilation environment needs to be setup on a PC
(this is not described here).

  • Install dependencies (package names may vary depending on your distribution):
    apt-get install build-essential libhidapi-dev libusb-1.0-0 libusb-1.0-0-dev
  • Build dependencies from source (optional): On some not so recent Linux distributions (like Debian Weezy)
    the HIDAPI library is not yet packaged, so it needs to be build from the source code.
    Follow these instructions to do that:
    apt-get install libudev-dev libusb-1.0-0-dev
    git clone git://github.com/signal11/hidapi.git
    ./bootstrap
    ./configure
    make
    sudo make install
  • Clone Relay git repository :
    git clone https://github.com/Spidersbox/Relay
  • Build :
    cd Relay
    ./build.sh
  • to 'install'
    sudo cp relay /usr/bin/

* to use without sudo:
sudo cp 50relays.rules /etc/udev/rules.d/
sudo reboot




### Credits I would like to give thanks to these people for thier work on their respective projects:

Without thier code, I would still be scratching my head 8]

About

Control one or more HID API USB relay cards

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published