Ultra-low Power Motion Detection using the MSP430F2013.

Slides:



Advertisements
Similar presentations
Why Keliang’s code maybe did (or maybe didn’t) work … or High (impedance) Anxiety.
Advertisements

UBI >> Contents Chapter 7 Timers Laboratories MSP430 Teaching Materials Texas Instruments Incorporated University of Beira Interior (PT) Pedro Dinis Gaspar,
ECE 382 Lesson 14 Lesson Outline Polling Multiplexing Intro to Logic Analyzer Debouncing Software Delay Routines Admin Assignment 3b due BOC today Assignment.
Interrupts, Low Power Modes and Timer A (Chapters 6 & 8)
Chung-Ta King National Tsing Hua University
Chung-Ta King National Tsing Hua University
ECE 447 Fall 2009 Lecture 9: TI MSP430 Interrupts & Low Power Modes.
Module 4: Analog programming blocks. Module Objectives Analyze a control task that uses analog inputs. Connect a potentiometer to LOGO! controller and.
1 Lab2: A/D Converter. 2 This circuit connects a variable voltage to an A/D port on the AVR mcu. Your software running on the AVR mcu will read the digital.
 Team: May  Team member : Avinav Verma, Dixiao Jiang, MengQian Ding  Advisor: Aymen Fayed  Client : Powerfilm. Inc.
LAB 6: Serial Communication
Notes on the ez430-RF2500. Sources
March 2, 2006CDR – Apparatus for the Analysis of Heart Sounds Team Pacemaker Apparatus for the Analysis of Heart Sounds Electronic Stethoscope / EKG Device.
Timers and Interrupts Shivendu Bhushan Summer Camp ‘13.
CS4101 嵌入式系統概論 Timers and Clocks 金仲達教授 國立清華大學資訊工程學系 Materials from MSP430 Microcontroller Basics, John H. Davies, Newnes, 2008.
MSP Ultra-Low Power | High Integration | Easy-to-Use “How To” Series: Clock System.
CS4101 嵌入式系統概論 Software UART Revisited Prof. Chung-Ta King Department of Computer Science National Tsing Hua University, Taiwan ( Materials from MSP430.
Chung-Ta King National Tsing Hua University
LAB 7: WDT+ and Low-Power Optimization
Lecture 18: ADC Implementation Lecturers: Professor John Devlin.
Peripherals and their Control An overview of industrially available “peripheral devices” that use “pulse-width modulation” for information passing. Review.
Network and Systems Laboratory nslab.ee.ntu.edu.tw.
Clock Options and Sleep Modes. Clock Sources Flash Fuse bits can be programmed to choose one of the following Clock sources: 1. External RC Osc. f = 1/(3RC).
MCU: Interrupts and Timers Ganesh Pitchiah. What’s an MCU ?
CS4101 嵌入式系統概論 Analog-to-Digital Converter 金仲達教授 國立清華大學資訊工程學系 ( Materials from MSP430 Microcontroller Basics, John H. Davies, Newnes, 2008 )
CPE 323 Introduction to Embedded Computer Systems: ADC12 and DAC12 Instructor: Dr Aleksandar Milenkovic Lecture Notes.
SIGMA-DELTA ADC SD16_A Sigma-Delta ADC Shruthi Sujendra.
Lecture 11: TI MSP430 Timers Compare Modes
ECE 194 S’01 Introduction to Engineering II Arizona State University 1 The operational amplifier, cont.  Has a multitude of circuit applications  Linear.
Lecturers: Professor John Devlin Mr Robert Ross
ECE/CS-352: Embedded Microcontroller Systems The Silicon Laboratories C8051F020 Enhanced 8051 Part 4 Timer3, Temperature Sensor, AD0WINT.
ATtiny23131 A SEMINAR ON AVR MICROCONTROLLER ATtiny2313.
WISP.
IO Subsystem IV Ports and peripherals. IO Subsystem (1) All devices connected to the system buses, other than memory and CPU – Input and output ports.
TI MSP430 MICROCONTROLLERS BY ADITYA PATHAK. THE MSP FAMILY Ultra-low power; mixed signal processors Widely used in battery operated applications Uses.
Automatic accident avoiding system PROJECT MEMBERS MUTHUKUMAR.K (05ME33) SAKTHIDHASAN.S (05ME39) SAKTHIVEL.N (05ME40) VINOTH.S (05ME56) PROJECT GUIDE:
Saxion University of Applied Sciences Advanced Microcontrollers A practical approach.
Network and Systems Laboratory nslab.ee.ntu.edu.tw.
Lab 3: ADC.
Analog to Digital Converter (ADC)
UNIT 2. CPUXV2 20-bit addressing User-definable Boot Strap Loader RAM starts at 0x1C00 Beginning of MAIN flash moves according to RAM Vector table starts.
ECE 382 Lesson 32 Lesson Outline Lab 6 Introduction Pulse Width Modulation Capture / Compare Example Lab 6 Tips Admin Lab#6 “prelab” due BOC lesson 33.
Recall the Container Thermometer
Recall the Container Thermometer
Introduction to MSP430G2553 and MPU6050
Introduction Why low power?
Introduction Why low power?
CS4101 嵌入式系統概論 General Purpose IO
Application Case Study Security Camera Controller
Lecture 8: TI MSP430 Interrupts, ISRs
EMBEDDED SYSTEMS UNIT 4.
Lesson Outline Interrupts Admin Assignment #9 due next lesson
CS4101 Introduction to Embedded Systems Lab 6: Low-Power Optimization
Refer to Chapter 5 in the reference book
Chapter 6 General Purpose Input/Output
CS4101 Introduction to Embedded Systems Lab 1: General Purpose IO
Prof. Chung-Ta King Department of Computer Science
CS4101 嵌入式系統概論 General Purpose IO
The operational amplifier, cont.
Subject Name: Microcontroller Subject Code: 10ES42
CS4101 Introduction to Embedded Systems Lab 4: Interrupt
Internet-of-Things (IoT)
I/O PORTS : MSP430x5xx devices have up to 12 digital I/O ports :
Lecture 9: TI MSP430 Interrupts & Low Power Modes
MSP432™ MCUs Training Part 6: Analog Peripherals
CS4101 Introduction to Embedded Systems Lab 2: Basic IO and Timer
Prof. Chung-Ta King Department of Computer Science
MSP430 Clock System and Timer
ECE 3567 Microcontroller Lab
Presentation transcript:

Ultra-low Power Motion Detection using the MSP430F2013

PIR Sensor Output & Signal Conditioning

Motion Detection Software Flowchart

//****************************************************************************** #include #define LED_OUT BIT0 // Bit location for LED #define SENSOR_PWR BIT7 // Bit location for power to sensor #define THRESHOLD 50 // Threshold for motion static unsigned int result_old = 0; // Storage for last conversion void main(void) { WDTCTL = WDTPW+WDTTMSEL+WDTCNTCL+WDTSSEL; // ACLK/32768, int timer: ~10s BCSCTL1 = CALBC1_1MHZ; // Set DCO to 1MHz DCOCTL = CALDCO_1MHZ; BCSCTL1 |= DIVA_2; // ACLK = VLO/4 BCSCTL3 |= LFXT1S_2; P1OUT = 0x10; // P1OUTs P1SEL = 0x08; // Select VREF function P1DIR = 0xEF; // Unused pins as outputs P2OUT = 0x00 + SENSOR_PWR; // P2OUTs P2SEL &= ~SENSOR_PWR; // P2.7 = GPIO P2DIR = 0xff; // Unused pins as outputs SD16CTL = SD16VMIDON + SD16REFON + SD16SSEL_1;// 1.2V ref, SMCLK SD16INCTL0 = SD16GAIN_4 + SD16INCH_4; // PGA = 4x, Diff inputs A4- & A4+ SD16CCTL0 = SD16SNGL + SD16IE; // Single conversion, 256OSR, Int enable SD16CTL &= ~SD16VMIDON; // VMID off: used to settle ref cap SD16AE = SD16AE1 + SD16AE2; // P1.1 & P1.2: A4+/- SD16_A inputs // Wait for PIR sensor to settle: 1st WDT+ interval P1SEL |= LED_OUT; // Turn LED on with ACLK (for low Icc) while(!(IFG1 & WDTIFG)); // ~5.4s delay: PIR sensor settling P1SEL &= ~LED_OUT; // Turn LED off with ACLK (for low Icc) // Reconfig WDT+ for normal operation: interval of ~341msec WDTCTL = WDTPW+WDTTMSEL+WDTCNTCL+WDTSSEL+WDTIS1;// ACLK/512, int timer: 341msec BCSCTL1 |= DIVA_3; // ACLK = VLO/8 IE1 |= WDTIE; // Enable WDT interrupt _BIS_SR(LPM3_bits + GIE); // Enter LPM3 with interrupts }

/****************************************************** // SD16_A interrupt service routine ******************************************************/ #pragma vector = SD16_VECTOR __interrupt void SD16ISR(void) { unsigned int result_new; SD16CTL &= ~SD16REFON; // Turn off SD16_A ref result_new = SD16MEM0; // Save result (clears IFG) if (result_new > result_old) // Get difference between samples result_old = result_new - result_old; else result_old = result_old - result_new; if (result_old > THRESHOLD) // If motion detected... P1OUT |= LED_OUT; // Turn LED on result_old = SD16MEM0; // Save last conversion __bis_SR_register_on_exit(SCG1+SCG0); // Return to LPM3 after reti } /****************************************************** // Watchdog Timer interrupt service routine ******************************************************/ #pragma vector=WDT_VECTOR __interrupt void watchdog_timer(void) { if (!(P1OUT & LED_OUT)) // Has motion already been detected? { SD16CTL |= SD16REFON; // If no, turn on SD16_A ref SD16CCTL0 |= SD16SC; // Set bit to start new conversion __bic_SR_register_on_exit(SCG1+SCG0); // Keep DCO & SMCLK on after reti } else P1OUT &= ~LED_OUT; // If yes, turn off LED, measure on next loop }

Sampling frequency The idea is that the variable resistor mimics a thermistor and the LED should be illuminated if the temperature falls too low, when R2 > 10kΩ.Overall, the two resistances are in series to give Rin = Rs+RI.We now have the classic RC circuit and found in the section “Practical Issues with SARs” on page 405 that we need to allow 7.6 time-constants for charging in a 10-bit ADC. The worst case is when the resistance and capacitance take their maximum values.We should therefore assume that the variable resistor R2 = 20k Ω, in which case Rs = R1// R2 ≈ 7k Ω. The data sheet gives RI ≤ 2k Ω so we should take Rin = 9k Ω. The data sheet also gives CI ≤ 27pF and again we take this maximum value as the most pessimistic estimate. Then τ = RinCI = 0.24μs and 7.6τ = 1.85μs. The sampling time is configured in terms of cycles of ADC10CLK. I use the internal oscillator ADC10OSC and we should take its maximum frequency of 6.3MHz for safety. The number of cycles is therefore 1.85μs×6.3MHz = 12.

Application notes/projects with ADCs Temperature recorder A Simple Glass Breakage Detector Using the MSP430 (slaa351) Implementing a Smoke Detector with the MSP430F2012 (slaa335) Low-Power Tilt Sensor Using the MSP430F2012 (slaa309). A two-axis accelerometer is interfaced directly to a F2012, which illuminates six LEDs to show the direction in which the PCB is tilted.

Application notes/projects with ADCs Li-Ion Battery Charger Solution Using the MSP430 (slaa287). An ADC10 is used to monitor the voltage across the battery, the charging current, and the temperature of the battery, sensed by a thermistor. Charging goes through two stages, one at constant current followed by one at constant voltage, before the battery is fully charged. The temperature sensor is needed to detect overheating, in which case the battery might catch fire. Solid State Voice Recorder Using Flash MSP430 (slaa123). The sound is digitized by an ADC12 triggered by Timer_B to avoid jitter in the sampling clock. The sound is recorded in flash memory. Several external components are needed to complete the system but could be eliminated by selecting a newer device such as the FG4618.