Part Number Hot Search : 
C1GT0 MA828 DG411 D2W415DD 70754 BU941ZT SY10H602 SE074
Product Description
Full Text Search
 

To Download AN1828 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  AN1828/0304 1/17 rev. 1.0 AN1828 application note pir (passive infrared) detector using st7flite05/09/superlite introduction 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-delta a/d conversion, suitable for detecting low-frequency sensor signals. refer to an1827 for a de- tailed 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 1ddd
2/17 pir (passive infrared) detector using st7flite05/09/superlite 1 sensor overview the human body radiates infrared waves with wavelengths of 8 to 12 micrometers. any move- ment by a person leads to a change in the amount of infrared energy which a sensor can de- tect 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, ap- proximately up to 10 inches. for detecting movements at longer distance, infrared 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 a pir 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 sensor rc integrator transistor amplifier st7 micro- controller alarm biasing signal 2
3/17 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 signal 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 capacitor) puts the transistor into the cut-off region, making it off. the high from the microcontroller for a long time (greater than the charging time of the capacitor) causes saturation of the tran- sistor. thus the transistor gain is controlled by the micro-controller and it can shift the bias from cut-off to saturation region and vice-versa. the software adjusts the biasing signal to keep the output of transistor amplifier at constant threshold level which is checked by continuously reading the value using the a/d converter (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 capacitor at base of transistor causes integration of the biasing signal generated by the microcontroller, causing the voltage at base of transistor to be approximately constant. this voltage causes the transistor to operate 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 oc- currence 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 due to changes 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 threshold voltage. but by maintaining the threshold signal at con- stant 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 .
4/17 pir (passive infrared) detector using st7flite05/09/superlite figure 2. circuit diagram
5/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 fe of the transistor 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 || 100k) = 50k. the circuit analysis shows that this condition will 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: r13=100k is in parallel with r17 = 10k. 100k || 10k = 9.09k the circuit analysis shows that this condition will force the transistor to go into the cutoff re- gion. 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 detectors, the ir radiation is focused by the fresnel lens on the pir sensor and then the output of pir sensor (which is very small in amplitude) is amplified by an op- amp based amplifier. the op-amp also works as low pass filter and rejects the high fre- quency 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.
6/17 pir (passive infrared) detector using st7flite05/09/superlite figure 3. conventional pir detector 1.6 advantages of 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. this is detected by the microcontroller which switches the alarm on. port pa3 (configured as input pull up) is used to detect tamper. pb2 is a push button which remains pressed as long as the 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. amplifier comparator output pir sensor fresnel lens ir radiation reference voltage
7/17 pir (passive infrared) detector using st7flite05/09/superlite 1.7.3 hardware self-test hardware self-testing is performed each time the circuit is powered-on or at microcontroller reset. the hardware problem can be indicated by a dedicated led (d1). in this test, the status of the transistor q1 (bc557) collector is checked with respect to the signal at the base of tran- sistor q3 (bc547) thus confirming the proper working of the transistor circuitry. led(d1) gets on till hardware test routine executes. 1.7.4 led indicators there are six leds (d1-d5,d7) in the circuit for indicating different status types, as explained below: 1.7.5 sensitivity selection the system can be made more or less sensitive by assigning high or small values to the pa- rameters used to take movement detection decision. the parameters can be changed in a function ? select_sensitivity() ? defined in ? main.c ? . at one time two values can be assigned to the parameters and the selection for any value can be done by using jumper j8 (connected to pin pb1 through a 10k ? resistor). 1.7.6 icp connector icp (in circuit programmer) connector can be used to program the device on the circuit. led purpose description led d1 fault this led shows the result of hardware self test. led blinking indicates some hardware (transistor circuitry) fault. led d2 free available for user requirements. the port pin is configured as output push-pull high. led d3 heart beat it blinks to show that the microcontroller is working properly. led d4 tamper indicator led on means tampering occurred, selected by putting jumper j11 and removing j10. led d5 movement indicator led on means human movement detected. led d7 power supply indicator led on shows that the circuit is receiving power.
8/17 pir (passive infrared) detector using st7flite05/09/superlite 1.7.7 debugging feature variable monitoring using rs232 communication some parameters can be monitored by connecting the serial port of a pc to the db9 con- nector on board. this is useful in debugging. the variable to be monitored can be selected in the software using a macro. please refer to the software for the meaning of the different variables. by default the ? low_var ? variable is transmitted. changes in its value can be monitored using the windows hyperterminal applica- tion. normally the maximum variation in its value should be around 15. similarly, other variables (like out_of_threshold, high_v etc) can also be transmitted and can be displayed using hyperterminal. these variables change only when a human motion is de- tected otherwise they remain almost constant. the implementation of the sci transmission between the board and the pc is explained in section 2.2 . 2 software implementation these sections describe the algorithms and programming techniques implemented in the var- ious modules in the software. first, the flowcharts are shown and then each module is ex- plained.
9/17 pir (passive infrared) detector using st7flite05/09/superlite figure 4. main routine flowchart (part 1 of 2) is adc input signal high? start set the biasing signal high and provide a delay to let the capacitor charge no hardware problem yes set the biasing signal low and provide short delay to let capacitor discharge is adc input signal low? no yes set biasing signal high is adc input signal< threshold? yes no make a buffer of 10 integers to store 10 consecutive values of low_var low_var: a variable that counts the number of times that were needed to make the biasing signal low to keep the adc input signal at threshold level (3v in the software).this is done in the timer isr. enable timer (ar timer) interrupt with interrupt time 52s hardware check stabilization a
10/17 pir (passive infrared) detector using st7flite05/09/superlite figure 5. main routine flowchart (part 2 of 2) is difference > variation limit a yes no convert the variable (which is to be checked at hyper terminal) into ascii and transmit the ascii data through one port pa5 pin at baud rate 4800 find the difference between the previous stored value (no of times biasing signal made low) and current value of low_var. is a new value of low_var received? yes yes no find the difference between the current and maximum, minimum values of low_var. is difference > variation limits alarm or led indication for desired duration (may be permanent on of alarm/led) no a a decision block a
11/17 pir (passive infrared) detector using st7flite05/09/superlite figure 6. timer isr (interrupt service routine) flowchart does counter=number of conversions? (e.g.1000) write the first level to be output on pa5 pin according to the data (ascii) to be transmitted at selected baud rate iret is adc input signal > threshold? yes no make biasing signal low and in- crement low_var, to count the number of times the signal is made low make biasing signal high start change the level of the port pin pa5 according to the ascii data after every 416s (52x8=8th occurence of timer interrupt) for baud rate 2400 and 208 s for 4800 baud rate. decrement counter counter=number of conversions store low_var value in buffer sci trans- mission sigma-delta implementati o yes no
12/17 pir (passive infrared) detector using st7flite05/09/superlite 2.1 sigma-delta implementation sigma-delta (as shown in figure 7 ) needs an integrator, comparator and digital filter for 1 bit dac. figure 7. sigma-delta conversion concept note: refer to an1827 for more details on sigma-delta implementation these components are implemented in the application as follows: ? comparator: on-chip adc is used ? 1-bit dac: i/o port pb2 is used ? integrator: external resistor and capacitor. the sigma-delta software procedure is as follows: 1. fix a threshold level for the transistor output (measured by the microcontroller ? s adc input). this is selected as 3v (96h) in our application. 2. configure the ar timer to generate an overflow interrupt every 52 s. 3. read the value of the transistor q1 output signal in isr (interrupt service routine) using the microcontroller ? s adc input. 4. make the pwm signal high if the adc input is less than the threshold level. 5. make the pwm signal low if the adc input is greater than the threshold level. by reading the output signal of transistor q1 with the on-chip adc, the biasing signal (1-bit dac) is adjusted by software. on motion detection, the signal from the sensor tries to change the threshold voltage level. but as the threshold voltage is kept at a fixed level by the biasing signal, this leads to a change in the duty cycle of the biasing signal. this variation in the duty cycle can be detected by calcu- lating the number of times the biasing signal (calculated by variable low_var as also shown in flow chart) is made low in a fixed time, 52msec (1000 times the periodic interrupt) in our soft- ware. digital filter v ref 1 bit dac + + - - integrator comparator
13/17 pir (passive infrared) detector using st7flite05/09/superlite 2.2 sci implementation using the microcontroller standard i/o ports a serial communications interface (sci) is used to allow the user to check different variables while the application is running . the value of the variables can be displayed on a pc with the hyperterminal application. sci is implemented using standard i/o ports. we just need to transmit the data from the microcontroller to a pc, so only sci transmit is implemented for 4800 or 2400 baud rate (selectable by a macro in the software). this is implemented as fol- lows: 1. convert the variable to be transmitted into ascii data. this is required because hyperter- minal displays ascii data only. 2. the ascii data is transmitted bit-by-bit with a bit duration depending on the baud rate selected in the software. for example: 1 bit duration = 416s (1/2400 seconds) for 2400 baud = 208s (1/4800 seconds) 4800 baud this bit duration is calculated with the help of the timer interrupt which is configured for 52s. so we can change the status of pa5 pin after 416s(52x8) or 208s(52x4). the time period for each data bit will be the same. 3. transmit the start bit. to do this, hold the pa5 pin low for 1 bit time. 4. after the start bit, change the pa5 pin level according to the data (ascii) to be transmitted. 5. then, transmit the stop bit. to do this, hold the pa5 pin high for 1 bit time.
14/17 pir (passive infrared) detector using st7flite05/09/superlite 3 application specifications 3.1 code size code size = 1 . 2 kbytes (with sci implementation included) =969 bytes (without sci implementation, code size less than 1k): superlite can be used. 3.2 sigma-delta conversion time this is equal to the time taken to calculate a digital value after implementing the sigma-delta algorithm. conversion time= timer interrupt time* number of samples where timer interrupt time = 52s. the ar timer is configured to generate an overflow interrupt every 52s. in the interrupt rou- tine the software checks the adc value and then decides the value for biasing signal (1-bit dac), number of samples = 1000 = number of times the status of the dac bit is decided. a software counter is incremented each time the dac status made low. the adc is used as a compa- rator in the application. conversion time= (52s)x(1000) = 52ms. 3.3 power consumption input voltage must be greater than 9v. the values shown in table are given without relay and max232 cicuitry table 1. current consumption 3.4 detection range without fresnel lens: 10 ? approx. sr.no. power led heart beat led detection led current drawn (normal conditions) 1 off off off 13ma 2 off off on 26ma 3on off off 26ma 4on off on 39ma 5on on off 39ma 6on on on 51ma
15/17 pir (passive infrared) detector using st7flite05/09/superlite 3.5 power supply options there can be power supply options, for example: ? capacitive power supply. ? linear regulator (shown in the circuit) ? battery powered: in this case, leds can be deactivated to reduce the power consumption. current consumption data provided above can help in this case. 4 bill of materials table 2. bill of materials part name/number description quantity component symbol st7lite05/superlite microcontroller 1 u1 l7805 voltage regulator 1 u2 st232 line driver 1 u3 bc557 pnp transistor 3 q1,q4,q5 pir sensor pir sensor 1 q2 bc547 npn transistor 1 q3 1uf tantalum capacitor 4 c11-c14 1uf ceramic capacitor 1 c7 100nf ceramic capacitor 7 c1-2,c4-6,c9-10 47uf electrolytic capacitor 1 c3 1000uf electrolytic capacitor 1 c8 led led 6 d1-d5,d7 in4007 diodes 6 d6,d8-12 1k resistor 0.25w 1 r7 100k resistor 0.25w 4 r5,r11,r13,r15 270 ohm resistor 0.25w 6 r2,r3,r8,r10,r16r18 220k resistor 0.25w 1 r6 47k resistor 0.25w 1 r4 1m resistor 0.25w 1 r14 10k resistor 0.25w 6 r1,r9,r12,r17, r19-20 icp connector 10 pin icp connector 1 p1 dc_jack input supply connector 1 p2 db9 9 pin d-sub connector female 1 p3 j8 2 pin jumpers 1 j8 j1,j2 3 pin jumper 2 j1,j2 push-button pushbutton 2 pb1,pb2
16/17 pir (passive infrared) detector using st7flite05/09/superlite 5 superlite compatibility the firmware is compatible with superlite if software-sci transmission is not required. you can use st7lite05/09 for testing and if any other feature is to be added. for production purposes, low cost superlite device can be used. to make the firmware compatible with superlite, (i) enable ? #define superlite ? in main.h. (ii) modify the configuration file (mak file) accordingly. the software contains a separate prm file for superlite. 6 related documents 1. st6 an434 -human movement detecting concept 2. st7lite05 datasheet 3. an1827 - implementation of sigma-delta adc with st7flite05 /09
17/17 pir (passive infrared) detector using st7flite05/09/superlite ? the present note which is for guidance only aims at providing customers with information regarding their products in order for them to save time. as a result, stmicroelectronics shall not be held liable for any direct, indirect or consequential damages with respect to any claims arising from the content of such a note and/or the use made by customers of the information contained herein in connection with their products. ? information furnished is believed to be accurate and reliable. however, stmicroelectronics assumes no responsibility for the co nsequences of use of such information nor for any infringement of patents or other rights of third parties which may result from its use. no license is granted by implication or otherwise under any patent or patent rights of stmicroelectronics. specifications mentioned in this publicati on are subject to change without notice. this publication supersedes and replaces all information previously supplied. stmicroelectronics prod ucts are not authorized for use as critical components in life support devices or systems without express written approval of stmicroelectro nics. the st logo is a registered trademark of stmicroelectronics. all other names are the property of their respective owners ? 2004 stmicroelectronics - all rights reserved stmicroelectronics group of companies australia ? belgium - brazil - canada - china ? czech republic - finland - france - germany - hong kong - india - israel - italy - japan - malaysia - malta - morocco - singapore - spain - sweden - switzerland - united kingdom - united states www.st.com


▲Up To Search▲   

 
Price & Availability of AN1828

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X