Microchip ATTINY827 Bedienungsanleitung


Lesen Sie kostenlos die 📖 deutsche Bedienungsanleitung für Microchip ATTINY827 (33 Seiten) in der Kategorie Nicht kategorisiert. Dieser Bedienungsanleitung war für 38 Personen hilfreich und wurde von 2 Benutzern mit durchschnittlich 4.5 Sternen bewertet

Seite 1/33
AN3641
Low-Power, Cost-Efficient PIR Motion Detection Using the
tinyAVR® 2 Family
Features
• 12-bit ADC, Differential Measurement
• ADC Sample Accumulation Up To 1024 Samples
• Programmable Gain Amplifier (PGA) Up To 16x Gain
• Signal Amplifying, Oversampling And Analyzing Using The Built-in ADC With PGA
• Hardware Averaging Using Burst Mode
• ADC Triggered Through The Event System Using The Periodic Interrupt Timer (PIT)
• Reduced Bill Of Material (BoM) Cost Compared To Typical Passive InfraRed (PIR) Solutions
• Visualize Data Using The Microchip Data Visualizer And Data Streamer Protocol
• Visualize Power Consumption Using The Microchip Data Visualizer And a Power Debugger
Introduction
Author: Kjetil Kirkholt, Microchip Technology Inc.
This application note describes how to use the 12-bit differential ADC with PGA in the tinyAVR
® 2 Family of
microcontrollers and how to collect measurements using a sensor while keeping the currentPassive InfraRed (PIR)
consumption at a minimum.
In this application example, the signal from the PIR sensor is amplified, oversampled, digitally filtered, and analyzed
to determine if movement has occurred. LED0 on the ATtiny1627 Curiosity Nano (DM080104) board is used to
indicate when movement is detected. The measured data can be sent to the serial terminal and illustrated in the Data
Visualizer application or plugin for Atmel Studio.
The output signal levels from a PIR sensor are typically very low and less than 1 mV. To detect the movement and
avoid false detections, the signal needs to be amplified before being sampled by the ADC. In typical PIR solutions,
this is achieved by using several Operational Amplifier (op amp) stages with high gain. In this application example, no
external op amps are used, and the amplification of the signal is purely done inside the microcontroller (MCU) by
using the internal PGA. The ADC supports sampling in bursts, where a configurable number of conversion results are
accumulated automatically into a single ADC result (sample accumulation). The application example accumulates 16
samples, which increases the resolution of the 12-bit ADC by two bits. It is possible to oversample the signal up to
1024 times and gain five additional bits, resulting in a 17-bit ADC resolution, if needed.
More information on oversampling can be found in the ADC Oversampling with tinyAVR 0- and 1-series, and
megaAVR 0-series product brief.
For demonstration purposes, the ATtiny1627 Curiosity Nano board, Curiosity Nano Base for Click boards
â„¢, and a
modified MIKROE-3339 PIR Click boardsâ„¢ are used.
The example code for replicating the results described in this application note is available from Atmel START:
• PIR sensor with tinyAVR 2-series ADC
–start.atmel.com/#example/Atmel%3AApplication_AVR_Examples%3A1.0.0%3A%3AApplication
%3APIR_Motion_Detection%3A
© 2020 Microchip Technology Inc. Application Note DS00003641A-page 1
The bare metal code example (without using Atmel START drivers) is available on GitHub:
View Code Examples on GitHub
Click to browse repositories
More information about the application is described in Sections and .Demo Operation Code Implementation
Additional details on the ADC performance and general configuration are available in the device data sheet.
AN3641
© 2020 Microchip Technology Inc. Application Note DS00003641A-page 2
Table of Contents
Features......................................................................................................................................................... 1
Introduction.....................................................................................................................................................1
1. Block Diagram.........................................................................................................................................5
2. PIR Sensor Theory..................................................................................................................................6
3. Demo Operation......................................................................................................................................8
3.1. Configuring, Customizing, Tuning the PIR Application Sampling, Filtering and Detection
Parameters...................................................................................................................................8
3.1.1. Sample Acquisition Parameters.....................................................................................8
3.1.2. Filtering and Detection Algorithm Parameters...............................................................8
3.1.3. Debug Interface Parameters..........................................................................................9
3.2. Hardware Prerequisite..................................................................................................................9
3.2.1. Click boardâ„¢ Modifications............................................................................................9
3.2.1.1. Filter Simulation Using MPLAB® Mindi™ Analog Simulator ......................11
3.3. Hardware Setup......................................................................................................................... 12
3.4. Software Prerequisite.................................................................................................................13
3.5. Running the Example.................................................................................................................13
4. Source Code Overview......................................................................................................................... 15
4.1. MCU and Peripheral Configuration............................................................................................ 15
4.2. Flow Chart..................................................................................................................................16
4.3. Timing Diagram.......................................................................................................................... 17
4.4. Code Implementation................................................................................................................. 17
4.4.1. Peripheral Initialization.................................................................................................17
4.4.2. Main Code................................................................................................................... 18
4.4.3. Warm-up and Filter Creation........................................................................................19
4.4.4. Update Average Filters................................................................................................ 20
4.4.5. Check for Movement....................................................................................................20
4.4.6. ADC Result Ready Interrupt Routine...........................................................................21
5. Summary...............................................................................................................................................22
6. Plotting Graph in .......................................................................................................... 23Data Visualizer
7. Plotting Power Consumption.................................................................................................................24
7.1. Power Consumption...................................................................................................................25
8. Get Code Examples from Atmel START............................................................................................... 27
9. Get Code Examples from GitHub..........................................................................................................28
10. Revision History.................................................................................................................................... 29
The Microchip Website.................................................................................................................................30
Product Change Notification Service............................................................................................................30
Customer Support........................................................................................................................................ 30
AN3641
© 2020 Microchip Technology Inc. Application Note DS00003641A-page 3


Produktspezifikationen

Marke: Microchip
Kategorie: Nicht kategorisiert
Modell: ATTINY827

Brauchst du Hilfe?

Wenn Sie Hilfe mit Microchip ATTINY827 benötigen, stellen Sie unten eine Frage und andere Benutzer werden Ihnen antworten




Bedienungsanleitung Nicht kategorisiert Microchip

Bedienungsanleitung Nicht kategorisiert

Neueste Bedienungsanleitung für -Kategorien-