ADICON Support Forum Applied Digital, Inc.
Page 1 of 1 1
Topic Options
#4215 - 10/27/03 01:30 PM Chime + Motion Detector
napoleon3rd Offline
journeyman


Registered: 04/28/03
Posts: 62
Loc: Spain
In my security program I use a line: "when motion detector 3 trips": the issue what I start encountering with CMAX and not with a more conventional set-up, is:
After the first time it will not "switch on", because "it's already on". So, do I need to put behind a "when motion detector 3 trips" place a line: "switch off" and then put the VCR on, I guess that I can't have the program to wait upon the standard functionality for auto-switch-off....

I guess the same happens with triggering the Chime....

Did I answer my own question in this debate, or am I missing out on something...it sounds a bit stupid...and it looks like that I am canceling all semi-automatic x10 functionality; a thing not needed when for example connecting a motion detector to a chime: it chime's each time you walk past without having to wait upon the timer to reset....

Top
#4216 - 10/27/03 02:41 PM Re: Chime + Motion Detector
Guy Lavoie Administrator Offline
Beyond All Hope
*****

Registered: 12/21/02
Posts: 6548
Loc: Montreal, QC, Canada
In cases like that, you need to use flags to keep track of whether things are already on or off so that you don't need to turn something off and back on just to keep every occurance the same. You'll want to use the conditional logic capabilities.
_________________________
"If you don't know what you're doing, do it neatly..."

Top
#4217 - 10/28/03 07:06 PM Re: Chime + Motion Detector
napoleon3rd Offline
journeyman


Registered: 04/28/03
Posts: 62
Loc: Spain
I have now added a sweep routine at the end of the program as the auto-switch off function of the x10 motion sensors is only driving me to miss out on future "hits": I want to reset my VCR counter each time the motin detector trips so that it continues to record the action.

OK, so now I have added a command:
If g7 = on
then g7 switch off

Question:
When I look at the x10 traffic monitor I see this command repeated 4-5 times. One would expect that when it's on, that x10 switches it off and gets over with it. I guess that I don't want to overflow the PLC to stay alert on other events in stead of delaying future operations.

In order to avoid multiple x10 commands doing the same on the PLC, I was thinking of the following:

If g7 = on
then timer # 20 = 1
If timer # 20 becomes > 0
then g7 switch off
then timer 3 20 = 0

I guess that this won't avoid either the multiple PLC traffice as there are still 4 or 5 loops in my program before the timer "turns up to a new second".

Any suggestions?
thanks

Top
#4218 - 10/29/03 03:07 AM Re: Chime + Motion Detector
John Warner Offline
old hand
*****

Registered: 01/09/03
Posts: 834
Loc: Port Perry, Ontario, Canada
It sounds like you are complicating this too much?

X10 MD's like the Hawkeye/Eagleye will not send a continuous stream of X10 ON Command pair's (I think there is about 10 seconds between detects). The ON is followed by an X10 Off Command Pair after the time selected when you set up the MD. You do not have send OFF's to them.

Here's the part of my driveway code that beeps a Universal module which may help you. As you will see, I need two detects from either of two Eagleyes to beep the UM:

[CODE] 0427 - IF X-10-G/9, ON Command Pair // Driveway EaglEye South
0428 - OR X-10-G/11, ON Command Pair // Driveway EaglEye North
0429 - AND Timer #12 is = 0 // First Detect
0430 - THEN Timer #12 = 1 // Set Timer
0431 - IF Timer #12 becomes > 15 // 15 seconds?
0432 - THEN Timer #12 = 0 // Then reset
0433 - IF X-10-G/9, ON Command Pair // Driveway EaglEye South
0434 - OR X-10-G/11, ON Command Pair // Driveway EaglEye North
0435 - AND Timer #12 is > 1 // And already have one detect
0436 - AND Variable #6 is < 2 // 1st time in 5 minutes
0437 - THEN X-10-I/2, Turn ON // UM506 Beeper
0438 - THEN Variable #6 + 1 // Detect Counter
0439 - IF Variable #6 becomes = 1 // Valid Detect
0440 - THEN Timer #4 = 1 // 5 Minute Timer
0441 - IF Variable #6 becomes = 1 // Valid detect
0442 - AND Time of Day is > Sunset offset -15 minutes // Within 15 minutes of Sunset
0443 - THEN X-10-M/10, Turn ON // Turn on Pot light
0444 - IF Timer #4 becomes > 300 // 5 minutes is up
0445 - THEN Timer #4 = 0 // Reset Timer
0446 - THEN Variable #6 = 0 // Reset First Time Flag
0447 - THEN X-10-M/10, Turn OFF // Turn Off Pot light [/CODE]And here's what happens in my Zeus Log (note J/3 and I/3 are in part of my code not shown here):

[CODE]10/29/2003 7:55:15 AM - (G/11) Driveway Alarm MD North: On
10/29/2003 7:55:16 AM - (J/3) Garage front PR511 MD : On
10/29/2003 7:55:19 AM - (I/3) Chime Module: On
10/29/2003 7:55:25 AM - (J/3) Garage front PR511 MD : Off
10/29/2003 7:55:34 AM - (G/9) Driveway Alarm MD South: On
10/29/2003 7:55:35 AM - (I/2) Driveway Alarm UM Beeper: On
10/29/2003 7:55:46 AM - (I/2) Driveway Alarm UM Beeper: Off
10/29/2003 7:55:48 AM - (I/2) Driveway Alarm UM Beeper: Off
10/29/2003 7:56:25 AM - (G/11) Driveway Alarm MD North: On
10/29/2003 7:56:55 AM - (G/9) Driveway Alarm MD South: Off
10/29/2003 7:57:41 AM - (G/11) Driveway Alarm MD North: Off [/CODE]

Top
#4219 - 10/29/03 08:58 AM Re: Chime + Motion Detector
napoleon3rd Offline
journeyman


Registered: 04/28/03
Posts: 62
Loc: Spain
John, yes, it sounds like that I am getting off track here.
I think that I now see what I may do wrong: I use "turns-on" and you use "on Command Pair".
I guess that I miss out on understanding the difference....

( The idea that I have in mind is to reset the timer each time when the MD trips, and to stop recording on VCR 2 minutes after last Dectect. )

- // =====================================
0158 - // Start Video Recording
0159 - // =====================================
0160 - //
0161 - IF Alarm-Armed is = 0 // Alarm has NOT been Armed
0162 - THEN Skip to line 185 // Skip Over Section
0163 - //
0164 - IF Timer-Duration-Video-Recording is = 0 // And VCR not yet Activated
0165 - AND X10-G10-Motion-IR, Turns ON // Motion Detected Zone 1
0166 - OR X10-G11-Motion-WideAngle-Kitchen, Turns ON // Motion Detected Zone 2
0167 - OR X10-G12-Motion-Cam-3, Turns ON // Motion Detected Zone 3
0168 - OR X10-G13-Motion-Cam-4, Turns ON // Motion Detected Zone 4
0169 - OR X10-G14-Motion-Cam-5, Turns ON // Motion Detected Zone 5
0170 - THEN Timer-Duration-Video-Recording = 1 // Start VCR Recording
0171 - //

Top
#4220 - 10/29/03 09:38 AM Re: Chime + Motion Detector
Guy Lavoie Administrator Offline
Beyond All Hope
*****

Registered: 12/21/02
Posts: 6548
Loc: Montreal, QC, Canada
[QUOTE]Originally posted by napoleon3rd:
[qb]John, yes, it sounds like that I am getting off track here.
I think that I now see what I may do wrong: I use "turns-on" and you use "on Command Pair".
I guess that I miss out on understanding the difference....

( The idea that I have in mind is to reset the timer each time when the MD trips, and to stop recording on VCR 2 minutes after last Dectect. )

[/qb][/QUOTE]The difference is that John's code is looking for the actual ON command pair coming in, regardless of whether an OFF command has been received or not beforehand. This is important for the application that John did and you yourself want to do. But first a bit of explanation:

The X10 motion sensors are designed to be standalone devices, that directly turn on an X10 light at the address it's set to, and then turn it off after a programmed interval of no movement detected. What you want to do is create what's known as a retriggerable "one shot" system, where as long as movement is detected within a certain time period, you want to light to stay on. Only when nothing has moved and the timing interval runs out do you want to turn it off. This is what John's code does. If you look at this code, you'll notice that he doesn't even care about the OFF command sent at the end of the motion detector's own timing interval, since all timing is handled within the C-Max code.

For your application (stop recording after 2 minutes of no movement detection), here is a way you could do it in pseudo code:

IF X10 ON Command Pair // if motion detector trips
AND Timer #1 = 0 //and timer was not running (first detection)
THEN Timer #1 = 1 //start inactivity timer
THEN Start recording //and start recording...

IF X10 ON Command Pair // if motion detector trips
AND Timer #1 > 1 //and timer is already running (ie: more movement detected)
THEN Timer #1 = 1 //restart inactivity timer count

IF Timer #1 becomes > 120 //if timer reaches 2 minutes
THEN Timer #1 = 0 //stop timer
THEN Stop recording //and stop recording

The first segment looks for a first activation of the detector and starts a timing period that the third segment checks for having reached 2 minutes. The second segment tests that if more ON command pairs are coming in while the 2 minute period is already underway, then more movement is occurring and the timer is set to 1 again, to begin a new, full 2 minute count. This can occur over and over again. Its only when the timer is allowed to reach 120 seconds (by no more movement restarting the count) is recording stopped (third segment). Note that nothing is statically ON or OFF regarding the motion detector, its only the ON command pairs caused by motion that we are looking for.
_________________________
"If you don't know what you're doing, do it neatly..."

Top
#4221 - 10/29/03 12:29 PM Re: Chime + Motion Detector
napoleon3rd Offline
journeyman


Registered: 04/28/03
Posts: 62
Loc: Spain
Thanks Guys for taking the effort to get me further into this.
The basic thing that I have learned (I think) is: the using the "if on command-pair" will trigger each time when an "on" signal is given, in disrespect of the actual status whether it was on or off.
My first coding was dependent upon shutting off and that requires this additional "off" command at the end of the loop as my application couldn't wait upon the pre-set time-out.
John's coding is appearantly not dependent upon this due to the use of "on command pair".
OK this is what I was exactly the answer that I was looking for.
I never understood the difference when looking at the CMAX options.think I got it now.

Basically I am not totally sure on the working on the multiple addressing, nor the pair-story; i.e. when to use what etc.

I saw that for example there is a way to shut off 5 cameras G3-g4-g5-g6-g7 by first adressing with 5 commands just the cameras and then with one command to shut the cameras all off at the same time through "G Off"; is that a right interpretation?

Top
#4222 - 10/29/03 12:45 PM Re: Chime + Motion Detector
Guy Lavoie Administrator Offline
Beyond All Hope
*****

Registered: 12/21/02
Posts: 6548
Loc: Montreal, QC, Canada
Yes that's right, as long as all the devices being addressed are on the same house code. A command pair sends an address followed by a command (commands always include the house code). For example:

G/1 ...address
G/ON ...command

or as you also stated, multiple addresses followed by a command.

G/1 ...address
G/2 ...address
G/3 ...address
G/ON ...command
_________________________
"If you don't know what you're doing, do it neatly..."

Top
Page 1 of 1 1


Moderator:  Dan Smith, Monte G, ADI Tech Support, Guy Lavoie 
Hop to:
Who's Online
0 registered and 60 anonymous users online.
Recent Posts
Ocelot Battery
by ADI Tech Support
09/22/17 07:38 AM
Comms Retry Error
by HDTVPete
09/18/17 04:04 PM
Cmax Message: Failed to set data for a 'delay'
by HDTVPete
09/16/17 04:36 PM
Shout Box

Newest Members
brigiel, vevevie, zhutree, 416, saiqul
3003 Registered Users
Forum Stats
3003 Members
19 Forums
4002 Topics
23435 Posts

Max Online: 132 @ 11/13/16 10:07 AM
September
Su M Tu W Th F Sa
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30