SLAA283

SLAA283
Application Report
SLAA283 – December 2005
Ultra-low Power Motion Detection using the MSP430F2013
MSP430 Applications
Zack Albus
ABSTRACT
Motion detection using pyroelectric passive infrared, or PIR, sensor elements is a
common method used for such applications. An implementation of such a system using
the 16-bit Sigma-Delta ADC integrated into the MSP430F2013 in order to detect motion is
presented in this application report.
1
Hardware Design
A system capable of detecting motion using a dual element PIR sensor is shown in Figure 1
using the MSP430F2013 microcontroller. Using the integrated 16-bit Sigma-Delta analog-todigital converter and built-in front-end PGA (SD16_A), the MSP430F2013 provides all the
required elements for interfacing to the PIR sensor in a small footprint. With integrated analog
and a 16MHz, 16-bit RISC CPU, the MSP430F2013 offer a great deal of processing
performance in a small package and at a low cost.
MSP430F2013
VCC
3V
CR2032
R1
PIR
D
R2
S
RB C2
C1
CPU
DCO
1.2V
VLO
AX+
SD16_A
AX-
Px.y
RLED
VSS
Figure 1.
MSP430F2013 Motion Detection System
Figure 1 shows a simplified circuit that is used to process the PIR sensor output signal. The
external components consist of the bias resistor, RB, required for the sensor and two RC filters
formed by R1/C1 and R2/C2.
The two filters serve two different purposes. Since the input to the SD16_A is differential, both a
positive and negative input must be provided. R1/C1 serves as an anti-aliasing filter on the AX+
input.
1
SLAA283
The second RC filter made up of R2/C2 serves to create a DC bias for the AX- input of the
SD16_A. This is required due to the large offset of the PIR source output with respect to VSS with
relation to the input range specification for the SD16_A. Figure 2 below shows the respective
signals in the circuit during detection of a motion event.
Direct PIR Source Output
(S, DC-coupled)
Motion-Triggered
PIR Output
AX+ Input Signal
AX- Input Signal
SD16_A Differential
Input (CH2-CH1)
Figure 2.
PIR Sensor Output & Signal Conditioning
In Figure 2, channel 1 is the direct output of the sensor. With a sensor drain voltage of 3V, the
output offset is approximately 500mV. Connecting AX- directly to VSS and the sensor source
output to AX+ would be valid only if the internal SD16_A PGA gain setting is 1. With such a small
peak-to-peak sensor output, as seen on channel 2, a higher gain setting is required eliminating
the possibility that AX- can be tied directly to VSS.
Alternatively, a DC bias voltage can be generated to drive the AX- input. This is created from the
R2/C2 low pass filter. This signal is shown on channel 3. The sensor output signal after the antialiasing filter connected to AX+ is shown on channel 2. By heavily low pass filtering the sensor
output before connecting to AX- as well, a simple DC bias is established, maintaining the input
range requirements of the SD16_A. The mathematical difference, CH2-CH3, is shown on M1.
This is the differential voltage seen at the differential input pair, AX, of the SD16_A.
A PGA gain of 4x with an oversampling rate (OSR) of 256 has been used in this implementation.
Additional gains and OSRs up to 32 and 1024, respectively, are possible for systems requiring
additional sensitivity. Refer to the MSP430F2013 datasheet for possible SD16_A PGA settings
and appropriate analog input ranges.
2
Ultra-low Power Motion Detection using the MSP430F2013
SLAA283
In addition to the PIR sensor and the analog signal conditioning, a port pin is used to drive an
LED. The LED is illuminated to indicate to the user that motion has been detected. This signal
could also be used to drive an analog switch or relay to turn on a lamp or otherwise indicate
motion in a real-world system.
As a final aspect of the hardware design, use of a Fresnel lens is critical to establishing good
directionality of the sensor detection field. The internal architecture of the dual element sensor
provides good noise immunity and false trigger rejection but also creates a limited directionality
of the sensor’s sensitivity. Use of the lens widens this field, making the final solution more
robust.
2
Software Design
With low power as an essential goal in this application, analog sampling and data processing is
kept to a minimum required to reliably detect motion. Figure 3 shows the software flow of the
software implementation described.
Main
Initialization:
VLO, WDT+,
P1 & P2,
SD16_A
Enter LPM3 with
Interrupts Enabled
WDT+ ISR
SD16_A ISR
Enter WDT+ ISR
(~340ms interval from
ACLK/8 = VLO/8 ~= 1.5kHz)
Enter SD16_A ISR
Turn off VREF
LED ON?
NO
|ResultNEW ResultOLD| >
Threshold?
YES
Turn on VREF
Start Conversion
Exit in LPM0 on RETI
(DOC & SMCLK active)
RETI
Turn LED
OFF
YES
Turn on LED
NO
ResultOLD = ResultNEW
Exit in LPM3 on RETI
(DCO & SMCLK disabled)
RETI
Figure 3.
Motion Detection Software Flowchart
Ultra-low Power Motion Detection using the MSP430F2013
3
SLAA283
The software consists of three main elements: main routine, watchdog timer interrupt service
routine and analog-to-digital converter interrupt service routine. The entire flow is interrupt driven
using the internal very low frequency, very low power VLO oscillator. The VLO is
approximatly12kHz and provided internally on the ACLK clock line. This signal is then divided by
8 and drives the WDT+ to give the CPU an interval wakeup of 32768 clocks / 12kHz / 8 =
341msec. After initialization of all peripherals the CPU enters into LPM3 via the VLO waiting for
a WDT+ interrupt trigger.
After 341ms, the WDT+ ISR is entered and serves two basic functions: first, to start a new
SD16_A conversion and second, to control the LED indicating motion. In the case that no motion
was detected in the last measurement (meaning the LED is off), the SD16_A internal reference
is enabled and a new conversion is started. Before exiting the WDT+ ISR, the status register
value to be popped upon RETI is modified so that the DCO and SMCLK used to clock the
SD16_A will remain active. This causes the CPU to switch from LPM3 to LPM0 after RETI.
During this time, the SD16_A is completing the conversion process. This takes 256 clocks /
1MHz DCO * 4 = 1.024msec. The factor of 4 comes from the INTDLYx setting of the SD16_A.
This setting allows the SD16_A to take up to 4 conversions before interrupting the CPU to allow
for any potential analog input changes that might impact the SD16_A decimation filter, causing
an invalid result. This is important since the SD16_A is used in a single conversion mode in this
application. Please refer to the MSP430x2xx Family Users Guide for more information
concerning this setting.
After the conversion is complete, the SD16_A ISR is entered and the internal reference is
disabled. The absolute difference between the new result and the prior result is calculated, and
compared against a preset threshold. When this threshold is exceeded, motion has been
detected and the LED is enabled. The CPU exits the ISR back into LPM3 (DCO and SMCLK are
disabled) and the next WDT+ interrupt is awaited.
3
Summary
Using this flow the average current consumption is maintained at a low level, low enough that
the entire system can be powered from a standard CR2032 3V battery at approximately 9.4uA
average ICC. Table 1 shows the breakdown of operation versus current consumption.
Table 1.
Typical System Power Budget (over 1 second)
Function
Duration
Active Current
Average Current
PIR325 sensor
1sec
6uA
6uA
SD16_A & VREF + DCO
1.024msec, ~2.94 times per sec
810uA+85uA
2.69uA
CPU Active (1MHz@3V)
262 MCLKs per sec: 262us
300uA
0.08uA
MSP430 Standby (LPM3
w/ VLO)
996.7msec
0.6uA
0.598uA
Total
4
Ultra-low Power Motion Detection using the MSP430F2013
9.37uA
SLAA283
The method shown here is quite simple in terms of the measurement and algorithm applied to
detect motion. With up to 2K Flash and up to 16MIPs of processing power, the MSP430F2013
can be used to implement a much higher level of signal processing to add sensitivity as well as
selectivity to a given PIR profile. The integrated analog and processing power of the
MSP430F2013 family provides a low cost yet powerful MCU solution which can be used to
differentiate custom motion detection applications.
4
References
1. MSP430x2xx Family User’s Guide (SLAU144)
2. MSP430F20xx Mixed Signal Microcontroller Datasheet (SLAS491)
3. “Infrared Parts Manual: PIR325 & FL65”, GLOLAB Corporation, www.glolab.com, 2003
Ultra-low Power Motion Detection using the MSP430F2013
5
IMPORTANT NOTICE
Texas Instruments Incorporated and its subsidiaries (TI) reserve the right to make corrections, modifications,
enhancements, improvements, and other changes to its products and services at any time and to discontinue
any product or service without notice. Customers should obtain the latest relevant information before placing
orders and should verify that such information is current and complete. All products are sold subject to TI’s terms
and conditions of sale supplied at the time of order acknowledgment.
TI warrants performance of its hardware products to the specifications applicable at the time of sale in
accordance with TI’s standard warranty. Testing and other quality control techniques are used to the extent TI
deems necessary to support this warranty. Except where mandated by government requirements, testing of all
parameters of each product is not necessarily performed.
TI assumes no liability for applications assistance or customer product design. Customers are responsible for
their products and applications using TI components. To minimize the risks associated with customer products
and applications, customers should provide adequate design and operating safeguards.
TI does not warrant or represent that any license, either express or implied, is granted under any TI patent right,
copyright, mask work right, or other TI intellectual property right relating to any combination, machine, or process
in which TI products or services are used. Information published by TI regarding third-party products or services
does not constitute a license from TI to use such products or services or a warranty or endorsement thereof.
Use of such information may require a license from a third party under the patents or other intellectual property
of the third party, or a license from TI under the patents or other intellectual property of TI.
Reproduction of information in TI data books or data sheets is permissible only if reproduction is without
alteration and is accompanied by all associated warranties, conditions, limitations, and notices. Reproduction
of this information with alteration is an unfair and deceptive business practice. TI is not responsible or liable for
such altered documentation.
Resale of TI products or services with statements different from or beyond the parameters stated by TI for that
product or service voids all express and any implied warranties for the associated TI product or service and
is an unfair and deceptive business practice. TI is not responsible or liable for any such statements.
Following are URLs where you can obtain information on other Texas Instruments products and application
solutions:
Products
Applications
Amplifiers
amplifier.ti.com
Audio
www.ti.com/audio
Data Converters
dataconverter.ti.com
Automotive
www.ti.com/automotive
DSP
dsp.ti.com
Broadband
www.ti.com/broadband
Interface
interface.ti.com
Digital Control
www.ti.com/digitalcontrol
Logic
logic.ti.com
Military
www.ti.com/military
Power Mgmt
power.ti.com
Optical Networking
www.ti.com/opticalnetwork
Microcontrollers
microcontroller.ti.com
Security
www.ti.com/security
Telephony
www.ti.com/telephony
Video & Imaging
www.ti.com/video
Wireless
www.ti.com/wireless
Mailing Address:
Texas Instruments
Post Office Box 655303 Dallas, Texas 75265
Copyright  2005, Texas Instruments Incorporated
Was this manual useful for you? yes no
Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Download PDF

advertising