Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 6 Jul 2011 15:41:50 +0300
From:      Achilleas Mantzios <achill@matrix.gatewaynet.com>
To:        Dale Kline <DKline@libraryvideo.com>
Cc:        "freebsd-multimedia@freebsd.org" <freebsd-multimedia@freebsd.org>, "freebsd-hardware@freebsd.org" <freebsd-hardware@freebsd.org>
Subject:   Re: FreeBSD and controlling an alarm via relay
Message-ID:  <201107061541.51168.achill@matrix.gatewaynet.com>
In-Reply-To: <02F3A553C174554DA1D5EC7CEE9BDDD78DA245@THOR.lvc.com>
References:  <201107041339.22470.achill@matrix.gatewaynet.com> <201107061521.24690.achill@matrix.gatewaynet.com> <02F3A553C174554DA1D5EC7CEE9BDDD78DA245@THOR.lvc.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Cool man, thanx a lot, you and all the guys who answered were really really=
 helpful.

=CE=A3=CF=84=CE=B9=CF=82 Wednesday 06 July 2011 15:34:30 =CE=BF/=CE=B7 Dale=
 Kline =CE=AD=CE=B3=CF=81=CE=B1=CF=88=CE=B5:
> OK  - now I understand.  The relay driven by the computer is a very smart=
 "switch" which changes the condition of the MCT-100 loop,  and causes the =
Transmitter to send a signal to another Receiver.  So if you wire the relay=
 connector block to the MCT-100 loop input, it will work fine.  That part i=
s straightforward. I could not tell if the MCT-100 is current or voltage dr=
iven,  but it will work with the relay either way.
> I'm not familiar with the zoneminder.  I'll have to look into that.  I wa=
nted to do some of that at home to let me know when someone drives into our=
 driveway.
> BTW,  I am a hardware person - soldering iron and that stuff.  This softw=
are is a challenge that I am trying to learn.  I am one very small step abo=
ve absolute beginner with this FreeBSD code.   But volts and amps and ohms,=
 that I understand.  :-)
>=20
> -----Original Message-----
> From: owner-freebsd-hardware@freebsd.org [mailto:owner-freebsd-hardware@f=
reebsd.org] On Behalf Of Achilleas Mantzios
> Sent: Wednesday, July 06, 2011 8:21 AM
> To: Dale Kline
> Cc: freebsd-multimedia@freebsd.org; Chris Hill; Ian Smith; freebsd-hardwa=
re@freebsd.org
> Subject: Re: FreeBSD and controlling an alarm via relay
>=20
> Hello, not quite.
> Here is the idea (which has roughly worked in the past but with "peculiar=
"-exotic hardware (e.g. 14.4Kbps modem ) :
> 1) FreBSD server runs zoneminder.=20
> 2) A deamon polls zoneminder's sharedmem (IPC) to see if we have any kind=
 of alert
> (motion detection) produced. (that means that we verify that some camera =
detected unwanted motion)
> 3) Upon motion detection within the above daemon a script is called which=
 sets some bits in some relay board=20
> 4) this relay board closes a NO circuit or opens a NC circuit in MCT100
> 5) MCT100 talks directly to visonic powermax+ control panel and triggers =
a burglar alarm
>=20
> I had the above idea working 2-3 years back, with the following differenc=
es with regard to the above
> a) a http://www.visonic.com/Products/Wireless-Property-Protection/Door-wi=
ndow-contact-mct-302 door/window
> was used instead of the dedicated MCT-100 xmitter. MCT-302 had an additio=
nal hard-wired input (NO/NC/EOL) which behaved
> like a distinct zone with its own xmitter, pretty much like the MCT-100 d=
oes. Problem with that was that the battery=20
> went off too early and also the contact was completely damaged/malfunctio=
ning in the end. That is why i opted
> for the more dedicated MCT-100 xmitter which is designed to do just that,=
 (as you said) sense for difference in current
> in the circuit and transimt an event to the powermax+ central panel.
>=20
> b) instead of a dedicated-specialized relay board, i was utilizing an old=
 ZyXel modem, which i had connected in series=20
> with the MCT-302 NC circuit. Normally the ZyXel allowed for current to pa=
ss through the circuit.
> when the zoneminder-polling daemon detected an unwanted motion detection =
it run:
> vm shell -l cuad1 -S offhook_onhook.pl
> (vm comes with mgetty)
> where offhook_onhook.pl looked like:
> #!/usr/bin/perl
> #
> use Modem::Vgetty;
>=20
> my $v =3D new Modem::Vgetty;
>=20
> $v->device('DIALUP_LINE');
> $v->send("ATH1");
> sleep(2);
> $v->send("ATH0");
>=20
> This=20
> $v->send("ATH1");
> sleep(2);
> $v->send("ATH0");
> part seemed to do the trick just fine.
>=20
> Thing, is that i am thinking these days, of trying either to re-do the ol=
d 1.23 zoneminder port for FreeBSD 8.2
> or join bsam@freebsd.org, in his effort to have a fully functioning zonem=
inder 1.24 port with local bktr camera support.
> Along with that, i want to get rid of the old "MCT-302/ZyXel model" way a=
nd try something better and faster.
>=20
> That is the whole story, i hope i made it clear enough :)
>=20
> =CE=A3=CF=84=CE=B9=CF=82 Wednesday 06 July 2011 14:55:45 =CE=BF/=CE=B7 Da=
le Kline =CE=AD=CE=B3=CF=81=CE=B1=CF=88=CE=B5:
> > Hi,
> > I guess I don't understand your application here.  The Visonic is a bat=
tery operated UHF remote alarm transmitter,  that looks at a wired loop for=
 a change in condition (a door magnetic reed sensor, for example) and then =
it transmits an alert to a remote Radio Receiver (MCR-304) if that door ope=
ns or closes unexpectedly.  The MCT100 has a three volt battery with an ope=
rating life of 45 - 50 months according to the spec.  It does not need a vo=
ltage supply,  nor would you want to turn it on and off during operation.
> > The Relay boards, on the other hand, are capable of turning on and off =
the four or eight relays from your computer commands.  The relays are capab=
le of switching ANY AC or DC voltage, at a rated current (24 VDC OR 120 VAC=
 @ 15 Amps and so on).  The 5 volt @ 72ma rating is the voltage and current=
 that the board must supply to make the relay close.
> > The green terminal blocks then connect to a floodlight (for example) th=
at would turn ON after the UHF Receiver that is listening to the MCT100 Tra=
nsmitter indicates that someone has opened or closed the door mentioned in =
the first paragraph.
> > Am I following what you want to do?
> > -----Original Message-----
> > From: owner-freebsd-hardware@freebsd.org [mailto:owner-freebsd-hardware=
@freebsd.org] On Behalf Of Achilleas Mantzios
> > Sent: Wednesday, July 06, 2011 5:50 AM
> > To: Ian Smith
> > Cc: freebsd-multimedia@freebsd.org; Chris Hill; freebsd-hardware@freebs=
d.org
> > Subject: Re: FreeBSD and controlling an alarm via relay
> >=20
> > another thing that puzzles me is power.
> > This board : http://www.ebay.co.uk/itm/USB-Eight-Channel-Relay-Board-RS=
232-Serial-Controlled-/110710333092?pt=3DUK_BOI_Electrical_Components_Suppl=
ies_ET&hash=3Ditem19c6d99ea4
> > needs VDC 12V supply=20
> > while this one : http://www.ebay.co.uk/itm/USB-Four-4-Relay-Module-Boar=
d-Home-Automation-/180646300804?pt=3DLH_DefaultDomain_0&hash=3Ditem2a0f5bcc=
84
> > is self powered from USB.
> >=20
> > batteries do not come cheap, and having an extra AC/DC adaptor is not v=
ery good either ...
> >=20
> > another thing is the relay parameters, i see various figures :
> > Relay parameters: 5V / 72mA, 15A/24VDC (120VAC), 10A/250VAC or
> > Each switch 12VDC/15A or 240VAC/10A or
> > Open (No) and Closed (NC) Contacts rated for voltages: 12VDC/15A; 24VDC=
/15A; 125VAC/15A; 250VAC/10A
> >=20
> > my specific application i want to drive is this wireless xmitter :
> > http://www.visonic.com/Data/Uploads/MCT_100_Installer_Guide_English_DE2=
241U.pdf
> > Should i assume my device that i want my relay to control will have vol=
tage of 3V?
> >=20
> > for which Voltage/Ampere figures should i opt? are those figures crucia=
l?
> >=20
> > thanx a lot
> >=20
> > =CE=A3=CF=84=CE=B9=CF=82 Wednesday 06 July 2011 11:03:14 =CE=BF/=CE=B7 =
Ian Smith =CE=AD=CE=B3=CF=81=CE=B1=CF=88=CE=B5:
> > > On Tue, 5 Jul 2011, Achilleas Mantzios wrote:
> > >  > =EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=
=BF=BD Tuesday 05 July 2011 16:10:59 =EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=
=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=
=BF=BD=EF=BF=BD:
> > >  > > On Mon, 4 Jul 2011, Achilleas Mantzios wrote:
> > >  > >=20
> > >  > > [snip]
> > >  > >=20
> > >  > > > I was thinking of some relay board (instead of the old modem),=
=20
> > >  > > > possibly ethernet controlled
> > >  > >=20
> > >  > > This box has relays and GPIO available via ethernet. It's probab=
ly=20
> > >  > > overkill for your application, but it's well made and easy to us=
e:
> > >  > >=20
> > >  > > http://www.extron.com/product/product.aspx?id=3Dipltcr48&s=3D0
> > >  > >=20
> > >  >=20
> > >  > That is too big for my application, thanx anyway.
> > >  > Most probably i'll go for something cheaper like this one=20
> > >  > http://www.ebay.co.uk/itm/USB-Eight-Channel-Relay-Board-RS232-Seri=
al-Controlled-/110710346488?pt=3DUK_BOI_Electrical_Components_Supplies_ET&h=
ash=3Ditem19c6d9d2f8
> > >=20
> > > These look quite well designed and built to me, reasonably priced new=
,=20
> > > but check out the/a source site [1] for various models, 1- and 4-rela=
y=20
> > > boards too, or if you prefer, RS-232 serial rather than USB interface=
=20
> > > for the 8-relay boards.  There's also a simple parallel port to 8 TTL=
=20
> > > outputs board (hi Tim!) and various other stuff.  I'm tempted myself.
> > >=20
> > > [1] http://sigma-shop.com/category/4/relay-boards.html
> > > [2] http://www.sigma-shop.com/page/12/manuals.html
> > >=20
> > >  > Could i use the ucom driver to talk to the USB device like a norma=
l 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)=20
> > >  > or=20
> > >  > 255 1 0 (DEC)
> > >  >=20
> > >  > could i be able to specify those over ucom?=20
> > >=20
> > > If so, great.  If not and you have a serial port, the code will be th=
e=20
> > > same anyway, except the port used.  I grabbed most of the manuals fro=
m=20
> > > [2] and found the Linux software examples are all this one:
> > >=20
> > > =3D=3D=3D=3D=3D=3D=3D
> > > 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
> > > =3D=3D=3D=3D=3D=3D=3D
> > >=20
> > > If using sh[1] you might need to use \0377 instead of \xFF
> > >=20
> > >  > do you know any application, perl library, utility or just a guide=
 for standard C serial port programming?
> > >=20
> > > Anything that can write bytes to a serial port - perl's overqualified=
 :)
> > >=20
> > > [..]
> > >=20
> > > cheers, Ian
> >=20
> >=20
> >=20
>=20
>=20
>=20



=2D-=20
Achilleas Mantzios



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201107061541.51168.achill>