August 3rd, 2012, 01:18 AM
Interfacing Perl to monitor a motion detector?
I've been acquainted with Perl in the past.. primarily for parsing text. I want to monitor and log the output of (1 or 2) motion detectors via Perl on my Linux PC. (I expect I'll have to condition the detector's output to be 'appropriate' for a PC port, maybe even one-shot it for a pulse.) I wonder if I should use a serial or parallel port? I'll want to log, with date, the events to a file, then sleep for about a minute then continue polling. Just a command line script, no GUI. I have Linux Mint9 on a PC of the DDR2 era. The Linux runs from a thumb drive. Serial or Parallel? Am I asking for trouble?
August 3rd, 2012, 08:01 AM
I'd have thought the motion detectors would already comply with some standard comms library? Have you purchased these detectors yet?
Another option might be X10 or Insteon kit, there are CPAN sources for this, I've not worked with them though.
without exception, there is no rule ...
Handmade Irish Jewellery
Targeted Advertising Cookie Optout (TACO) extension for Firefox
The great thing about Object Oriented code is that it can make small, simple problems look like large, complex ones
09 F9 11 02
9D 74 E3 5B
D8 41 56 C5
63 56 88 C0
Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems.
-- Jamie Zawinski
- the devil is in the detail, allegedly, and I use the term advisedly, allegedly ... oh, no, wait I did ...
BIT COINS ANYONE
August 4th, 2012, 05:12 AM
Hello, and thank you.. The detectors are being delivered. They aren't 'wireless' detectors such as X10 types, (which I also have) they are hybrid; PIR and microwave, to reduce false detections. I want to them to give me a look at each day's 'genuine' motion around my premises. Then I can search DVR camera results for that time frame to see if it was deer etc. My DVR's "motion detection" (visual only) is constantly being tripped by moths, birds, and reflections of passing autos.
Originally Posted by Axweildr
I believe the output of the detector is either/both of NC or NO contacts, or a 12v level. I was wanting to convert that output on a breadboard to an appropriate voltage (and isolation) such that it could present a 1 or a 0 on a port. I dearly want to connect a computer to "the outside world" hopefully without a proprietary type of protocol.
August 4th, 2012, 09:27 AM
I believe that communicating over a serial port or parallel port implies a certain intelligence on both sides of the cable. (And parallel is so ancient let's just talk about serial.)
A perl script can communicate with a serial device (stackoverflow), but that still implies something on the other end will respond to your requests for information.
And ideally, rather than you continuously polling for information, there would be a microprocessor on the other end that could recognize hardware interrupts and initiate the conversation when it had data to share.
So I recommend you check out Arduino and see if that would work for you. The boards appear to be inexpensive, and the software is available for all operating systems.
Edit: perl and arduino
Last edited by keath; August 4th, 2012 at 09:30 AM.
August 4th, 2012, 10:44 PM
That looks very interesting.. It might enable me to do more than log events. Thanks for the tip and a more stable alternative to my thoughts. This seems like the 'right' way to do what I want. I've seen the name Arduino while browsing but had no idea what it was. I hope to reply with an update on my project.
Thank you for the assistance!
August 11th, 2012, 07:45 PM
Ordered an arduino uno R3
Just an update.. I'm getting an Arduino Uno R3. As you probably know, it features a micro-P designed for a small proprietary C environment, and it looks as though it can be set up to port information to Perl. If this works I may have a new hobby! I'm already dusting off my O'Reilly books to revisit what I thought I remembered about Perl. They say your memory is the second thing to go.. I forgot what was first. Thanks!
An Update: I have the Uno and have it up on my Mint 10 Linux box. Looks like a Datalogger shield and some input into the digital pins might be all it takes to do my motion sensor task. There are already other things I have in mind for the Arduino. Looking good, and Thanks for the direction... and Axweilder too.. I didn't know that the motion sensors complied with a standard Comm library. There are wireless dual-tec models which I overlooked because I didn't think they were compatible with my console. Thanks, and I may be back with Perl questions..
Last edited by Rootjim; August 18th, 2012 at 03:58 AM.