blob: 1096bde951240501bada2e74c563479dc22aa6b2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
|
## DESCRIPTION ##
DRControl is Python script that controls the USB Relay board from Denkovi http://www.denkovi.com.
## REQUIREMENTS ##
* Python 2.6+
* Tested on Raspberry Pi with Python 2.6
* Tested on Mac OSX 10.8.2 with Python 2.7.2
* Tested on Ubuntu 12.04 Desktop (via VMWare)
* Denkovi 4 USB Relay Board, product code DAE-CB/Ro4-USB
## NOTES ##
* The DRControl will always show all 8 relays even if the connected board is an 4 USB Relay Board. There is no way at the current time to identify if the board is 4 or 8 USB Relay Board.
## DRCONTROL.PY ##
Options;
|-d|Device|
|:-|:-----|
|-r|Relay number|
|-s|Relay state|
|-l|List all available FTDI devices|
|-v|Verbose, print status and information on stdout|
### Device (-d) ###
---
```
option -d <device serial number>
```
Address the relay board with the serial number of the FTDI device, this can be listed with the "-l" (list) switch.
Example below is two devices listed, the "FT245R USB FIFO" is the relay board (4 x USB Board) which is then used the serial "A6VV5PHY" to show the state of the relay 1.
```
$ ./drcontrol.py -l
Vendor Product Serial
RFXCOM RFXtrx433 03VHG0NE
FTDI FT245R USB FIFO A6VV5PHY
$ ./drcontrol.py -d A6VV5PHY -r 1 -c state
ON
$
```
### Relay (-r) ###
---
```
option -r <1..8|all>
```
Needed in to address which relay is going to be commanded.
"ALL" can be used to send the command to all relays. Command is not case sensitive.
Example;
```
$ ./drcontrol.py -d A6VV5PHY -r ALL -c state -v
DRControl 0.12
Device: A6VV5PHY
Send command: Relay all (0xFF) to STATE
Relay 1 state: ON (2)
Relay 2 state: ON (8)
Relay 3 state: ON (32)
Relay 4 state: ON (128)
Relay 5 state: ON (4)
Relay 6 state: ON (16)
Relay 7 state: ON (64)
$
```
### Relay Command (-c) ###
---
```
option -c <on|off|state>
```
Options: on, off, state
ON = To set the relay ON
OFF = To set the relay OFF
STATE = To show the current state of the relay
Command is not case sensitive
Examples;
```
$ ./drcontrol.py -d A6VV5PHY -r 1 -c state
ON
$ ./drcontrol.py -d A6VV5PHY -r 1 -c off
$ ./drcontrol.py -d A6VV5PHY -r 1 -c state
OFF
$ ./drcontrol.py -d A6VV5PHY -r 1 -c on
$ ./drcontrol.py -d A6VV5PHY -r 1 -c state
ON
$
```
### List devices (-l) ###
---
```
option -l
```
List all FTDI devices on the system.
Example;
```
$ ./drcontrol.py -l
Vendor Product Serial
RFXCOM RFXtrx433 03VHG0NE
FTDI FT245R USB FIFO A6VV5PHY
$
```
### Verbose (-v) ###
---
```
option -v
```
Give verbose printouts of all commands.
Example;
```
$ ./drcontrol.py -d A6VV5PHY -r 1 -c state -v
DRControl 0.11
Device: A6VV5PHY
Send command: Relay 1 (0x2) to STATE
Relay 1 state: ON (2)
$ ./drcontrol.py -d A6VV5PHY -r 1 -c off -v
DRControl 0.11
Device: A6VV5PHY
Send command: Relay 1 (0x2) to OFF
Relay 1 to OFF
$ ./drcontrol.py -d A6VV5PHY -r 1 -c state -v
DRControl 0.11
Device: A6VV5PHY
Send command: Relay 1 (0x2) to STATE
Relay 1 state: OFF (0)
$
```
---
## INFO ##
The USB 4 relay board is a product from [Denkovi Assembly Electronics ltd](http://denkovi.com/)
---
## COPYRIGHT ##
Copyright (C) 2012 Sebastian Sjoholm
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
|