From owner-freebsd-multimedia@FreeBSD.ORG Wed Jul 6 08:18:41 2011 Return-Path: Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4267D106564A; Wed, 6 Jul 2011 08:18:41 +0000 (UTC) (envelope-from smithi@nimnet.asn.au) Received: from sola.nimnet.asn.au (paqi.nimnet.asn.au [115.70.110.159]) by mx1.freebsd.org (Postfix) with ESMTP id 57E3D8FC0A; Wed, 6 Jul 2011 08:18:39 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by sola.nimnet.asn.au (8.14.2/8.14.2) with ESMTP id p6683FAL012141; Wed, 6 Jul 2011 18:03:15 +1000 (EST) (envelope-from smithi@nimnet.asn.au) Date: Wed, 6 Jul 2011 18:03:14 +1000 (EST) From: Ian Smith To: Achilleas Mantzios In-Reply-To: <201107051730.03784.achill@matrix.gatewaynet.com> Message-ID: <20110706170845.Q84785@sola.nimnet.asn.au> References: <201107041339.22470.achill@matrix.gatewaynet.com> <201107051730.03784.achill@matrix.gatewaynet.com> MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="0-136029731-1309939394=:84785" Cc: freebsd-multimedia@freebsd.org, freebsd-hardware@freebsd.org Subject: Re: FreeBSD and controlling an alarm via relay X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jul 2011 08:18:41 -0000 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --0-136029731-1309939394=:84785 Content-Type: TEXT/PLAIN; charset=ISO-8859-1 Content-Transfer-Encoding: 8BIT On Tue, 5 Jul 2011, Achilleas Mantzios wrote: > ÿÿÿÿÿÿÿÿ Tuesday 05 July 2011 16:10:59 ÿÿÿÿÿÿÿÿÿÿÿÿÿÿ: > > On Mon, 4 Jul 2011, Achilleas Mantzios wrote: > > > > [snip] > > > > > I was thinking of some relay board (instead of the old modem), > > > possibly ethernet controlled > > > > This box has relays and GPIO available via ethernet. It's probably > > overkill for your application, but it's well made and easy to use: > > > > http://www.extron.com/product/product.aspx?id=ipltcr48&s=0 > > > > That is too big for my application, thanx anyway. > Most probably i'll go for something cheaper like this one > http://www.ebay.co.uk/itm/USB-Eight-Channel-Relay-Board-RS232-Serial-Controlled-/110710346488?pt=UK_BOI_Electrical_Components_Supplies_ET&hash=item19c6d9d2f8 These look quite well designed and built to me, reasonably priced new, but check out the/a source site [1] for various models, 1- and 4-relay boards too, or if you prefer, RS-232 serial rather than USB interface for the 8-relay boards. There's also a simple parallel port to 8 TTL outputs board (hi Tim!) and various other stuff. I'm tempted myself. [1] http://sigma-shop.com/category/4/relay-boards.html [2] http://www.sigma-shop.com/page/12/manuals.html > Could i use the ucom driver to talk to the USB device like a normal serial device, via /dev/cua*** ? > The above link says one needs to talk to the relay with: > 8 Data, 1 Stop, No Parity,Baud rate : 9600 > and the commands look like: > FF 01 00 (HEX) > or > 255 1 0 (DEC) > > could i be able to specify those over ucom? If so, great. If not and you have a serial port, the code will be the same anyway, except the port used. I grabbed most of the manuals from [2] and found the Linux software examples are all this one: ======= Linux : The USB-serial device is automatically detected and mapped to /dev/ ttyUSB0 (or USB1 in case there is already a similar device). My test script: (Thanks Julian!) -------------------------------------------------------- # cat relay.sh while true do echo -e "\xFF\x00\x00" > /dev/ttyUSB0 ; sleep .1 echo -e "\xFF\x00\x01" > /dev/ttyUSB0 ; sleep .1 echo -e "\xFF\x00\x00" > /dev/ttyUSB0 ; sleep .1 [..] echo -e "\xFF\x01\x01" > /dev/ttyUSB0 ; sleep .1 echo -e "\xFF\x02\x01" > /dev/ttyUSB0 ; sleep .1 [..] echo -e "\xFF\x07\x01" > /dev/ttyUSB0 ; sleep .1 echo -e "\xFF\x08\x01" > /dev/ttyUSB0 ; sleep .1 echo -e "\xFF\x01\x00" > /dev/ttyUSB0 ; sleep .1 echo -e "\xFF\x02\x00" > /dev/ttyUSB0 ; sleep .1 [..] echo -e "\xFF\x07\x00" > /dev/ttyUSB0 ; sleep .1 echo -e "\xFF\x08\x00" > /dev/ttyUSB0 ; sleep .1 ======= If using sh[1] you might need to use \0377 instead of \xFF > do you know any application, perl library, utility or just a guide for standard C serial port programming? Anything that can write bytes to a serial port - perl's overqualified :) [..] cheers, Ian --0-136029731-1309939394=:84785--