|
Description  |
|
|
NOTICE REGARDING COPYRIGHTED MATERIAL
A portion of the disclosure of this patent document contains material which
is subject to copyright protection. The copyright owner has no objection
to the facsimile reproduction by anyone of the patent document or the
patent disclosure as it appears in the Patent and Trademark Office file or
records, but otherwise reserves all copyright rights whatsoever.
FIELD OF THE INVENTION
The present invention relates generally to a sound activated switch. More
specifically, the present invention relates to a sound activated switch
that independently operates two or more electrical appliances by
activating power switches after detecting different series of audio
signals.
BACKGROUND OF THE INVENTION
In today's society convenience is almost a necessity. Manufacturers gear
entire product lines to satisfy society's need for convenience. One common
market that manufacturers have targeted with convenience in mind has been
the market for electric and electronic appliances. Many people will elect
not to use an electrical appliance such as a television or light, if they
must walk across a room to turn the television or light ON. Thus,
manufacturers have developed devices that remotely control and operate
almost all electronic appliances.
Unfortunately, most remotely controlled appliances require a person to
possess a remote control unit to operate the appliance. The requirement of
possession in itself can be a major inconvenience. Often a person must
walk across a room to retrieve the remote control unit, and frequently it
may be misplaced, which, at best, requires extra time and effort to find.
To solve the problems associated with hand-held remote control units, some
manufacturers have developed sound activated switches. There are a number
of sound activated switches available for sale. Typically these devices
turn electrical appliances ON and OFF in response to a specific sound.
Some sound activated switches operate from hand-held sound generators.
These devices, however, suffer from the same problem as other remote
control units--possession of the controller is required before it can be
used. Other sound activated devices operate in response to sounds
physically produced by a person such as two closely spaced claps. These
devices are very useful in solving the problems associated with the
previously described remote control units and are especially useful to
handicapped persons who have difficulty moving around a room.
However, one disadvantage associated with some of the currently available
devices that are activated by hand-clapping or similar sound signals is
that only a single sound-activated switch can operate in any given room
unless all the controlled electrical accessories in that room are to be
turned ON at the same time. Even in this case, one sound-activated switch
may be slightly more sensitive than another or the switches may be placed
in such a position that a series of hand claps will operate only one of
the switches in the room. Thus, if a person tries a second time to operate
a sound activated switch that did not activate the first time, the first
switch may switch an appliance back ON when the second switch switches an
appliance OFF.
Additionally, some prior art devices require manual adjustment to the
acoustics of a room to function properly. If an inexperienced operator
does not make the adjustments properly, appliances could be turned ON and
OFF by unintended control signals, which is both frustrating and annoying.
SUMMARY OF THE INVENTION
The present invention solves the problems associated with the prior art by
providing an acoustic switch that is operable without requiring a sound
generating unit and that is able to independently operate two or more
electronic appliances. A preferred embodiment of the present invention is
an acoustic switch that is able to control two electrical appliances by
recognizing and distinguishing between different preprogrammed series of
acoustic signals such as hand-clapping sounds. The acoustic switch can
independently operate the two electrical appliances by operating one
appliance on recognition of a first series of acoustic signals and the
second appliance on recognition of a second series of acoustic signals.
Another advantage of the present invention is that it provides for the
manual selection of operating modes. In addition to its normal operating
mode, the acoustic switch is operable in an away/intruder mode and in a
learn mode. In the away/intruder mode, the acoustic switch will switch
appliances ON upon the detection of any noise, while the absence of noise
for a specified period of time will cause the acoustic switch to switch
the appliances OFF.
In learn mode, it is possible to teach the invention, through its
microcontroller, to remember a specific sequence of claps to operate one
or more appliances. The acoustic switch can be programmed to operate in
response to many different clap sequences. For example, two to five claps,
or two claps then a pause and a third clap, or any combination of claps
and pauses, can activate an appliance. Once the acoustic switch has been
programmed to the desired clap sequence and placed in its normal operating
mode, it will activate only to the newly learned sequence. In one
embodiment of the present invention, the acoustic switch produces an
audible beep to alert the user that the switch has successfully learned a
new clap sequence.
In one embodiment, the present invention is configured as a small plastic
housing that plugs directly into a wall outlet. Additional outlets on the
box permit the attachment of two appliances, such as lamps, televisions,
or fans. In the simplest mode of operation, two claps will turn one
appliance ON and OFF, while three claps will turn a second appliance ON
and OFF without operating the first-appliance. In other embodiments, it is
possible for the invention to be designed to independently operate more
than two appliances with different clap sequences.
Additionally, the invention is supplied with neon lamps that indicate when
an appliance that is turned ON is connected to the acoustic switch.
The features and advantages of an acoustic switch according to the present
invention will be more clearly understood from the following description
taken in conjunction with the accompanying drawings.
BRIEF DESCRIPTION OF THE DRAWINGS
FIG. 1 is a perspective view of a preferred embodiment of the acoustic
switch according to the present invention;
FIG. 2 is a block diagram of the electronic circuit of the embodiment of
FIG. 1; and
FIG. 3, 3A, and 3B are flowcharts of the functionality of the software
program that controls one embodiment of the present invention.
DETAILED DESCRIPTION OF THE INVENTION
FIG. 1 is a perspective view of a preferred embodiment of an acoustic
switch 20 according to the present invention. Acoustic switch 20 is used
to independently operate two electrical appliances. As shown in FIG. 1,
acoustic switch 20 plugs into a conventional electrical wall outlet 22.
Electrical appliances 24 and 26 are then plugged into receptacles 28 and
30 using electric line cords 32 and plugs 34.
A microphone placed behind a microphone opening 36 receives acoustic
signals from an area surrounding acoustic switch 20. Upon receipt of a
specific first series of acoustic signals, acoustic switch 20 operates
appliance 24 by supplying or depriving the appliance of electricity thus
switching it ON or OFF. Upon receipt of a specific second series of
acoustic signals, different from the first series, acoustic switch 20
operates appliance 26 by switching the appliance ON or OFF.
Indicators 38 and 40 indicate whether appliances 24 and 26 are plugged into
receptacles 28 and 30, respectively. When appliances 24 and 26 are
connected to receptacles 28 and 30, respectively, indicators 38 and 40,
will be illuminated if the appliance is turned ON and acoustic switch 20
has switched it OFF.
Mode selector switch 42 allows a user to set the acoustic switch in one of
two operating modes: normal operating mode or away/intruder mode. In a
second embodiment of the present invention, mode selector 42 allows a user
to set the acoustic switch in a learn mode in addition to the normal and
away/intruder modes.
FIG. 2 is a block diagram of one embodiment of the electronic circuit for
acoustic switch 20 depicted in FIG. 1. The electronic circuit for acoustic
switch 20 comprises a sound detector 50, a filter 52, an amplifier 53,
peak detectors 54 and 56, a microcontroller 58, a mode selector 60, a
default acoustic signal selector 64, power switches 66 and 68, output
receptacles 70 and 72, and indicator lamps 74 and 76.
Microcontroller 58 is a programmable microcontroller that comprises an
analog-to-digital converter, a timer, a ROM memory, and a RAM memory.
Sound detector 50 has an output coupled to an input of filter 52 and an
input of amplifier 53 which has an output coupled to an input of peak
detector 54. An output of filter 52 is coupled to an input of peak
detector 56. Peak detectors 54 and 56 both have outputs coupled to
respective inputs of the analog-to-digital converter of microcontroller
58. Microcontroller 58 has an input coupled to mode selector 60 and an
input coupled to an output of default acoustic signal selector 64.
Microcontroller 58 also has outputs coupled to inputs of power switches 66
and 68. Power switches 66 and 68 have outputs coupled to output
receptacles 70 and 72 and outputs coupled to indicators 74 and 76,
respectively.
The operation of one embodiment of acoustic switch 20 is as follows.
Acoustic signals are detected at sound detector 50, which converts the
acoustic signals into electrical signals. The electrical signal output of
sound detector 50 is simultaneously fed into filter 52 and amplifier 53.
Filter 52 is a bandpass filter that amplifies the output of sound detector
50 and filters electrical signals corresponding to sounds outside the
frequency range of 2200 to 2800 hertz, which is the predominate frequency
range of a typical hand clap. The output of filter 52 is fed into peak
detector 56 which detects and holds the peak amplitudes of the signal
output from filter 52. The analog output of peak detector 56 is then input
to an analog input of microcontroller 58 where it is converted to a
digital signal.
Amplifier 53 amplifies the unfiltered output of sound detector 50. Peak
detector 54 detects and holds the peak amplitudes of the amplified,
unfiltered signal output from sound detector 50, and the analog output of
peak detector 56 is input to a second analog input of microcontroller 58
where it is converted to a digital signal. The output of peak detector 54
is used in detecting noise during the away/intruder mode, while the output
of peak detector 56 is used to detect sounds associated with claps. In
another embodiment, the two signals output from peak detectors 54 and 56
can be compared to allow microcontroller 58 to adjust its sensitivity to
background noise.
Microcontroller 58 receives input signals from mode selector 60 and default
acoustic signal selector 64. Mode selector 60 is a two position switch
that allows a user to choose to operate acoustic switch 20 in one of two
operating modes that include a normal operating mode and an away/intruder
mode. In other embodiments mode selector 60 can be a potentiometer or
similar device.
Default acoustic signal selector 64 is a jumper that can be positioned in
two different positions. In the first position, default acoustic signal
selector 64 causes acoustic switch 20 to operate power switch 66 on a
two-clap sequence and power switch 68 on a three-clap sequence. In the
second position, default acoustic signal selector 64 causes acoustic
switch 20 to operate power switch 66 on a three-clap sequence and power
switch 68 on a four-clap sequence. Another embodiments of the present
invention does not include a default acoustic signal selector and thus
does not allow a choice of which clap sequences operate appliances. While
still other embodiments include default acoustic signal selectors that
have three or more positions allowing a user to select from three or more
different sets of claps sequences to operate appliances.
Microcontroller 58 controls the operation of power switches 66 and 68.
Microcontroller 58 outputs signals that operate power switches 66 and 68
and enable the switches to operate electrical appliances plugged into
output receptacles 70 and 72, respectively.
Indicator 74 is a neon lamp coupled across power switch 66 that lights up
to indicate when an appliance connected at output receptacle 70 is turned
ON but switched OFF by acoustic switch 20. Indicator 76 is a neon lamp
coupled across power switch 68 that lights up to indicate when an
appliance connected at output receptacle 72 is turned 0N but switched OFF
by acoustic switch 20. Other embodiments of the present invention can use
light emitting diodes or similar devices in place of the neon lamps.
FIG. 3 is a flowchart of the functionality of the acoustic switch system
according to one embodiment of the present invention. Upon startup, the
system performs an initialization routine in block 100. The initialization
routine includes the steps of setting up variables that are not
time-dependent, determining if the AC lines being used by acoustic switch
20 are 50 or 60 Hertz, and setting up all time-dependent variables based
on the line frequency. In block 103, the system determines if acoustic
switch 20 is operating in away/intruder mode or normal mode by examining
mode selector 60.
When acoustic switch 20 is operating in normal mode, a first series of
claps will operate power switch 66 and a second series of claps, different
than the first series, will operate power switch 68. When acoustic switch
20 is in away/intruder mode, any frequency sound of sufficient intensity
will activate both power switches 66 and 68.
In normal mode, block 106 checks to see if acoustic switch 20 was operating
in away/intruder mode last time the system checked the mode. This would be
the case if mode selector 60 was just switched to normal mode. If acoustic
switch 20 was previously operating in away/intruder mode, all timing
variables used in normal mode are reset to default values by block 109. At
block 112, the output of sound detector 50 after it passes through filter
52 and peak detector 56 is sampled.
In block 115, the signal from block 112 is analyzed to determine if a clap
occurred. In determining if a clap occurred, the system looks at the first
instant the sampled input rises above a minimum threshold clap level of
1.28 volts. This threshold level is exceeded when sound detector 50
produces an output voltage of 466 microvolts in response to the presence
of a clap sound at the input of sound detector 50. If, after 200
milliseconds, the sampled input is above the threshold clap level two or
more times before the next clap occurs, the first clap is rejected as
noise. Otherwise, it is a valid clap.
If the processor detects that a clap sound has been detected in block 115,
the time the clap occurred is saved in block 118. The system then checks
to see if previous claps have been detected in block 121, which means that
the clap window is already open. The clap window is a 1.5 second time
interval that starts with the detection of a first clap. Acoustic switch
20 counts the number of claps that occur during the 1.5 second clap window
when determining if an actionable clap sequence is detected. If this is
the first clap, then the clap window timer is set to 1.5 seconds and other
timing variables are set in block 124. If this is not the first clap, the
clap window timer and other timing variables are decremented in block 127.
If no clap is detected in block 115, the system checks to see if the clap
window timer is already on in block 130. If not, the system returns to
block 103. Otherwise, the clap window timer and other timing variables are
decremented in block 127. Block 133 checks whether the clap window timer
has expired. If it has not, the system returns to block 103. If the clap
window has expired, the system proceeds to determine if an actionable clap
sequence was detected.
In block 136, the system checks to see if two and only two claps were
recorded during the clap window, and if the claps were correctly spaced.
Acoustic switch 20 counts the number of claps that occur during the clap
window and calculates how far the claps are spaced apart. For the two-clap
check to be affirmative, acoustic switch 20 must detect two and only two
claps during the clap window and the two claps must be spaced 584.+-.217
milliseconds apart.
If there were exactly two correctly timed claps, the system examines
default acoustic signal selector 64 in block 139. If default acoustic
signal selector is in position 1, power switch 66 is toggled in block 142.
To toggle a power switch, the system checks whether it is already ON. If
the power switch is ON, it is turned OFF; and if the power switch is OFF,
it is turned ON. After power switch 66 is toggled, the system returns to
block 103. If default acoustic signal selector 64 is not in position 1, it
is in position 2. The clap sequence is then rejected as an invalid clap
sequence, and the system loops back to block 103.
In block 145, the system checks to see if three appropriately timed claps
were recorded during the clap window. The first step in determining if the
three-clap check is affirmative, is to determine if exactly three claps
were recorded during the clap window. If exactly three claps were not
recorded, the three-clap check of block 145 fails. If three claps were
recorded, the second step is to determine if the claps were correctly
spaced. The system calculates the shortest time gap between any two of the
claps and then uses that gap as a reference time, X. For the three-clap
check to be affirmative, all three claps must be spaced X.+-.217
milliseconds apart. If the three claps are not correctly timed, block 145
fails. If the timing of the three claps is correct, default acoustic
signal selector 64 is examined in block 148. When default acoustic signal
selector 64 is set to position 1, power switch 68 is toggled in block 151.
Otherwise, default acoustic signal selector 64 is at position 2 and power
switch 66 is toggled in block 154. After toggling either power switch 66
or power switch 68, the system loops back to block 103.
In block 157, the system checks to see if exactly four claps were recorded.
The first step in determining if the four-clap check is affirmative, is to
determine if exactly four claps were recorded during the clap window. If
four claps were not recorded, the four-clap check of block 157 fails. If
four claps were recorded, the second step is to determine if the claps
were correctly spaced. The system calculates the shortest time gap between
any two of the claps and then uses that gap as a reference time, X. For
the four-clap check to be affirmative, all four claps must be spaced
X.+-.217 milliseconds apart. If the four claps are not correctly timed,
block 157 fails. If the timing of the four claps is correct, default
acoustic signal selector 64 is examined in block 160. When default
acoustic signal selector 64 is set to position 1, the sound sequence is
rejected and the system returns to block 103. Otherwise, default acoustic
signal selector 64 is at position 2 and power switch 68 is toggled in
block 163. Next, the system loops back to block 103.
If only one clap or more than four claps were recorded during the clap
window, the clap sequence is rejected and the system returns to block 103.
When acoustic switch 20 is operating in the away/intruder mode, block 166
checks if mode selector switch 60 was just switched. If it was, block 169
resets all the timing variables used in the away/intruder mode, turns OFF
power switches 66 and 68, and prevents a noise from activating the power
switches for one full second. At block 172, the unfiltered output of sound
detector 50 is sampled after it passes through peak detector 54.
Block 175 determines if acoustic switch 20 detects a noise of sufficient
signal strength to activate power switches 66 and 68. In determining if an
actionable noise is detected by acoustic switch 20, the system looks at
the unfiltered sound input using two different envelopes: a long attack
envelope and a short attack envelope. The short attack envelope responds
to changes in noise level very rapidly, while the long attack envelope
responds to noise level changes slowly. If a sound slowly increases in
intensity over a long time period, the short and long attack envelopes
will respond almost identically to the sound. Thus, the difference between
the two envelopes will be negligible and the impulse will be essentially
zero. However, if a sound occurs that has a sharp increase in intensity
over a short period of time, the short attack envelope will quickly
recognize the increased sound intensity while the long attack envelope
will slowly respond to the changed intensity. Therefore, the difference
between the two envelopes at a time T.sub.1 after the initial sound is
detected and at or near the sound's highest intensity level will be large
resulting in a large impulse value. If the impulse value (the difference
between the envelopes at a given time) is above a minimum threshold level
of 400 millivolts, which occurs when sound detector 50 produces an output
voltage of 400 microvolts in response to an external noise, an actionable
noise is detected.
Block 178 then checks whether or not power switches 66 and 68 are already
turned ON. When power switches 66 and 68 are not already ON, block 181
sets a first timer to fifteen minutes, block 184 sets a second timer to
approximately three and a half minutes, and block 187 toggles power
switches 66 and 68 to turn them ON. The first timer is used because
acoustic switch 20 will turn power switches 66 and 68 OFF after fifteen
minutes of the first noise being detected even if continuous noise is
detected throughout the fifteen minute period. The second timer is used
because acoustic switch 20 will turn power switches 66 and 68 OFF if after
three and a half minutes from detecting a noise, no other noise is
detected. After setting up the timers and switching power switches 66 and
68 ON, the system loops back to block 103.
When power switches 66 and 68 are already ON, block 190 decrements the
fifteen minute timer. Block 193 then checks whether the 15 minute timer
has timed out. If it has, block 196 toggles power switches 66 and 68 to
turn them OFF and keeps them OFF for one full second. The system then
loops back to block 103. If the fifteen minute timer has not expired,
block 199 resets the three and a half minute timer, and the system returns
to block 103.
If no noise or a noise of an insufficient level is detected at block 175,
block 202 checks whether power switches 66 and 68 are already ON. If they
are not ON, the system loops back to block 103. If power switches 66 and
68 are already ON, the fifteen minute timer is decremented by block 205.
Block 208 examines whether the fifteen minute timer has expired. If it
has, block 211 toggles power switches 66 and 68 to OFF and waits for one
complete second before allowing any further noise to activate power
switches 66 and 68. The system then returns to block 103.
If the fifteen minute timer has not expired in block 205, block 214
decrements the three and a half minute timer. Block 217 then checks
whether the three and a half minute timer has expired. If the three and a
half minute timer has expired, block 220 toggles power switches 66 and 68
to OFF, and the system returns to block 103. Otherwise, if the three and a
half minute timer has not expired at block 217, the system simply loops
back to block 103.
The present invention uses bilateral triode switches (triacs) for power
switches 66 and 68. Thus, the system stored in microcontroller 58 pulses
the gate of the triac to turn it ON. The triac must then be continuously
pulsed every positive and negative line crossing for it to stay ON. To
turn it OFF, the system simply stops pulsing the triac's gate. When
turning one of the triacs ON or keeping it ON, the system pulses the
triacs gate with a low signal for 4 microseconds then returns the gate to
high. Because some applications contain large inductive loads and might be
up to 90 degrees out of phase with the line voltage, the system
continuously pulses the triac's gates every 250 microseconds for about
4.5. milliseconds after each voltage zero crossing. This ensures that all
appliances are properly activated.
Additionally, a microphone is used for sound detector 50 and a three-stage
bandpass filter is used for filter 52. Each stage of the three-stage
filter has a gain of 14 at 2500 hertz. Thus, the overall gain of filter 52
is 2744 at 2500 hertz. The three-stage filter has an extremely sharp
roll-off, however, so that at 2200 or 2800 hertz, the gain of each stage
of the amplifier is 0.707 for an overall gain of 0.353. In this
embodiment, amplifier 53 has a gain of approximately 1000.
Table 1 illustrates an outline in pseudo code of the main subroutines that
make up one embodiment of the software system described in FIG. 3. The
program of Table 1 is set up as a sequence of tasks that execute in a
continuous loop. The subroutines are timed so that the filtered and
unfiltered outputs of sound detector 50 are sampled approximately every
millisecond. It also allows for the gates of triacs 66 and 68 to be pulsed
every 250 microseconds when the triacs are conducting current.
Attached to the end of the application as Appendix A is a listing of the
ROM source code for one embodiment of the program outlined in pseudo code
in table 1. The source code is stored in the ROM of microcontroller 58,
which is an 8-bit microcontroller chip by SGS Thompson, Model ST 6210. The
source code is compiled by the ST6 Macro-assembler, version 3.01--August
1990.
TABLE 1
______________________________________
This program is set up so that a sequence of tasks is
executed in a continuous loop. The timing of the tasks is
such that both the filtered and unfiltered inputs to
microcontroller 58 are continuously sampled every
millisecond.
POWER UP
Execute LINE Subroutine
MAIN LOOP
Execute TOGGLE Subroutine
Execute READ Subroutine
Execute FSOUND Subroutine
Execute TOGGLE Subroutine
Execute READ Subroutine
Execute ASOUND Subroutine
RETURN TO MAIN LOOP
LINE SUBROUTINE
Measure time elapsed between zero crossings of line
voltage for two seconds to determine if line is
60 or 50 hertz.
Load all registers related to line timing with
appropriate values based on line frequency.
RETURN
TOGGLE SUBROUTINE
If the toggle counter is loaded and either triac flag
is set, pulse appropriate triac gate signal low
for 4 microseconds then return signal high.
Decrement the toggle counter so that pulses extend to
4.5 milliseconds beyond each line voltage zero
crossing.
RETURN
READ SUBROUTINE
If positive line voltage half cycle
Execute TOGGLE Subroutine
Execute TIME Subroutine
Execute TOGGLE Subroutine
RETURN
If negative line voltage half cycle
Execute TOGGLE Subroutine
Execute MODE Subroutine
Execute COMPARE Subroutine
Execute TOGGLE Subroutine
RETURN
MODE SUBROUTINE
Determines if Mode Selector 60 is set to
away/intruder mode or normal mode.
If normal mode, RETURN
If away/intruder mode, look at the activate flag from
the COMPARE subroutine to turn the triacs ON or
keep the triacs ON -- when turning the triacs
ON, set the 3.5-minute and 15-minute timers.
If the triac flags are set and the activate flag was
not set during the last 3.5-minutes, turn the
triacs OFF.
If the triac flags are set and the activate flag is
set, reset the 3.5-minute timer.
If the 15 minute timer expires, turn the triacs OFF
for 1 full second before allowing them to be
reactivated.
RETURN
FSOUND SUBROUTINE
Reads voltage value from filtered peak detector
output and compares to a threshold value.
If voltage > threshold, starts timer for clap window
or stores the time of occurrence from a previous
clap if timer is already started.
After a 200 msec period from detecting a "clap",
compare sampled voltage to a calculated value (2
volts below maximum amplitude).
If more than 2 values > calculated value occur
before the next clap, the "clap" is
rejected as a clap and thought to be only
noise.
When the 1.2 second timer for the clap window
expires, the total number of claps during the
1.2 second period are counted.
If 2 claps, separation time = 584 msecs.
If 3 claps, separation time = the shortest time
difference between any two of the three
claps.
If 4 claps, separation time = the shortest time
difference between any two of the four
claps.
{CLAP calculations are continued in the second
half the ASOUND subroutine}
RETURN
TIME SUBROUTINE
Decrements all timing registers.
RETURN
ASOUND SUBROUTINE
Reads voltage level from unfiltered peak detector
output.
Calculates short attack, short decay envelope.
Calculates long attack, long decay envelope.
Difference between the envelopes is the impulse which
is used in the COMPARE subroutine.
{CLAP calculations are then continued from FSOUND}
If 2 claps separated by separation time .+-. 160
msec and default signal selector indicates
operate on 2 and 3 claps, invert the flag
for triac 1.
If 3 claps separated by separation time .+-. 160
msec and default signal selector indicates
operate on 2 and 3 claps, invert the flag
triac 2; otherwise, invert the flag for
triac 1.
If 4 claps separated by SEPARATION TIME .+-. 160
msec and default signal selector indicates
operate on 3 and 4 claps, invert the flag
for triac 2.
Else, reject clap sequence.
RETURN
COMPARE SUBROUTINE
Looks at the value of the impulse variable from
ASOUND and counts the number of occurrences of
the impulse > a threshold value. If there are 4
or more occurrences of impulse > the threshold,
the activate flag is set to activate the triacs.
RETURN
______________________________________
The program listed in table 1, comprises eight main subroutines: Line,
Toggle, Read, Time, Compare, Mode, Fsound, and Asound. Upon start-up, the
program executes the Line subroutine to determine if the AC line frequency
is 50 or 60 hertz. After calculating the line frequency, the Line
subroutine completes its execution by loading all the registers that hold
variables relating to line timing with values based on the line frequency.
Next, the program enters a loop that continuously executes the following
subroutines in the respective order: Toggle, Read, Fsound, Toggle, Read,
and Asound. The timing of the program is such that the Toggle subroutine
is executed approximately every 250 microseconds to ensure that triacs 66
and 68 continuously conduct current if appropriate.
The Toggle subroutine is run to turn triacs 66 and 68 ON and to ensure that
they continue to operate until they are turned OFF. When a triac is turned
ON, its flag is set in either the Asound or Fsound subroutines. The flag
for the 0N triac stays set throughout the execution of the program until
the triac is to be turned OFF, at which time the triac flag is reset. To
turn a triac ON and to keep it ON, the Toggle subroutine continuously
pulses the triac's gate low for 4 microseconds every 250 microseconds. The
pulses start every time the sinusoidal AC voltage changes polarity, and
they continue for a 4.5 millisecond period afterwards. As explained above,
this procedure is necessary to ensure that the triacs stay ON when they
are operating a large inductive load. The Toggle subroutine uses counters
to keep track of all of the necessary time sequences.
After the Toggle subroutine has completed, the Read subroutine is executed.
The Read subroutine reads and converts the voltage level from two
resistors that are not shown but are coupled to an input of
microcontroller 58. The value of the resistors is used to set the time of
the time-out function in away/intruder mode. Presently the resistors are
sized so that they provide a voltage drop at an input of microcontroller
58. The voltage drop is measured by microcontroller 58 and converted into
digital data which sets one of the away/intruder mode timers to 3.5
minutes. By changing the value of the resistors, the value of the 3.5
minute timer can be changed.
The Read subroutine also checks whether the line voltage is a positive half
cycle or a negative half cycle. When the line voltage is positive, the
following subroutines are executed in order: Toggle, Time, and Toggle
again. When the line voltage is negative, the Toggle subroutine is
executed followed by Mode, Compare, and then Toggle again.
The Time subroutine is used to decrement all time-based variables, while
the Compare subroutine is used to determine if acoustic switch 20 should
activate triacs 66 and 68 when operating in the away/intruder mode. The
Compare subroutine compares the impulse variable to a threshold value of
0.4 volts. When the impulse variable is greater than the threshold value
four or more times in a one second interval, an actionable noise has been
detected and the triac flags are set so that the triacs will be activated.
The Mode subroutine determines if acoustic switch 20 is operating in normal
mode or away/intruder mode. In normal mode, the program exits from the
subroutine without performing further steps. In away/intruder mode, the
program examines the activate flag from the Compare subroutine to
determine if the triacs should be turned ON. If the triacs are already ON
and the Compare subroutine did not set the activate flag during the last
three and a half minutes, the triacs are turned OFF. If the Compare
subroutine sets the activate flag while the triacs are ON, the three and a
half minute timer is reset. Finally, if the fifteen minute timer expires,
the Mode subroutine turns the triacs OFF and keeps them OFF for one full
second before allowing them to be operated by another noise.
The Fsound subroutine is executed after the completion of the Read
subroutine. At this point, the program reads the voltage level from the
output of peak detector 56 and compares it to a stored threshold value of
1.28 volts, which is the voltage that would be produced when sound
detector 50 produces a 466 microvolt output voltage in response to a clap.
If the sampled voltage is greater than the threshold voltage, timing
counters used to time clap sequences are loaded if this is the first
detected clap; otherwise, the time of occurrence from the first detected
clap is stored.
One timing counte | | |