The document explains how to design a low cost PIR detector (human motion detector) using
the ST7FLITE05(09) microcontroller family. The technique used is software Sigma-D elta A/D
Convers ion, suit able for de tectin g low-fre quency sensor s ignals. Refer to A N1827 f or a detailed explanation of the Sigma-Delta technique. The same concept can also be used for other
sensor applications such as:
– Security Systems.
– Automatic lighting Systems
– Automatic Door Openers
Rev. 1.0
AN1828/03041/17
1ddd
PIR (PASSIVE INFRARED) DETECTOR USING ST7FLITE05/09/SUPERLITE
1 SENSOR OVERVI EW
The human body radiates infrared waves withwavelengths of 8 to 12 micrometers. Any movement by a person leads to a change in the amount of infrared energy which a sensor can detect within its range. The PIR sensor reacts to this change in infrared energy and provides a
low-frequency, small amplitude signal. This signal can be amplified and decoded using a
ST7Lite05 microcontroller (as explained in Section 1.2).
1.1 INFRARED FOCUSING BY FRESNEL LENS
The sensor can sense the change in the amount of infrared energy within small distances, approximately up to 10 inches . For detecting m ovements at longer distance, infr ared radiation
has to be focused. This focusing is done by a Fresnel lens. A Fresnel lens divides the whole
area into different zones. Any movement between zones leads to a change in the IR (infrared)
energy received by the sensor. There are different types of Fresnel lenses depending on the
range (distance) and coverage angle. For example, volumetric lenses and curtain lenses etc.
1.2 PIR DETECTOR USING ST7FLITE05 MICROCONTROLLER
APIR detector can be made easily with ST7FLITE05 using the circuit shown in Figure 2. The
sensor interfacing circuit (shown on the left side of the microcontroller in Figure 2) can be di-
vided into the following modules:
1.Transistor circuit used as an amplifier.
2.Transistor biasing controlled through the microcontroller.
3. Software-controlled transistor output.
Figure 1. Block Diagram
PIR sensorRC
Integrator
Transistor
Amplifier
ST7 Micro-
controller
Alarm
Biasing Signal
2/17
2
PIR (PASSIVE INFRARED) DETECTOR USING ST7FLITE05/09/SUPERLITE
1.3 SENSOR CIRCUIT DESCRIPTION
Transistor Q3 is biased in the active region and amplifies the signal from the PIR sensor. The
microcontroller provides a biasing signal, which is connected to the biasing network on the
transistor. This biasing sign al is integrated through a capacitor (C7) and resistor (R14). The
bias signal at 0 level (LOW) for a long time (greater than the discharging time of the capac itor)
puts the transistor into the cut-off region, making it OFF. The HIGH from the microcontroller for
a long ti me (g reat er th an th e ch argin g tim e of th e ca paci tor) c ause s sat urat ion of the t ransistor. Th us the t ransis tor ga in is cont rolled by the micro-c ont roller a nd it can s hift th e bias
from cut-off to saturation region and vice-versa.
The softwar e adjus ts t he b iasing signal to k eep th e o utput of transi stor am plifie r at const ant
threshold level wh ich is checked by conti nuously rea din g the v alueusing the A /D Con verter
(ADC) of the microcontroller. The application uses a software counter to track the number of
times the biasing signal was changed to LOW or HIGH to maintain the threshold.
The C7 capac itor at bas e of tr ansistor cau ses integ ration of the bias ing s ignal generat ed b y
the microc ontr oller, c ausin g the vol tage at base of trans istor to be approx imat ely co nstan t.
This voltage causes the transistor to oper ate within the active region.
1.3.1 Detecting signal variations
If there is no signal from the PIR sensor, the software counter (which tracks the number of occurrence of LOW / HIGH in a particular time) variation remains within in a small range. In case
of motion and hence a signal from the PIR, this software counter will change beyond the limits
set by the software.
1.3.2 Filtering signal variations d ue to ch anges in surroundings
Slow changes because of temperature, ambient light etc. are compensated by software by
keeping the transistor output/feedback signal at constant level. The effect of these parameters
may cause changes in the th reshold voltage. But by maintaining the threshold signal at constant level these effects are nullified. This changes the value of the software counter slightly,
which can easily be distinguished from human movement (which also causes changes in the
software counter) by comparing the magnitude and direction of the changes.
3/17
PIR (PASSIVE INFRARED) DETECTOR USING ST7FLITE05/09/SUPERLITE
Figure 2. Circuit Diagram
4/17
PIR (PASSIVE INFRARED) DETECTOR USING ST7FLITE05/09/SUPERLITE
1.4 TRANSISTOR BIASING
1. The transistor is biased using voltage-divider biasing.
This biasing has following advantages:
a. The circuit behaviour is independent of the h
of the transistor
fe
b. The circuit behaviour is independent of temperature changes etc.
c. The circuit gain is controlled
2. When the PWM signal is HIGH, the voltage drop across R17 is 0.83V
(10k *5V / (50k + 10k)).
Note: R15=100K is in parallel with R13 =100K.
(100k || 1 0 0k) = 50K.
The circuit analysis shows that this condition w ill force the transistor to go into the saturation
region. For saturation, the Vbe >= 0.7V approx.
3. When the PWM signal is LOW, the voltage drop across R17 is 0.41
(= 9.09 k *5V / (100k + 9.09k)).
Note: R 1 3=100K is in parallel with R17 = 10K.
100k || 10k = 9.09K
The circuit a nal ysis s hows t hat this co nditio n will force the tran si sto r to go into t he cut off region. For cutoff, the Vbe <= 0.5V
4. Thus the microcontroller biasing signal (averaged by the RC circuit) can adjust the tran-
sistor biasing. The RC network is formed by R14 and C7 in Figure 2.
1.5 TYPICAL PIR DETECTOR (CONVENTIONAL)
In conventional dete ctors, the IR radiation is foc used by the Fresnel lens on the PIR sen sor
and then the output of PIR sensor ( which is very sm all in amplitu de) is amplified by an OPAMP based amplifier. The OP-AMP also works as low pass filter and rejects the high frequency signals (more than 10Hz typically). The output of the amplifier is connected to the
comparator which compares the signal to the threshold level. An alarm is raised/light source is
powered if the reference (threshold) voltage is crossed.
5/17
PIR (PASSIVE INFRARED) DETECTOR USING ST7FLITE05/09/SUPERLITE
Figure 3. Conventional PIR detector
IR Radiation
PIR Sensor
AmplifierComparator
Output
Reference Voltage
Fresnel lens
1.6 ADVANTAGES O F ST7LITE PIR (COMPARED TO CONVENTIONAL DESIGN)
1. Transistors are used instead of Op-Amps for amplification. This is a low cost solution.
2. Internal RC oscillator of ST7Lite is used - No need for external oscillator.
3. Calibration of internal RC using engineering calibration values available in flash, for gener-
ating 1MHz. We use PLL in x8 mode to obtain f
CPU
= 8 MHz.
1.7 FEATURES
1.7.1 Tampering detection
An alarm can be switched on if anybody tries to damage/steal the mounted PIR detector. This
can be done by designing the detector in two parts. One part is screwed to the wall and the
second part contains the circuitry and sensor. Removing/stealing one or other part will put the
tamper switch in ON state . Thi s is dete cted b y the m icrocont roller w h ich swi tches th eal ar m
ON. Port PA3 (configured as input pull up) is used to detect tamper. PB2 is a push button
which remains pressed as long asthe two parts are attached. When one part is removed, PA3
becomes high and further action (e.g. switching on a alarm) can be taken.
Three pin connector J1 can be used for LED indication or for Relay operation by inserting the
two pin jumper accordingly.
1.7.2 Relay/LED indication option
User can select the LED or relay output for motion indication using three pin connector J2.
LED indication can be used while testing/checking the performance and the relay can be used
in the final application.
6/17
Loading...
+ 11 hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.