Issue
93 April 1998
Picaro:
A Stamp-like Interpreted Controller
by
Tom Napier
For
years, Toms been itching to control the instruction
sets of processors. Using a PIC, some memory, and
an interpreter, he bypasses the processor hurdle
and writes his own language. He shows you how to
do it, too.
The
ODU provides the information that the PLU uses to predict
future activity. While it may seem like a no-brainer
to detect occupancy in software (assuming hardware input
like a motion detector), the task is tougher than it
looks if you want to do it well. In fact, its
difficult to know for certain that no one is in the
area.
The
problem is this: when motion activity ceases for a period
of time, how do you know what has happened? Are the
occupants gone? Or is there someone there who is simply
inactive? The trick to solving this problem is by detecting
two different types of activityinterior activity
and entry/exit activity.
As
shown in Figure 1, you can accomplish this task by monitoring
the door(s)of an area (via door switches used in the
security industry) and also monitoring the interior
of the area via motion detection. Any time an entry/exit
door is opened, this signals a potential change of occupancy.
As
Figure 2 illustrates, its not hard to figure out
whether people are coming or going. If there is no motion
detection following activity at the door, then someone
must have left.
Conversely,
if motion detection simply ceases without any door activity,
then the area is not really unoccupied. Instead, the
occupants must have retired to an inactive state even
though they are still in the building or area.
Clearly,
the accuracy of this method is tied directly to the
quality of motion-detector coveragethe more the
better. For a typical house or small office, simply
covering the main traffic area gives good results. Using
motion detection in every room gives near-perfect performance.
In
the algorithm, the search process starts when the entry/exit
door is used. After the door closes, we look for motion
for a period of time. If there is motion activity, then
clearly someone is still on the premises. If not, then
you may declare the area unoccupied.
The
time period used can vary, but a good figure is in the
ten-minute range. The delay period is a tradeoff. Too
little time and you find that the area is frequently
declared unoccupied, only to have this decision reversed
a short time later when an occupant emerges from some
back room. Too much delay time and energy savings are
reduced while the algorithm waits for occupants who
may never appear.
One
issue that affects the ODU is the phenomenon of slow
motion-detector release. As you might imagine, the occupancy-detection
algorithm is going to start looking for motion detection
as soon as the door closes. The problem is that some
motion detectors stay tripped for a relatively long
time after motion ceases (up to 6 or 8 s). This causes
a problem when the slow motion detector is located near
the entry/exit door.
While
leaving, the occupant trips the detector, opens the
door, steps out, and closes the door. Unfortunately,
the motion detector is still triggered even though the
occupant has stepped out and closed the door! You can
see this in Figure 2a as the overshoot relative to the
door timing.
This
problem forced me to add a blanking window to the algorithm
so that the real search for motion is delayed by a few
seconds. Typically, a value of 6 s works well. Any more
than that and the algorithm often fails to detect when
someone arrives and passes through the motion-sensing
area too quickly.
When
that happens, the system sees the arrival but turns
around and looks for evidence of someone leaving (remember,
door operation starts the test process). When the system
sees no motion activity, except what took place during
the blanking period, it assumes that the person left
again. So, the blanking window has to be set carefully.
Another
type of problem can also arise. A false unoccupied state
can be declared when someone leaves the area while another
person, who has been inactive all along, remains hidden
from motion detection. Clearly, because of this weakness,
the technique should be used with great care.
Many
types of automatic responses (e.g., arming a security
system) should not be implemented. While the systems
performance can be increased by adding more motion detection,
there is still always the possibility (especially where
occupants may be sleeping) of a misfire. So dont
use this technique recklessly.