Discussion:
FreeBSD and controlling an alarm via relay
(too old to reply)
Achilleas Mantzios
2011-07-04 10:57:41 UTC
Permalink
Hello, sorry for the cross-post but i believe this question might seat in both lists.
I am the guy who had the done the old 1.23.3 zoneminder port some years ago, and i am thinking of installing/testing
the new 1.24.4 port, submitted by ***@FreeBSD.org.
Besides the basic functions, i am thinking of re-using some old techniques by which i controlled
the home alarm via a NC/NO circuit (basically it was an enhanced door contact),
driven by an old zyXel modem, which in turn was driven by a small perl program driving the com port, and
which was called by a deamon reading zoneminder shared memory info directly.
That way i could trigger the alarm system getting into alarm state, whenever zoneminder detected motion,
in a fully controlled and programmatic way.

Now i am thinking of re-doing this, a little bit more modern, if possible. I was thinking of some relay board
(instead of the old modem), possibly ethernet controlled (to get rid of all the obsolete com port programming),
and such. Also i will scrap the old NO/NC solution (circuit embded in the door contact), and i wil use instead a new
dedicated wireless transimter i bought (same brand as the alarm system), which is also NC/NO and receives
two inputs and corresponds to two zones. So i am thinking of assigning 2 cameras as two disctinct zones
in the alarm system.

That is the rough idea. What would you guys have to recommend (regarding the relay?). I do not plan to use
this relay for power/lights on/off and such, at this stage it will function solely to drive the alarm transimtter,
(which in turn will drigger an alarm to the central alarm control panel)

Thanks
--
Achilleas Mantzios
Luiz Otavio O Souza
2011-07-05 02:00:22 UTC
Permalink
Post by Achilleas Mantzios
Hello, sorry for the cross-post but i believe this question might seat in both lists.
I am the guy who had the done the old 1.23.3 zoneminder port some years ago, and i am thinking of installing/testing
Besides the basic functions, i am thinking of re-using some old techniques by which i controlled
the home alarm via a NC/NO circuit (basically it was an enhanced door contact),
driven by an old zyXel modem, which in turn was driven by a small perl program driving the com port, and
which was called by a deamon reading zoneminder shared memory info directly.
That way i could trigger the alarm system getting into alarm state, whenever zoneminder detected motion,
in a fully controlled and programmatic way.
Now i am thinking of re-doing this, a little bit more modern, if possible. I was thinking of some relay board
(instead of the old modem), possibly ethernet controlled (to get rid of all the obsolete com port programming),
and such. Also i will scrap the old NO/NC solution (circuit embded in the door contact), and i wil use instead a new
dedicated wireless transimter i bought (same brand as the alarm system), which is also NC/NO and receives
two inputs and corresponds to two zones. So i am thinking of assigning 2 cameras as two disctinct zones
in the alarm system.
That is the rough idea. What would you guys have to recommend (regarding the relay?). I do not plan to use
this relay for power/lights on/off and such, at this stage it will function solely to drive the alarm transimtter,
(which in turn will drigger an alarm to the central alarm control panel)
If you want to go ethernet -> gpio, i think the routerstation (or routerstation pro) is one good option. The routerstation (not the pro version) works with 12v~24v (12v is kind common for alarm systems) and has 7 available GPIO pins (which works as inputs and outputs - you can connect relays, switches, leds, lcds, i2c and spi devices).

GPIO pins can be easily controlled from userland with gpioctl(8) or with a small C program with the appropriate ioctl()s (or even using the led(4) framework).

Please take a look at http://wiki.freebsd.org/FreeBSD/mips/UBNT-RouterStation for more detailed information.

Both boards works _really_ fine with -current.

Cheers,
Luiz_______________________________________________
freebsd-***@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hardware
To unsubscribe, send any mail to "freebsd-hardware-***@freebsd.org"
Achilleas Mantzios
2011-07-05 07:49:10 UTC
Permalink
Post by Luiz Otavio O Souza
Post by Achilleas Mantzios
Hello, sorry for the cross-post but i believe this question might seat in both lists.
I am the guy who had the done the old 1.23.3 zoneminder port some years ago, and i am thinking of installing/testing
Besides the basic functions, i am thinking of re-using some old techniques by which i controlled
the home alarm via a NC/NO circuit (basically it was an enhanced door contact),
driven by an old zyXel modem, which in turn was driven by a small perl program driving the com port, and
which was called by a deamon reading zoneminder shared memory info directly.
That way i could trigger the alarm system getting into alarm state, whenever zoneminder detected motion,
in a fully controlled and programmatic way.
Now i am thinking of re-doing this, a little bit more modern, if possible. I was thinking of some relay board
(instead of the old modem), possibly ethernet controlled (to get rid of all the obsolete com port programming),
and such. Also i will scrap the old NO/NC solution (circuit embded in the door contact), and i wil use instead a new
dedicated wireless transimter i bought (same brand as the alarm system), which is also NC/NO and receives
two inputs and corresponds to two zones. So i am thinking of assigning 2 cameras as two disctinct zones
in the alarm system.
That is the rough idea. What would you guys have to recommend (regarding the relay?). I do not plan to use
this relay for power/lights on/off and such, at this stage it will function solely to drive the alarm transimtter,
(which in turn will drigger an alarm to the central alarm control panel)
If you want to go ethernet -> gpio, i think the routerstation (or routerstation pro) is one good option. The routerstation (not the pro version) works with 12v~24v (12v is kind common for alarm systems) and has 7 available GPIO pins (which works as inputs and outputs - you can connect relays, switches, leds, lcds, i2c and spi devices).
GPIO pins can be easily controlled from userland with gpioctl(8) or with a small C program with the appropriate ioctl()s (or even using the led(4) framework).
Please take a look at http://wiki.freebsd.org/FreeBSD/mips/UBNT-RouterStation for more detailed information.
Both boards works _really_ fine with -current.
Hello, thanx,
i see there is nothing GPIO related in 8.2, grep -i gpio /usr/src/sys/ yields nothing.
Also, i was looking for an actual relay that could drive this simple wireless transmitter :
http://www.visonic.com/Products/Wireless-Property-Protection/Universal-transmitter-mct-100
http://www.visonic.com/Data/Uploads/MCT_100_Installer_Guide_English_DE2241U.pdf (installation manual)
So what i wanna do is simple, sent some command to a relay which will open a normally closed or
close a normally open circuit in the above transmitter, and trigger an alarm.
Post by Luiz Otavio O Souza
Cheers,
Luiz
--
Achilleas Mantzios
Bernt Hansson
2011-07-05 09:16:05 UTC
Permalink
Post by Achilleas Mantzios
Hello, sorry for the cross-post but i believe this question might seat in both lists.
I am the guy who had the done the old 1.23.3 zoneminder port some years ago, and i am thinking of installing/testing
Besides the basic functions, i am thinking of re-using some old techniques by which i controlled
the home alarm via a NC/NO circuit (basically it was an enhanced door contact),
driven by an old zyXel modem, which in turn was driven by a small perl program driving the com port, and
which was called by a deamon reading zoneminder shared memory info directly.
That way i could trigger the alarm system getting into alarm state, whenever zoneminder detected motion,
in a fully controlled and programmatic way.
Is this what you you are looking for

http://www.telldus.se/products/tellstick
Achilleas Mantzios
2011-07-05 09:34:39 UTC
Permalink
Post by Bernt Hansson
Post by Achilleas Mantzios
Hello, sorry for the cross-post but i believe this question might seat in both lists.
I am the guy who had the done the old 1.23.3 zoneminder port some years ago, and i am thinking of installing/testing
Besides the basic functions, i am thinking of re-using some old techniques by which i controlled
the home alarm via a NC/NO circuit (basically it was an enhanced door contact),
driven by an old zyXel modem, which in turn was driven by a small perl program driving the com port, and
which was called by a deamon reading zoneminder shared memory info directly.
That way i could trigger the alarm system getting into alarm state, whenever zoneminder detected motion,
in a fully controlled and programmatic way.
Is this what you you are looking for
http://www.telldus.se/products/tellstick
No,
what i am looking for is for a way to control a NO or NC/EOL switch from FreeBSD.
Most probably it must be some kind of relay. I have not used any ever, except
once using a zyXel modem to behave like a relay switch in a N/C contact.
--
Achilleas Mantzios
Achilleas Mantzios
2011-07-05 10:03:59 UTC
Permalink
Post by Bernt Hansson
Post by Achilleas Mantzios
Hello, sorry for the cross-post but i believe this question might seat in both lists.
I am the guy who had the done the old 1.23.3 zoneminder port some years ago, and i am thinking of installing/testing
Besides the basic functions, i am thinking of re-using some old techniques by which i controlled
the home alarm via a NC/NO circuit (basically it was an enhanced door contact),
driven by an old zyXel modem, which in turn was driven by a small perl program driving the com port, and
which was called by a deamon reading zoneminder shared memory info directly.
That way i could trigger the alarm system getting into alarm state, whenever zoneminder detected motion,
in a fully controlled and programmatic way.
Is this what you you are looking for
http://www.telldus.se/products/tellstick
Basically i am thinking of something like this:
http://www.ebay.co.uk/itm/USB-Eight-Channel-Relay-Board-RS232-Serial-Controlled-/110710829016?pt=UK_BOI_Electrical_Components_Supplies_ET&hash=item19c6e12fd8
a USB controlled 8-channel relay board, rs232 serial controlled

What would be my chances with this on FreeBSD 8.2?
--
Achilleas Mantzios
Bernt Hansson
2011-07-05 11:31:11 UTC
Permalink
Post by Achilleas Mantzios
Post by Bernt Hansson
Post by Achilleas Mantzios
Hello, sorry for the cross-post but i believe this question might seat in both lists.
I am the guy who had the done the old 1.23.3 zoneminder port some years ago, and i am thinking of installing/testing
Besides the basic functions, i am thinking of re-using some old techniques by which i controlled
the home alarm via a NC/NO circuit (basically it was an enhanced door contact),
driven by an old zyXel modem, which in turn was driven by a small perl program driving the com port, and
which was called by a deamon reading zoneminder shared memory info directly.
That way i could trigger the alarm system getting into alarm state, whenever zoneminder detected motion,
in a fully controlled and programmatic way.
Is this what you you are looking for
http://www.telldus.se/products/tellstick
http://www.ebay.co.uk/itm/USB-Eight-Channel-Relay-Board-RS232-Serial-Controlled-/110710829016?pt=UK_BOI_Electrical_Components_Supplies_ET&hash=item19c6e12fd8
a USB controlled 8-channel relay board, rs232 serial controlled
OK. Velleman has 8 & 16 channel relay boards, K8056, K6714 (8channels)
and K6714-16 (16Channels). I have an schematic from elektor/elektuur
with which you can control 64+ outputs from the printerport.
Post by Achilleas Mantzios
What would be my chances with this on FreeBSD 8.2?
Achilleas Mantzios
2011-07-05 12:56:04 UTC
Permalink
Post by Bernt Hansson
Post by Achilleas Mantzios
Post by Bernt Hansson
Post by Achilleas Mantzios
Hello, sorry for the cross-post but i believe this question might seat in both lists.
I am the guy who had the done the old 1.23.3 zoneminder port some years ago, and i am thinking of installing/testing
Besides the basic functions, i am thinking of re-using some old techniques by which i controlled
the home alarm via a NC/NO circuit (basically it was an enhanced door contact),
driven by an old zyXel modem, which in turn was driven by a small perl program driving the com port, and
which was called by a deamon reading zoneminder shared memory info directly.
That way i could trigger the alarm system getting into alarm state, whenever zoneminder detected motion,
in a fully controlled and programmatic way.
Is this what you you are looking for
http://www.telldus.se/products/tellstick
http://www.ebay.co.uk/itm/USB-Eight-Channel-Relay-Board-RS232-Serial-Controlled-/110710829016?pt=UK_BOI_Electrical_Components_Supplies_ET&hash=item19c6e12fd8
a USB controlled 8-channel relay board, rs232 serial controlled
OK. Velleman has 8 & 16 channel relay boards, K8056, K6714 (8channels)
and K6714-16 (16Channels). I have an schematic from elektor/elektuur
with which you can control 64+ outputs from the printerport.
Post by Achilleas Mantzios
What would be my chances with this on FreeBSD 8.2?
--
Achilleas Mantzios
Chris Hill
2011-07-05 13:48:58 UTC
Permalink
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

I'd also look at manufactureres such as Moxa and LANtronics.
--
Chris Hill ***@monochrome.org
** [ Busy Expunging </> ]
Achilleas Mantzios
2011-07-05 14:30:46 UTC
Permalink
Post by Chris Hill
[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
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

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?
do you know any application, perl library, utility or just a guide for standard C serial port programming?

i have used mgetty/vgetty in the past to control some modems.
I do not know if there any fancier methods to access the serial port, but this is how i used to do it, back in 7.*
/usr/local/bin/vm shell -l cuad1 -S onhook_offhook.pl
where onhook_offhook.pl reads like:
#!/usr/bin/perl
#
use Modem::Vgetty;

my $v = new Modem::Vgetty;

$v->device('DIALUP_LINE');
$v->send("ATH1");
sleep(5);
$v->send("ATH0");

if i could speak directly with e.g. "255 1 0" like
$v->send("255 1 0");
that would be awesome...
i guess i will have to try it out.
Post by Chris Hill
I'd also look at manufactureres such as Moxa and LANtronics.
--
Achilleas Mantzios
Tim Pozar
2011-07-05 18:23:49 UTC
Permalink
Why not use the parallel port? Have one of its pins drive a relay. You may need to put a transistor in front of the relay.

Software:
http://excamera.com/articles/21/parallel.html

Hardware:
http://www.dakeng.com/relay.htm

Fancy hardware:
http://www.electronickits.com/kit/complete/elec/ck1601.htm

Tim
Post by Achilleas Mantzios
Post by Chris Hill
[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
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
Could i use the ucom driver to talk to the USB device like a normal serial device, via /dev/cua*** ?
8 Data, 1 Stop, No Parity,Baud rate : 9600
FF 01 00 (HEX)
or
255 1 0 (DEC)
could i be able to specify those over ucom?
do you know any application, perl library, utility or just a guide for standard C serial port programming?
i have used mgetty/vgetty in the past to control some modems.
I do not know if there any fancier methods to access the serial port, but this is how i used to do it, back in 7.*
/usr/local/bin/vm shell -l cuad1 -S onhook_offhook.pl
#!/usr/bin/perl
#
use Modem::Vgetty;
my $v = new Modem::Vgetty;
$v->device('DIALUP_LINE');
$v->send("ATH1");
sleep(5);
$v->send("ATH0");
if i could speak directly with e.g. "255 1 0" like
$v->send("255 1 0");
that would be awesome...
i guess i will have to try it out.
Post by Chris Hill
I'd also look at manufactureres such as Moxa and LANtronics.
--
Achilleas Mantzios
_______________________________________________
http://lists.freebsd.org/mailman/listinfo/freebsd-multimedia
Achilleas Mantzios
2011-07-06 08:27:00 UTC
Permalink
thanx! very interesting!
Post by Tim Pozar
Why not use the parallel port? Have one of its pins drive a relay. You may need to put a transistor in front of the relay.
http://excamera.com/articles/21/parallel.html
http://www.dakeng.com/relay.htm
http://www.electronickits.com/kit/complete/elec/ck1601.htm
Tim
Post by Achilleas Mantzios
Post by Chris Hill
[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
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
Could i use the ucom driver to talk to the USB device like a normal serial device, via /dev/cua*** ?
8 Data, 1 Stop, No Parity,Baud rate : 9600
FF 01 00 (HEX)
or
255 1 0 (DEC)
could i be able to specify those over ucom?
do you know any application, perl library, utility or just a guide for standard C serial port programming?
i have used mgetty/vgetty in the past to control some modems.
I do not know if there any fancier methods to access the serial port, but this is how i used to do it, back in 7.*
/usr/local/bin/vm shell -l cuad1 -S onhook_offhook.pl
#!/usr/bin/perl
#
use Modem::Vgetty;
my $v = new Modem::Vgetty;
$v->device('DIALUP_LINE');
$v->send("ATH1");
sleep(5);
$v->send("ATH0");
if i could speak directly with e.g. "255 1 0" like
$v->send("255 1 0");
that would be awesome...
i guess i will have to try it out.
Post by Chris Hill
I'd also look at manufactureres such as Moxa and LANtronics.
--
Achilleas Mantzios
_______________________________________________
http://lists.freebsd.org/mailman/listinfo/freebsd-multimedia
--
Achilleas Mantzios
Boris Samorodov
2011-07-05 20:29:24 UTC
Permalink
Post by Achilleas Mantzios
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
Could i use the ucom driver to talk to the USB device like a normal
serial device, via /dev/cua*** ?
I use USB-to-7-RS232-ports devices via /dev/cuaU00-/dev/cuaU06.
Works like a charm. But you should find out what chip is used
for USB-to-RS232 bridge and (kld)load a driver.
Post by Achilleas Mantzios
8 Data, 1 Stop, No Parity,Baud rate : 9600
I've never changed those parameters.
Post by Achilleas Mantzios
FF 01 00 (HEX)
or
255 1 0 (DEC)
could i be able to specify those over ucom?
do you know any application, perl library, utility or just a guide for
standard C serial port programming?
i have used mgetty/vgetty in the past to control some modems.
I do not know if there any fancier methods to access the serial port,
but this is how i used to do it, back in 7.*
/usr/local/bin/vm shell -l cuad1 -S onhook_offhook.pl
#!/usr/bin/perl
#
use Modem::Vgetty;
my $v = new Modem::Vgetty;
$v->device('DIALUP_LINE');
$v->send("ATH1");
sleep(5);
$v->send("ATH0");
if i could speak directly with e.g. "255 1 0" like
$v->send("255 1 0");
that would be awesome...
i guess i will have to try it out.
I use python for scripting and it is as simple as write(data) and
read(data).
--
HTH and WBR, bsam
Achilleas Mantzios
2011-07-06 07:10:26 UTC
Permalink
Hey, its a small world!
i am the other guy (achix) from the zoneminder camp :)
this all has to do with a continuation of the zoneminder work,
zoneminder driving a relay, driving a xmitter and finally triggering an alarm
to the central alarm control panel.

i have done this in the past with a rather "legacy" way (utilizing a zyXel modem), but wanted to
do something more fancy.
Post by Boris Samorodov
Post by Achilleas Mantzios
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
Could i use the ucom driver to talk to the USB device like a normal
serial device, via /dev/cua*** ?
I use USB-to-7-RS232-ports devices via /dev/cuaU00-/dev/cuaU06.
Works like a charm. But you should find out what chip is used
for USB-to-RS232 bridge and (kld)load a driver.
Is there any big probability for the chip to not be on of those that FreeBSD supports (uark, uftdi, etc..) ?
most sellers hardly give such info out.
Post by Boris Samorodov
Post by Achilleas Mantzios
8 Data, 1 Stop, No Parity,Baud rate : 9600
I've never changed those parameters.
Post by Achilleas Mantzios
FF 01 00 (HEX)
or
255 1 0 (DEC)
could i be able to specify those over ucom?
do you know any application, perl library, utility or just a guide for
standard C serial port programming?
i have used mgetty/vgetty in the past to control some modems.
I do not know if there any fancier methods to access the serial port,
but this is how i used to do it, back in 7.*
/usr/local/bin/vm shell -l cuad1 -S onhook_offhook.pl
#!/usr/bin/perl
#
use Modem::Vgetty;
my $v = new Modem::Vgetty;
$v->device('DIALUP_LINE');
$v->send("ATH1");
sleep(5);
$v->send("ATH0");
if i could speak directly with e.g. "255 1 0" like
$v->send("255 1 0");
that would be awesome...
i guess i will have to try it out.
I use python for scripting and it is as simple as write(data) and
read(data).
Cool, thanx,
see you over the zoneminder forum.
--
Achilleas Mantzios
Boris Samorodov
2011-07-06 15:37:14 UTC
Permalink
Hi All,
Post by Achilleas Mantzios
Hey, its a small world!
i am the other guy (achix) from the zoneminder camp :)
Glad to see you here.

[...]
Post by Achilleas Mantzios
Is there any big probability for the chip to not be on of those that
FreeBSD supports (uark, uftdi, etc..) ?
I think that it'a big probability that the chip is supported.
Post by Achilleas Mantzios
most sellers hardly give such info out.
You may load a manual and look at drivers that are mentiond there.
Some words like ftd or prolific may provide some light.
--
WBR, bsam
Ian Smith
2011-07-06 08:21:11 UTC
Permalink
Post by Achilleas Mantzios
Post by Chris Hill
[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
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
Post by Achilleas Mantzios
Could i use the ucom driver to talk to the USB device like a normal serial device, via /dev/cua*** ?
8 Data, 1 Stop, No Parity,Baud rate : 9600
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
Post by Achilleas Mantzios
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
Achilleas Mantzios
2011-07-06 09:52:32 UTC
Permalink
another thing that puzzles me is power.
This board : http://www.ebay.co.uk/itm/USB-Eight-Channel-Relay-Board-RS232-Serial-Controlled-/110710333092?pt=UK_BOI_Electrical_Components_Supplies_ET&hash=item19c6d99ea4
needs VDC 12V supply
while this one : http://www.ebay.co.uk/itm/USB-Four-4-Relay-Module-Board-Home-Automation-/180646300804?pt=LH_DefaultDomain_0&hash=item2a0f5bcc84
is self powered from USB.

batteries do not come cheap, and having an extra AC/DC adaptor is not very good either ...

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

my specific application i want to drive is this wireless xmitter :
http://www.visonic.com/Data/Uploads/MCT_100_Installer_Guide_English_DE2241U.pdf
Should i assume my device that i want my relay to control will have voltage of 3V?

for which Voltage/Ampere figures should i opt? are those figures crucial?

thanx a lot
Post by Ian Smith
Post by Achilleas Mantzios
Post by Chris Hill
[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
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
Post by Achilleas Mantzios
Could i use the ucom driver to talk to the USB device like a normal serial device, via /dev/cua*** ?
8 Data, 1 Stop, No Parity,Baud rate : 9600
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
=======
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
Post by Achilleas Mantzios
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
--
Achilleas Mantzios
Dale Kline
2011-07-06 12:15:12 UTC
Permalink
Hi,
I guess I don't understand your application here. The Visonic is a battery 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 opens or closes unexpectedly. The MCT100 has a three volt battery with an operating life of 45 - 50 months according to the spec. It does not need a voltage 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 capable 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) that would turn ON after the UHF Receiver that is listening to the MCT100 Transmitter 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-***@freebsd.org [mailto:owner-freebsd-***@freebsd.org] On Behalf Of Achilleas Mantzios
Sent: Wednesday, July 06, 2011 5:50 AM
To: Ian Smith
Cc: freebsd-***@freebsd.org; Chris Hill; freebsd-***@freebsd.org
Subject: Re: FreeBSD and controlling an alarm via relay

another thing that puzzles me is power.
This board : http://www.ebay.co.uk/itm/USB-Eight-Channel-Relay-Board-RS232-Serial-Controlled-/110710333092?pt=UK_BOI_Electrical_Components_Supplies_ET&hash=item19c6d99ea4
needs VDC 12V supply
while this one : http://www.ebay.co.uk/itm/USB-Four-4-Relay-Module-Board-Home-Automation-/180646300804?pt=LH_DefaultDomain_0&hash=item2a0f5bcc84
is self powered from USB.

batteries do not come cheap, and having an extra AC/DC adaptor is not very good either ...

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

my specific application i want to drive is this wireless xmitter :
http://www.visonic.com/Data/Uploads/MCT_100_Installer_Guide_English_DE2241U.pdf
Should i assume my device that i want my relay to control will have voltage of 3V?

for which Voltage/Ampere figures should i opt? are those figures crucial?

thanx a lot
Post by Ian Smith
Post by Achilleas Mantzios
Post by Chris Hill
[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
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
Post by Achilleas Mantzios
Could i use the ucom driver to talk to the USB device like a normal serial device, via /dev/cua*** ?
8 Data, 1 Stop, No Parity,Baud rate : 9600
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
=======
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
Post by Achilleas Mantzios
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
--
Achilleas Mantzios
Achilleas Mantzios
2011-07-06 12:21:54 UTC
Permalink
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.
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
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

I had the above idea working 2-3 years back, with the following differences with regard to the above
a) a http://www.visonic.com/Products/Wireless-Property-Protection/Door-window-contact-mct-302 door/window
was used instead of the dedicated MCT-100 xmitter. MCT-302 had an additional hard-wired input (NO/NC/EOL) which behaved
like a distinct zone with its own xmitter, pretty much like the MCT-100 does. Problem with that was that the battery
went off too early and also the contact was completely damaged/malfunctioning 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.

b) instead of a dedicated-specialized relay board, i was utilizing an old ZyXel modem, which i had connected in series
with the MCT-302 NC circuit. Normally the ZyXel allowed for current to pass 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;

my $v = new Modem::Vgetty;

$v->device('DIALUP_LINE');
$v->send("ATH1");
sleep(2);
$v->send("ATH0");

This
$v->send("ATH1");
sleep(2);
$v->send("ATH0");
part seemed to do the trick just fine.

Thing, is that i am thinking these days, of trying either to re-do the old 1.23 zoneminder port for FreeBSD 8.2
or join ***@freebsd.org, in his effort to have a fully functioning zoneminder 1.24 port with local bktr camera support.
Along with that, i want to get rid of the old "MCT-302/ZyXel model" way and try something better and faster.

That is the whole story, i hope i made it clear enough :)
Post by Dale Kline
Hi,
I guess I don't understand your application here. The Visonic is a battery 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 opens or closes unexpectedly. The MCT100 has a three volt battery with an operating life of 45 - 50 months according to the spec. It does not need a voltage supply, nor would you want to turn it on and off during operation.
The green terminal blocks then connect to a floodlight (for example) that would turn ON after the UHF Receiver that is listening to the MCT100 Transmitter indicates that someone has opened or closed the door mentioned in the first paragraph.
Am I following what you want to do?
-----Original Message-----
Sent: Wednesday, July 06, 2011 5:50 AM
To: Ian Smith
Subject: Re: FreeBSD and controlling an alarm via relay
another thing that puzzles me is power.
This board : http://www.ebay.co.uk/itm/USB-Eight-Channel-Relay-Board-RS232-Serial-Controlled-/110710333092?pt=UK_BOI_Electrical_Components_Supplies_ET&hash=item19c6d99ea4
needs VDC 12V supply
while this one : http://www.ebay.co.uk/itm/USB-Four-4-Relay-Module-Board-Home-Automation-/180646300804?pt=LH_DefaultDomain_0&hash=item2a0f5bcc84
is self powered from USB.
batteries do not come cheap, and having an extra AC/DC adaptor is not very good either ...
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
http://www.visonic.com/Data/Uploads/MCT_100_Installer_Guide_English_DE2241U.pdf
Should i assume my device that i want my relay to control will have voltage of 3V?
for which Voltage/Ampere figures should i opt? are those figures crucial?
thanx a lot
Post by Ian Smith
Post by Achilleas Mantzios
Post by Chris Hill
[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
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
Post by Achilleas Mantzios
Could i use the ucom driver to talk to the USB device like a normal serial device, via /dev/cua*** ?
8 Data, 1 Stop, No Parity,Baud rate : 9600
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
=======
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
Post by Achilleas Mantzios
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
--
Achilleas Mantzios
Dale Kline
2011-07-06 12:35:07 UTC
Permalink
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 is straightforward. I could not tell if the MCT-100 is current or voltage driven, but it will work with the relay either way.
I'm not familiar with the zoneminder. I'll have to look into that. I wanted 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 software is a challenge that I am trying to learn. I am one very small step above absolute beginner with this FreeBSD code. But volts and amps and ohms, that I understand. :-)

-----Original Message-----
From: owner-freebsd-***@freebsd.org [mailto:owner-freebsd-***@freebsd.org] On Behalf Of Achilleas Mantzios
Sent: Wednesday, July 06, 2011 8:21 AM
To: Dale Kline
Cc: freebsd-***@freebsd.org; Chris Hill; Ian Smith; freebsd-***@freebsd.org
Subject: Re: FreeBSD and controlling an alarm via relay

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.
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
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

I had the above idea working 2-3 years back, with the following differences with regard to the above
a) a http://www.visonic.com/Products/Wireless-Property-Protection/Door-window-contact-mct-302 door/window
was used instead of the dedicated MCT-100 xmitter. MCT-302 had an additional hard-wired input (NO/NC/EOL) which behaved
like a distinct zone with its own xmitter, pretty much like the MCT-100 does. Problem with that was that the battery
went off too early and also the contact was completely damaged/malfunctioning 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.

b) instead of a dedicated-specialized relay board, i was utilizing an old ZyXel modem, which i had connected in series
with the MCT-302 NC circuit. Normally the ZyXel allowed for current to pass 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;

my $v = new Modem::Vgetty;

$v->device('DIALUP_LINE');
$v->send("ATH1");
sleep(2);
$v->send("ATH0");

This
$v->send("ATH1");
sleep(2);
$v->send("ATH0");
part seemed to do the trick just fine.

Thing, is that i am thinking these days, of trying either to re-do the old 1.23 zoneminder port for FreeBSD 8.2
or join ***@freebsd.org, in his effort to have a fully functioning zoneminder 1.24 port with local bktr camera support.
Along with that, i want to get rid of the old "MCT-302/ZyXel model" way and try something better and faster.

That is the whole story, i hope i made it clear enough :)
Post by Dale Kline
Hi,
I guess I don't understand your application here. The Visonic is a battery 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 opens or closes unexpectedly. The MCT100 has a three volt battery with an operating life of 45 - 50 months according to the spec. It does not need a voltage supply, nor would you want to turn it on and off during operation.
The green terminal blocks then connect to a floodlight (for example) that would turn ON after the UHF Receiver that is listening to the MCT100 Transmitter indicates that someone has opened or closed the door mentioned in the first paragraph.
Am I following what you want to do?
-----Original Message-----
Sent: Wednesday, July 06, 2011 5:50 AM
To: Ian Smith
Subject: Re: FreeBSD and controlling an alarm via relay
another thing that puzzles me is power.
This board : http://www.ebay.co.uk/itm/USB-Eight-Channel-Relay-Board-RS232-Serial-Controlled-/110710333092?pt=UK_BOI_Electrical_Components_Supplies_ET&hash=item19c6d99ea4
needs VDC 12V supply
while this one : http://www.ebay.co.uk/itm/USB-Four-4-Relay-Module-Board-Home-Automation-/180646300804?pt=LH_DefaultDomain_0&hash=item2a0f5bcc84
is self powered from USB.
batteries do not come cheap, and having an extra AC/DC adaptor is not very good either ...
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
http://www.visonic.com/Data/Uploads/MCT_100_Installer_Guide_English_DE2241U.pdf
Should i assume my device that i want my relay to control will have voltage of 3V?
for which Voltage/Ampere figures should i opt? are those figures crucial?
thanx a lot
Post by Ian Smith
Post by Achilleas Mantzios
Post by Chris Hill
[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
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
Post by Achilleas Mantzios
Could i use the ucom driver to talk to the USB device like a normal serial device, via /dev/cua*** ?
8 Data, 1 Stop, No Parity,Baud rate : 9600
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
=======
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
Post by Achilleas Mantzios
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
--
Achilleas Mantzios
Achilleas Mantzios
2011-07-06 12:42:09 UTC
Permalink
Cool man, thanx a lot, you and all the guys who answered were really really helpful.
Post by Dale Kline
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 is straightforward. I could not tell if the MCT-100 is current or voltage driven, but it will work with the relay either way.
I'm not familiar with the zoneminder. I'll have to look into that. I wanted 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 software is a challenge that I am trying to learn. I am one very small step above absolute beginner with this FreeBSD code. But volts and amps and ohms, that I understand. :-)
-----Original Message-----
Sent: Wednesday, July 06, 2011 8:21 AM
To: Dale Kline
Subject: Re: FreeBSD and controlling an alarm via relay
Hello, not quite.
1) FreBSD server runs zoneminder.
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
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
I had the above idea working 2-3 years back, with the following differences with regard to the above
a) a http://www.visonic.com/Products/Wireless-Property-Protection/Door-window-contact-mct-302 door/window
was used instead of the dedicated MCT-100 xmitter. MCT-302 had an additional hard-wired input (NO/NC/EOL) which behaved
like a distinct zone with its own xmitter, pretty much like the MCT-100 does. Problem with that was that the battery
went off too early and also the contact was completely damaged/malfunctioning 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.
b) instead of a dedicated-specialized relay board, i was utilizing an old ZyXel modem, which i had connected in series
with the MCT-302 NC circuit. Normally the ZyXel allowed for current to pass through the circuit.
vm shell -l cuad1 -S offhook_onhook.pl
(vm comes with mgetty)
#!/usr/bin/perl
#
use Modem::Vgetty;
my $v = new Modem::Vgetty;
$v->device('DIALUP_LINE');
$v->send("ATH1");
sleep(2);
$v->send("ATH0");
This
$v->send("ATH1");
sleep(2);
$v->send("ATH0");
part seemed to do the trick just fine.
Thing, is that i am thinking these days, of trying either to re-do the old 1.23 zoneminder port for FreeBSD 8.2
Along with that, i want to get rid of the old "MCT-302/ZyXel model" way and try something better and faster.
That is the whole story, i hope i made it clear enough :)
Post by Dale Kline
Hi,
I guess I don't understand your application here. The Visonic is a battery 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 opens or closes unexpectedly. The MCT100 has a three volt battery with an operating life of 45 - 50 months according to the spec. It does not need a voltage supply, nor would you want to turn it on and off during operation.
The green terminal blocks then connect to a floodlight (for example) that would turn ON after the UHF Receiver that is listening to the MCT100 Transmitter indicates that someone has opened or closed the door mentioned in the first paragraph.
Am I following what you want to do?
-----Original Message-----
Sent: Wednesday, July 06, 2011 5:50 AM
To: Ian Smith
Subject: Re: FreeBSD and controlling an alarm via relay
another thing that puzzles me is power.
This board : http://www.ebay.co.uk/itm/USB-Eight-Channel-Relay-Board-RS232-Serial-Controlled-/110710333092?pt=UK_BOI_Electrical_Components_Supplies_ET&hash=item19c6d99ea4
needs VDC 12V supply
while this one : http://www.ebay.co.uk/itm/USB-Four-4-Relay-Module-Board-Home-Automation-/180646300804?pt=LH_DefaultDomain_0&hash=item2a0f5bcc84
is self powered from USB.
batteries do not come cheap, and having an extra AC/DC adaptor is not very good either ...
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
http://www.visonic.com/Data/Uploads/MCT_100_Installer_Guide_English_DE2241U.pdf
Should i assume my device that i want my relay to control will have voltage of 3V?
for which Voltage/Ampere figures should i opt? are those figures crucial?
thanx a lot
Post by Ian Smith
Post by Achilleas Mantzios
Post by Chris Hill
[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
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
Post by Achilleas Mantzios
Could i use the ucom driver to talk to the USB device like a normal serial device, via /dev/cua*** ?
8 Data, 1 Stop, No Parity,Baud rate : 9600
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
=======
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
Post by Achilleas Mantzios
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
--
Achilleas Mantzios
Ian Smith
2011-07-06 12:40:29 UTC
Permalink
Hi Achilleas,
Post by Achilleas Mantzios
another thing that puzzles me is power.
This board : http://www.ebay.co.uk/itm/USB-Eight-Channel-Relay-Board-RS232-Serial-Controlled-/110710333092?pt=UK_BOI_Electrical_Components_Supplies_ET&hash=item19c6d99ea4
needs VDC 12V supply
while this one : http://www.ebay.co.uk/itm/USB-Four-4-Relay-Module-Board-Home-Automation-/180646300804?pt=LH_DefaultDomain_0&hash=item2a0f5bcc84
is self powered from USB.
batteries do not come cheap, and having an extra AC/DC adaptor is not very good either ...
That 4-relay one might better suit your application then, if FreeBSD usb
recognises it. It seems to use the same (FTDI?) drivers under windows
as the other one, but I know almost nought about USB device detection.
Post by Achilleas Mantzios
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
http://www.visonic.com/Data/Uploads/MCT_100_Installer_Guide_English_DE2241U.pdf
Should i assume my device that i want my relay to control will have voltage of 3V?
for which Voltage/Ampere figures should i opt? are those figures crucial?
5V / 72mA is the relay solenoid drive current. 4 of these switched on
would use ~300mA, leaving 100mA for the other board circuitry. The 12V
board's relays use the same drive power, 360mW, ie 12V @ 30mA.

The relay switched contacts are rated at 12VDC to 15A (180W) or 240VAC
to 10A (2.4kW!), whereas your MCT 100 is only watching for NC contacts
to open; closed circuit current will be a few mA at most and you won't
see more than 5V over the open contacts .. ie, not an issue.
Post by Achilleas Mantzios
thanx a lot
A pleasure.

cheers, Ian
Achilleas Mantzios
2011-07-18 07:28:21 UTC
Permalink
Hello again, It worked!
Just to recap on the hardware used and the architecture of the whole setup:

Camera ( simple analog wired (coaxial cable)) is sending video to Kodicom KMC-4400R video card
the video is analyzed via Zoneminder, and a separate deamon in perl polls the shared memory
with zoneminder to check for alarm/alert caused by motion detection.
Upon motion detection, the daemon drives this USB relay board:
http://cgi.ebay.co.uk/USB-8-Channel-Relay-Board-RS232-Serial-controlled-/280591766649?_trksid=p5197.m7&_trkparms=algo%3DLVI%26itu%3DUCI%26otn%3D1%26po%3DLVI%26ps%3D63%26clkid%3D1423565781848187460
(FTDI based), using simple echo commands like:
#!/usr/local/bin/bash
echo -e "\xFF\x01\x01" > /dev/cuaU0
sleep 1
echo -e "\xFF\x01\x00" > /dev/cuaU0
However, the above when tested with Ubuntu 11, didnt work out of the box until i set baudrate explicitly to 9600.
In FreeBSD worked at once, just by running the above script.
Now, two of the relay board NC outputs (circuits) are connected to the two inputs (loops) in
http://www.visonic.com/Products/Wireless-Property-Protection/Universal-transmitter-mct-100
(the two circuits are defined as being "EOL" type, not NC)
which in turn talks to
http://www.visonic.com/Products/Wireless-Property-Protection/PowerMaxPlus

I have two cameras, and i use them as two separate zones. I think it works good,
and at least for interior spaces, i think motion detection via video is more reliable
than IR detectors, because in the summer IR struggle to detect motion when
ambient temperature is close to the human temperature.
(In exterior spaces, video motion detection is problematic due to large birds, insects, etc,
while exterior IR motion detection is by default unreliable)

Thank you all!
Post by Ian Smith
Hi Achilleas,
Post by Achilleas Mantzios
another thing that puzzles me is power.
This board : http://www.ebay.co.uk/itm/USB-Eight-Channel-Relay-Board-RS232-Serial-Controlled-/110710333092?pt=UK_BOI_Electrical_Components_Supplies_ET&hash=item19c6d99ea4
needs VDC 12V supply
while this one : http://www.ebay.co.uk/itm/USB-Four-4-Relay-Module-Board-Home-Automation-/180646300804?pt=LH_DefaultDomain_0&hash=item2a0f5bcc84
is self powered from USB.
batteries do not come cheap, and having an extra AC/DC adaptor is not very good either ...
That 4-relay one might better suit your application then, if FreeBSD usb
recognises it. It seems to use the same (FTDI?) drivers under windows
as the other one, but I know almost nought about USB device detection.
Post by Achilleas Mantzios
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
http://www.visonic.com/Data/Uploads/MCT_100_Installer_Guide_English_DE2241U.pdf
Should i assume my device that i want my relay to control will have voltage of 3V?
for which Voltage/Ampere figures should i opt? are those figures crucial?
5V / 72mA is the relay solenoid drive current. 4 of these switched on
would use ~300mA, leaving 100mA for the other board circuitry. The 12V
The relay switched contacts are rated at 12VDC to 15A (180W) or 240VAC
to 10A (2.4kW!), whereas your MCT 100 is only watching for NC contacts
to open; closed circuit current will be a few mA at most and you won't
see more than 5V over the open contacts .. ie, not an issue.
Post by Achilleas Mantzios
thanx a lot
A pleasure.
cheers, Ian
--
Achilleas Mantzios
Ian Smith
2011-07-18 09:46:09 UTC
Permalink
Post by Achilleas Mantzios
Hello again, It worked!
Excellent!
Post by Achilleas Mantzios
Camera ( simple analog wired (coaxial cable)) is sending video to Kodicom KMC-4400R video card
the video is analyzed via Zoneminder, and a separate deamon in perl polls the shared memory
with zoneminder to check for alarm/alert caused by motion detection.
http://cgi.ebay.co.uk/USB-8-Channel-Relay-Board-RS232-Serial-controlled-/280591766649?_trksid=p5197.m7&_trkparms=algo%3DLVI%26itu%3DUCI%26otn%3D1%26po%3DLVI%26ps%3D63%26clkid%3D1423565781848187460
#!/usr/local/bin/bash
echo -e "\xFF\x01\x01" > /dev/cuaU0
sleep 1
echo -e "\xFF\x01\x00" > /dev/cuaU0
However, the above when tested with Ubuntu 11, didnt work out of the
box until i set baudrate explicitly to 9600.
In FreeBSD worked at once, just by running the above script.
That'll be because FreeBSD uses 9600 baud as the default serial rate.
Post by Achilleas Mantzios
Now, two of the relay board NC outputs (circuits) are connected to the two inputs (loops) in
http://www.visonic.com/Products/Wireless-Property-Protection/Universal-transmitter-mct-100
(the two circuits are defined as being "EOL" type, not NC)
which in turn talks to
http://www.visonic.com/Products/Wireless-Property-Protection/PowerMaxPlus
I have two cameras, and i use them as two separate zones. I think it works good,
and at least for interior spaces, i think motion detection via video is more reliable
than IR detectors, because in the summer IR struggle to detect motion when
ambient temperature is close to the human temperature.
Indeed, in late summer here the humans would show up as cool spots :)
Post by Achilleas Mantzios
(In exterior spaces, video motion detection is problematic due to large birds, insects, etc,
while exterior IR motion detection is by default unreliable)
Thank you all!
Thanks for news and feedback. Good to know that those relay boards work
erll with FreeBSD .. I have an upcoming project that could use these.

cheers, Ian

Loading...