summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGoogle Code Exporter <GoogleCodeExporter@users.noreply.github.com>2016-02-18 11:52:47 -0500
committerGoogle Code Exporter <GoogleCodeExporter@users.noreply.github.com>2016-02-18 11:52:47 -0500
commit2e414f1cc59dde19e332cbb62d12eec0c50642b1 (patch)
treea6e42f5713e6b708a6d2c0021becb550e03afc29
downloaddrcontrol-wiki.zip
drcontrol-wiki.tar.gz
Migrating wiki contents from Google Codewiki
-rw-r--r--Install_MacOSX.md101
-rw-r--r--Install_RaspberryPi.md148
-rw-r--r--ProjectHome.md54
-rw-r--r--ReadMe.md187
-rw-r--r--VersionHistory.md19
5 files changed, 509 insertions, 0 deletions
diff --git a/Install_MacOSX.md b/Install_MacOSX.md
new file mode 100644
index 0000000..d1bc299
--- /dev/null
+++ b/Install_MacOSX.md
@@ -0,0 +1,101 @@
+# Introduction #
+
+Instructions how to install the needed libraries and test DRControl utility to control Denkovi USB Relay board.
+
+# Tested on #
+
+ * Mac OSX 10.8+
+ * [Denkovi 4 USB Relay Board](http://denkovi.com/product/44/usb-four-4-relay-output-module-board-for-home-automation.html)
+
+# Be aware #
+
+ * It seems that only way to get the library to communicate with the device is to unload the FTDI kernel extension, it can cause issues if the user have other FTDI devices connected to the system that uses this extension.
+
+# Python Libraries #
+
+There are two libraries that are needed to interface the relay board.
+
+ * Python-FTDI
+ * PyLibFTDI
+
+## Library install ##
+
+To install the additional software I have used [MacPort](http://www.macports.org/), but I guess alternatives like [HomeBrew](http://mxcl.github.com/homebrew/) could be used as well.
+
+Install libFTDI
+
+```
+# sudo port install libftdi
+```
+
+To install the pylibftdi with PIP, if you have PIP already installed you can skip first line.
+
+```
+# sudo easy_install pip
+# sudo pip install pylibftdi
+```
+
+## Library Test ##
+
+To test that the python software is properly installed following command should give you a printout.
+
+```
+# python -m pylibftdi.examples.list_devices
+```
+
+It should list all FTDI devices you have on the system.
+
+Example;
+```
+$ python -m pylibftdi.examples.list_devices
+RFXCOM:RFXtrx433:03VHG0NE
+FTDI:FT245R USB FIFO:A6VV5PHY
+```
+
+## Errors ##
+
+### Error: libftdi library not found ###
+
+[MacPort](http://www.macports.org/) will install the library to the directory /opt/local/lib/ for some reason the Python will not look here for the library. Therefor the system variable DYLD\_LIBRARY\_PATH need to point to this library path for the scripts to work properly.
+
+```
+echo $DYLD_LIBRARY_PATH
+export DYLD_LIBRARY_PATH=/opt/local/lib/
+```
+
+### Error: device not found (-3) ###
+
+If following error occur when the device is accessed
+
+```
+pylibftdi._base.FtdiError: device not found (-3)
+```
+
+It means that the only solution (what I know of) is to unload the FTDI kernel extension, by executing following command;
+
+```
+# sudo kextunload /System/Library/Extensions/FTDIUSBSerialDriver.kext
+```
+
+How to reload the FTDI kernel
+
+```
+# sudo kextload /System/Library/Extensions/FTDIUSBSerialDriver.kext
+```
+
+# DRControl install #
+
+The DRControl does not need that much installation, as it is only one python file that can be executed from user chosen directory. It can be downloaded from download page here, or then fetched directly from the SVN repository.
+
+Download from download page
+
+```
+# wget http://drcontrol.googlecode.com/files/drcontrol.0.1.zip
+# unzip drcontrol.0.1.zip
+```
+
+Or from the SVN directly (Note, that this version might not ve fully tested or working)
+
+```
+# wget http://drcontrol.googlecode.com/svn/trunk/drcontrol.py
+``` \ No newline at end of file
diff --git a/Install_RaspberryPi.md b/Install_RaspberryPi.md
new file mode 100644
index 0000000..11d7343
--- /dev/null
+++ b/Install_RaspberryPi.md
@@ -0,0 +1,148 @@
+# Introduction #
+
+Instructions how to install the needed libraries and test DRControl utility to control Denkovi USB Relay board.
+
+# Tested on #
+
+ * [Raspberry Pi with Raspbian 3.2.27+](http://www.raspberrypi.org/downloads)
+ * Ubuntu 12.04 Desktop via VMWare (on Mac OSX)
+ * [Denkovi 4 USB Relay Board](http://denkovi.com/product/44/usb-four-4-relay-output-module-board-for-home-automation.html)
+
+# Python Libraries #
+
+There are two libraries that are needed to interface the relay board.
+
+ * Python-FTDI
+ * PyLibFTDI, version 0.11 and later
+
+## Library install ##
+
+Install Python-FTDI library, and Python-pip package is needed to install the pyLibFTDI
+
+```
+# sudo apt-get install python-ftdi python-pip
+```
+
+Install the FTDI wrapper PyLibFTDI usinf PIP.
+
+```
+# sudo pip install pylibftdi
+```
+
+## Library Test ##
+
+If you have the relay board connected, then you can run a quick test by entering following command. Note, when you run this after installation and under normal user you might get a error instead of printout.
+
+```
+# python -m pylibftdi.examples.list_devices
+```
+
+Example printout
+
+```
+pi@raspberrypi:~# python -m pylibftdi.examples.list_devices
+FTDI:FT245R USB FIFO:A6VV5PHY
+pi@raspberrypi:~#
+```
+
+Note that this command will list all FTDI devices, so if you have more of them, then it will be listed as well.
+
+## Errors ##
+
+Do you only get following printout when you list the devices;
+
+```
+pi@raspberrypi /opt/drcontrol $ python -m pylibftdi.examples.list_devices
+::
+pi@raspberrypi /opt/drcontrol $
+```
+
+Or if you get Python exception like;
+
+```
+pi@raspberrypi ~ $ python -m pylibftdi.examples.list_devices
+Traceback (most recent call last):
+ File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
+ "__main__", fname, loader, pkg_name)
+ File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
+ exec code in run_globals
+ File "/usr/local/lib/python2.7/dist-packages/pylibftdi/examples/list_devices.py", line 42, in <module>
+ for device in get_ftdi_device_list():
+ File "/usr/local/lib/python2.7/dist-packages/pylibftdi/examples/list_devices.py", line 33, in get_ftdi_device_list
+ for device in Driver().list_devices():
+ File "/usr/local/lib/python2.7/dist-packages/pylibftdi/driver.py", line 158, in list_devices
+ raise FtdiError(self.fdll.ftdi_get_error_string(byref(ctx)))
+pylibftdi._base.FtdiError: error sending control message: Operation not permitted
+pi@raspberrypi ~ $
+```
+
+You can try to run with sudo, and if that works, then you know it is a permission thing.
+
+```
+pi@raspberrypi ~ $ sudo python -m pylibftdi.examples.list_devices
+FTDI:FT245R USB FIFO:A6VV5PHY
+pi@raspberrypi ~ $
+```
+
+Then the normal user (if you are not as root) does not have access to the device, to give access to the device you need to add UDEV rules. Ben Bass has a great instructions regarding this here: [https://pylibftdi.readthedocs.org/en/latest/installation.html](https://pylibftdi.readthedocs.org/en/latest/installation.html)
+
+Here is in short what needs to be done. Note, that I have changed the MODE to 0666, this gives write permission to everyone, this is needed if the script is to be executed via PHP/Apache. At Ben Bass page this is 0660.
+
+```
+pi@raspberrypi ~ $ sudo nano /etc/udev/rules.d/99-libftdi.rules
+```
+
+Add following line to the file and save.
+
+```
+SUBSYSTEMS=="usb", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", GROUP="dialout", MODE="0666"
+```
+
+Check that the file is OK
+
+```
+pi@raspberrypi ~ $ cat /etc/udev/rules.d/99-libftdi.rules
+SUBSYSTEMS=="usb", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", GROUP="dialout", MODE="0666"
+pi@raspberrypi ~ $
+```
+
+Do a reboot.
+
+# DRControl install #
+
+The DRControl does not need that much installation, as it is only one python file that can be executed from user chosen directory. It can be downloaded from download page here, or then fetched directly from the SVN repository.
+
+Download from download page
+
+```
+# mkdir drcontrol
+# cd drcontrol
+# wget http://drcontrol.googlecode.com/files/drcontrol.0.12c.zip
+# unzip drcontrol.0.12c.zip
+```
+
+Example of printing out relay device, and status on all relays
+
+```
+pi@raspberrypi ~/drcontrol $ ./drcontrol.py -l
+Vendor Product Serial
+FTDI FT245R USB FIFO A6VV5PHY
+pi@raspberrypi ~/drcontrol $ ./drcontrol.py -d A6VV5PHY -c state -r all -v
+DRControl 0.12
+Device: A6VV5PHY
+Send command: Relay all (0xFF) to STATE
+Relay 1 state: OFF (0)
+Relay 2 state: OFF (0)
+Relay 3 state: OFF (0)
+Relay 4 state: OFF (0)
+Relay 5 state: OFF (0)
+Relay 6 state: OFF (0)
+Relay 7 state: OFF (0)
+pi@raspberrypi ~/drcontrol $
+```
+
+Or from the SVN directly (Note, that this version might not be fully tested or working)
+
+```
+# wget http://drcontrol.googlecode.com/svn/trunk/drcontrol.py
+``` \ No newline at end of file
diff --git a/ProjectHome.md b/ProjectHome.md
new file mode 100644
index 0000000..1490099
--- /dev/null
+++ b/ProjectHome.md
@@ -0,0 +1,54 @@
+# DRControl #
+
+DRControl is a command utility written in Python and uses the pylibftdi. You can control the Denkovi 4 USB Relay board to set relay on or off.
+
+The 4 USB relay board (DAE-CB/Ro4-USB) uses a FT245RL chipset that uses Synchronous Bit-Bang Mode protocol.
+
+## Info ##
+
+ * The pylibftdi version 0.11 or later is needed, otherwise the previous relay states does go to off when new state is issued.
+ * The only relay board that has been tested is the 4 USB Relay board. Support for the 8 USB Board Relay is added, but not tested.
+
+## News ##
+
+4-JAN-2013
+
+Release 0.12c, small bug fixed with the "ALL" option.
+
+3-JAN-2013
+
+Release 0.12, Fixes to 8 USB Board, and the "ALL" action now works for ON, OFF and STATE.
+Update, version 0.12b replaces the version 0.12 with a important fix.
+
+2-JAN-2013
+
+Small fixes and 0.11 release available.
+
+27-DEC-2012
+
+Release 0.1 is now downloadable, still working on the documentation.
+
+## Latest Release ##
+
+[Version 0.12c (4-JAN-2013)](http://drcontrol.googlecode.com/files/drcontrol.0.12c.zip)
+ * Version 0.12c fixes a bug with the "ALL" option
+
+[Version 0.12b (3-JAN-2013)](http://drcontrol.googlecode.com/files/drcontrol.0.12b.zip)
+ * Version 0.12b fixes a critical bug with checking the correct relay number
+ * Fixes to 8 USB Relay Board
+ * All relays can be adressed with "ALL" for ON, OFF and STATE
+
+## Credits ##
+
+ * Ben Bass (pylibftdi)
+
+## Resources ##
+
+ * USB relay boards from Denkovi [http://denkovi.com](http://denkovi.com)
+ * Python-FTDI from [http://www.ohloh.net/p/python-ftdi](http://www.ohloh.net/p/python-ftdi)
+ * pyLibFTDI wrapper for Python-FTDI [https://bitbucket.org/codedstructure/pylibftdi](https://bitbucket.org/codedstructure/pylibftdi)
+
+## Other Projects ##
+
+ * [RFXCMD](http://code.google.com/p/rfxcmd/), an command line utility to receive and send messages with RFXtrx433 transceiver.
+ * [TempSensor](http://code.google.com/p/usb-sensors-linux/), an utility to read data from Lascar EL-USB-RT temperature/humidity USB sensor. \ No newline at end of file
diff --git a/ReadMe.md b/ReadMe.md
new file mode 100644
index 0000000..1096bde
--- /dev/null
+++ b/ReadMe.md
@@ -0,0 +1,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/>. \ No newline at end of file
diff --git a/VersionHistory.md b/VersionHistory.md
new file mode 100644
index 0000000..2710b7a
--- /dev/null
+++ b/VersionHistory.md
@@ -0,0 +1,19 @@
+# Version History #
+
+## v0.12c (4-JAN-2013) ##
+
+ * Fixes a bug with the "ALL" option (0.12c)
+ * Fixes a critical bug with checking the correct relay number (0.12b)
+ * Fixes to 8 USB Relay Board
+ * All relays can be adressed with "ALL" for ON, OFF and STATE
+
+## v0.11 (2-JAN-2013) ##
+
+ * Pylibftdi library check
+ * Relay commands (-c switch) are now on, off and state
+ * Added support for 8 x USB Board (not available for test)
+ * Tested with pylibftdi version 0.11
+
+## v0.1 (27-DEC-2012) ##
+
+ * First release \ No newline at end of file
OpenPOWER on IntegriCloud