{"id":40,"date":"2014-06-20T17:23:17","date_gmt":"2014-06-20T14:23:17","guid":{"rendered":"http:\/\/www.bashpi.org\/?page_id=40"},"modified":"2020-12-03T17:34:01","modified_gmt":"2020-12-03T15:34:01","slug":"how-to-get-byvac-bv4627-relay-controller-working-with-bash","status":"publish","type":"page","link":"https:\/\/www.bashpi.org\/?page_id=40","title":{"rendered":"How to get  ByVac BV4627 relay controller working with bash (intro)"},"content":{"rendered":"<p><strong>This how-to has multiple pages.&nbsp;This page is introduction, to prove its working.<br \/>\n<\/strong><\/p>\n<p>Check also theory behind why relays and why this BV4627 in <a title=\"Relays\" href=\"http:\/\/www.bashpi.org\/?page_id=26\">here<\/a>.<\/p>\n<ul>\n<ul>\n<li>If you want to get ByVac BV4627 relay controller\/board working, start with logging in to your Raspberry Pi or to your linux PC. You should know how to do it by now.<\/li>\n<li>As in this stage we do not care about any security, switch ASAP to root user with following command:<\/li>\n<\/ul>\n<\/ul>\n<pre><code class=\"language-bash\">sudo su -\n<\/code><\/pre>\n<ul>\n<li>Plug in BV4627 relay-controller to USB port. If you are using Raspberry Pi, <a title=\"How to choose powered USB hub\" href=\"http:\/\/www.bashpi.org\/?page_id=377\">you should use powered USB hub<\/a> and plug it there not directly to RPi! Most probably this&nbsp;BV4627 board can get enough power also when plugged directly to RPi USB port but I am not taking that risk.&nbsp; If you want to experiment plug it in directly to RPi and start turning relays on one by one to increase power consumption.<\/li>\n<li>BV4627 is using FT232 USB-Serial interface and after you have plugged it in and run command:<\/li>\n<\/ul>\n<pre><code class=\"language-bash\">lsusb\n<\/code><\/pre>\n<ul>\n<li>&#8230;.you should be able to find it in the list:<\/li>\n<\/ul>\n<blockquote><p>Bus 001 Device 008: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC<\/p><\/blockquote>\n<ul>\n<li>Now check what is the device name what &#8220;magically appeared&#8221;. For that run command:<\/li>\n<\/ul>\n<pre><code class=\"language-bash\">ls -lrt \/dev\/ttyUSB*\n<\/code><\/pre>\n<ul>\n<li>Output should be something following, at least by default on RPi:<\/li>\n<\/ul>\n<blockquote><p>crw-rw&#8212;T 1 root dialout 188, 0 Jun 21 09:13 \/dev\/ttyUSB0<\/p><\/blockquote>\n<ul>\n<li>If you have multiple devices, take the last (bottom) one. Above example has only one: <strong>\/dev\/ttyUSB0<\/strong><\/li>\n<\/ul>\n<p>Now its time to create two scripts. You can use editor <em>nano&nbsp;<\/em>for that or <em>vi<\/em> or something else. I don&#8217;t care how you do that. Plenty of vi\/nano how-to&#8217;s in the net. Where were we&#8230;. yeah two scripts&#8230;.lets name them relay_service.sh and relay.sh .<\/p>\n<p><strong>In first script change device name if your device is not \/dev\/ttyUSB0 ! (SERIALDEVICE variable)<br \/>\n<\/strong><\/p>\n<ul>\n<li><strong>relay_service.sh<\/strong>&nbsp;&#8211; save following code to that file<\/li>\n<\/ul>\n<pre><code class=\"language-bash\">#!\/bin\/bash\n\n# this script generally starts connection with relayboard and forwards commands\n# Argo Ellisson 2014, BashPi.org, usage licence: GNU General Public License (GPL) Version 3\n# version 1.1\n\n\n# this device should have been created by udev rule - following symlink should exist and point to ttyUSB0 or something else\nSERIALDEVICE=\"\/dev\/ttyUSB0\"\n\n# file for passing commands to relays - created in ramdisk for performance reasons\nCOMMANDFILE=\"\/dev\/shm\/relaycommands.lst\"\n\n# cycle to try keep things running - not essential\nwhile [ true ]; do\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # what code below generally does is that it configures serialdevice using stty and then forwards there all commands what will be written to COMMANDFILE\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # check does SERIALDEVICE exist\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if [ -c ${SERIALDEVICE} ]; then\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # configure serialdevice\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # these parameters may change if different device is used. \n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # Speed 9600 is enough for relayboard\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; stty -F ${SERIALDEVICE} 9600 -parenb -parodd cs8 hupcl -cstopb cread clocal -crtscts ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl -ixon -ixoff -iuclc -ixany -imaxbel -iutf8 -opost -olcuc -ocrnl -onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0 -isig -icanon -iexten -echo -echoe -echok -echonl -noflsh -xcase -tostop -echoprt -echoctl -echoke\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # open serialdevice for writing and assign file descriptor 3 to it\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exec 3&gt;${SERIALDEVICE}\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # could be opened also for reading as below in case we want some feedback from relayboard. Not in current scope.\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # exec 3&lt;&gt;${SERIALDEVICE}\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # send few Carriage Returns \/ CR-s to serialdevice to initiate connection\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # this is optional step but we are not taking any chances\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo -en \"\\xD\" &gt;&amp;3\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sleep 2\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo -en \"\\xD\" &gt;&amp;3\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sleep 2\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo -en \"\\xD\" &gt;&amp;3\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sleep 2\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # set up commandfile - this is what we use to get commands from one or many other scripts\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo -en \"\\xD\" &gt; ${COMMANDFILE}\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; chmod 666 ${COMMANDFILE}\n&nbsp; &nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # tail commandfile and redirect results to file descriptor 3 which is serialdevice\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; tail -f ${COMMANDFILE} &gt;&amp;3\n&nbsp; &nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # close file descriptor if tail exits\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exec 3&lt;&amp;-\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo \"${SERIALDEVICE} does not exist or is not character device\"\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fi\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sleep 60\n\ndone\n<\/code><\/pre>\n<ul>\n<li><strong>relay.sh<\/strong> &#8211; save following code to that file<\/li>\n<\/ul>\n<pre><code class=\"language-bash\">#!\/bin\/bash\n\n# this script is a wrapper for BV4627f relay board\n# It generally translates plain simple on-off commands to characters what relayboard expects\n# also it provides on-off functionality with duration \n# Argo Ellisson 2014, BashPi.org, usage licence: GNU General Public License (GPL) Version 3\n# version 1.1\n\nCOMMANDFILE=\"\/dev\/shm\/relaycommands.lst\"\n\nusage() {\necho \"USAGE: relay.sh &lt;relay&gt; &lt;command&gt; &lt;delay&gt;\"\necho \"WHERE:\"\necho \"Relay: [a-h]|[A-H]\"\necho \"Command: on|off|onfor|offfor\"\necho \"Delay: number of seconds to after which to turn on or off relay [0-3600]\"\necho \"All options are mandatory, including DELAY. Use delay 0 for now.\"\nexit 1\n}\n\n\nif [ $# -eq 3 ];then \n\n##### LOG #####\nDATE=`date`\necho \"${DATE} relay:${1}&nbsp; op:${2} duration:${3} sec\"\n##### LOG END #####\n\n# relay selection\n# this is a good place for relay aliases also - note \"lights\" below\n\ncase \"$1\" in\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; a|A|lights)&nbsp; RELAY=\"\\x41\"\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; b|B)&nbsp; RELAY=\"\\x42\"\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; c|C)&nbsp; RELAY=\"\\x43\"\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; d|D)&nbsp; RELAY=\"\\x44\"\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; e|E)&nbsp; RELAY=\"\\x45\"\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; f|F)&nbsp; RELAY=\"\\x46\" \n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; g|G)&nbsp; RELAY=\"\\x47\" \n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; h|H)&nbsp; RELAY=\"\\x48\"\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *) echo \"incorrect relay chosen\"\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; usage\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;;\nesac\n\n# timer config. using it always as its simpler\n\nif [ $3 != \"0\" ];then\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if echo \"$3\" | grep -qE ^\\-?[0-9]?\\.?[0-9]+$; then\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # calculate time\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TIME=$(echo \"$3\" |awk '{print int($1*13.6);}')\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if [ $TIME -gt 65000 ];then\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo \"Delay is too big, max ~4700sec\/79min\/1.3hours\"\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; usage\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fi\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if [ $TIME -lt 1 ];then\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $TIME=1\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fi\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # convert to hex\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DELAY=`echo -n \"$TIME\" |od -t x1 |head -1|awk 'BEGIN{ORS=\"\"}{ for (i=2;i&lt;=NF;i++)print \"\\x\"$i}'`\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo \"Delay is not positive number!\"\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; usage\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fi\n\nelse\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DELAY=\"\\x31\"\nfi\n\n# Command selection - note that as duration is not supported by relayboard, we send actually 2 commands to relayboard in case of onfor\/offfor commands \n# First command in case construct below and second command as USUAL\ncase \"$2\" in\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; on|ON)&nbsp; COMM=\"\\x31\"\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; off|OFF) COMM=\"\\x30\"\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; onfor|ONFOR) COMM=\"\\x30\"\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # onfor - usual command does timed switch off so first switch that relay on\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo -en \"\\x1b\\x5b\\x31${RELAY}\" &gt;&gt; ${COMMANDFILE}\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # note that USUAL command is actually \"OFF\" above\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; offfor|OFFFOR)&nbsp; COMM=\"\\x31\"\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # offfor - usual command does timed switch on so first switch that relay off\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo -en \"\\x1b\\x5b\\x30${RELAY}\" &gt;&gt; ${COMMANDFILE}\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # note that USUAL command is actually \"ON\" above\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *) echo \"incorrect command\"\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; usage\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;;\nesac\n\n# put USUAL command together \/ Comma \\x2c \/ ESC \\x1b \/ [ \\x5b\nCOMMAND=\"\\x1b\\x5b${COMM}\\x2c${DELAY}${RELAY}\"\n\n# DEBUG\n#echo $RELAY\n#echo $COMM\n#echo $DELAY\n#echo $COMMAND\n\n# echo command to outputfile\necho -en \"${COMMAND}\" &gt;&gt; ${COMMANDFILE}\n\nexit 0\n\nfi\n\nusage\n<\/code><\/pre>\n<ul>\n<li>Now its good time to make these two scripts executable with following command<\/li>\n<\/ul>\n<pre><code class=\"language-bash\">chmod u+x .\/relay*.sh\n<\/code><\/pre>\n<ul>\n<li>Almost done, run service script in background<\/li>\n<\/ul>\n<pre><code class=\"language-bash\">.\/relay_service.sh &amp;\n<\/code><\/pre>\n<ul>\n<li>Ready to use! Run relay script to turn on\/off relays f.e. to turn on relays a and b run following (note delay 0 seconds as a last parameter). Run commands couple of times, there may be some glitches.<\/li>\n<\/ul>\n<pre><code class=\"language-bash\">.\/relay.sh a on 0\n.\/relay.sh b on 0\n<\/code><\/pre>\n<ul>\n<li>To turn relays off, just replace parameter on with off in commands above&#8230; If you run script without parameters, it displays usage information like supported commands etc.:<\/li>\n<\/ul>\n<blockquote><p>USAGE: relay.sh &lt;relay&gt; &lt;command&gt; &lt;delay&gt;<br \/>\nWHERE:<br \/>\nRelay: [a-h]|[A-H]<br \/>\nCommand: on|off|onfor|offfor<br \/>\nDelay: number of seconds to after which to turn on or off relay [0-3600]<br \/>\nAll options are mandatory, including DELAY. Use delay 0 for now.<\/p><\/blockquote>\n<p>Did you notice commands <em>onfor<\/em> and <em>offfor<\/em>? I wrote in <a title=\"Relays\" href=\"http:\/\/www.bashpi.org\/?page_id=26\">relay-introduction page<\/a> that BV4627 board supports switching with timer. With these extra options you can additionally to delayed switching also switch relays on or off for certain time. Relay script just sends two commands to the relays f.e. if you want to turn on relay A for 5 seconds and execute command &#8220;.\/relay.sh a onfor 5&#8221; , relay script just sends command to turn relay a on and right after that command to turn off with 5 second delay. So its a little extra to originally supported functionality.<\/p>\n<ul>\n<li>If you got all that and it was really boring you can amuse yourself by making some noise with relays. Following command run really fast on my PC, if you are interested in numbers then it was able to send about 100 commands (50 times on and off) to the board per second. RPi managed about 12 commands per second.<\/li>\n<\/ul>\n<pre>while true; do for f in a b c d e f g h; do .\/relay.sh $f offfor 0.1;done ; date ; done\n<code class=\"language-bash\">\n<\/code><\/pre>\n<p>Scripts in this page were tested on:<\/p>\n<ul>\n<li>Raspberry Pi Model B 512MB RAM. OS: Raspbian Wheezy, released in 2014-01-07. All updates installed on 1. september 2014.<\/li>\n<li>Almost random pc with x86-64 architecture, running Ubuntu 12.04 (precise)<\/li>\n<\/ul>\n<p>Shopping list:<\/p>\n<ul>\n<li>BV4627 relay-controller: <a href=\"http:\/\/www.byvac.com\/bv3\/index.php?route=product\/product&amp;path=59&amp;product_id=103\">ByVac shop 36\u00a3<\/a> + shipping, you may check also Ebay. Note that there exists two versions of that board from which cut-down version does not have USB interface what is used in this how-to.<\/li>\n<li>USB cable:&nbsp; A (plug\/male) &#8211; mini B (plug\/male)<\/li>\n<li><a title=\"How to choose powered USB hub\" href=\"http:\/\/www.bashpi.org\/?page_id=377\">For RPi I suggest to use also powered USB hub<\/a><\/li>\n<\/ul>\n<p>If you found this useful, say thanks, click on some banners or <a href=\"http:\/\/www.bashpi.org\/?page_id=105\">donate<\/a>, I can always use some beer money.<\/p>\n<p><strong>NEXT <\/strong>\u2013 <a title=\"How to get ByVac BV4627 relay controller working with bash (advanced)\" href=\"http:\/\/www.bashpi.org\/?page_id=111\">How to get ByVac BV4627 relay controller working with bash (advanced)<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This how-to has multiple pages.&nbsp;This page is introduction, to prove its working. Check also theory behind why relays and why this BV4627 in here. If you want to get ByVac BV4627 relay controller\/board working, start with logging in to your Raspberry Pi or to your linux PC. You should know how to do it by [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":26,"menu_order":0,"comment_status":"closed","ping_status":"open","template":"","meta":{"footnotes":""},"class_list":["post-40","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.bashpi.org\/index.php?rest_route=\/wp\/v2\/pages\/40","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.bashpi.org\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.bashpi.org\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.bashpi.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bashpi.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=40"}],"version-history":[{"count":47,"href":"https:\/\/www.bashpi.org\/index.php?rest_route=\/wp\/v2\/pages\/40\/revisions"}],"predecessor-version":[{"id":751,"href":"https:\/\/www.bashpi.org\/index.php?rest_route=\/wp\/v2\/pages\/40\/revisions\/751"}],"up":[{"embeddable":true,"href":"https:\/\/www.bashpi.org\/index.php?rest_route=\/wp\/v2\/pages\/26"}],"wp:attachment":[{"href":"https:\/\/www.bashpi.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=40"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}