AT12075: ATmega328PB Xplained Mini Demo. Introduction. Features. Atmel AVR 8-bit Microcontrollers APPLICATION NOTE

Similar documents
AT11805: Capacitive Touch Long Slider Design with PTC. Introduction. Features. Touch Solutions APPLICATION NOTE

QT1 Xplained Pro. Preface. Atmel QTouch USER GUIDE

SMARTCARD XPRO. Preface. SMART ARM-based Microcontrollers USER GUIDE

How To Use An Atmel Atmel Avr32848 Demo For Android (32Bit) With A Microcontroller (32B) And An Android Accessory (32D) On A Microcontroller (32Gb) On An Android Phone Or

APPLICATION NOTE. AT07175: SAM-BA Bootloader for SAM D21. Atmel SAM D21. Introduction. Features

AT88CK490 Evaluation Kit

AT15007: Differences between ATmega328/P and ATmega328PB. Introduction. Features. Atmel AVR 8-bit Microcontrollers APPLICATION NOTE

USER GUIDE EDBG. Description

CryptoAuth Xplained Pro

APPLICATION NOTE. Secure Personalization with Transport Key Authentication. ATSHA204A, ATECC108A, and ATECC508A. Introduction.

AVR151: Setup and Use of the SPI. Introduction. Features. Atmel AVR 8-bit Microcontroller APPLICATION NOTE

APPLICATION NOTE. AT12405: Low Power Sensor Design with PTC. Atmel MCU Integrated Touch. Introduction

APPLICATION NOTE. AT16268: JD Smart Cloud Based Smart Plug Getting. Started Guide ATSAMW25. Introduction. Features

AVR131: Using the AVR s High-speed PWM. Introduction. Features. AVR 8-bit Microcontrollers APPLICATION NOTE

USER GUIDE. ZigBit USB Stick User Guide. Introduction

Atmel AVR4921: ASF - USB Device Stack Differences between ASF V1 and V2. 8-bit Atmel Microcontrollers. Application Note. Features.

AVR1900: Getting started with ATxmega128A1 on STK bit Microcontrollers. Application Note. 1 Introduction

APPLICATION NOTE. Atmel AVR134: Real Time Clock (RTC) Using the Asynchronous Timer. Atmel AVR 8-bit Microcontroller. Introduction.

APPLICATION NOTE Atmel AT02509: In House Unit with Bluetooth Low Energy Module Hardware User Guide 8-bit Atmel Microcontroller Features Description

Atmel AVR4903: ASF - USB Device HID Mouse Application. Atmel Microcontrollers. Application Note. Features. 1 Introduction

AVR033: Getting Started with the CodeVisionAVR C Compiler. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

AVR1922: Xplain Board Controller Firmware. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

32-bit AVR UC3 Microcontrollers. 32-bit AtmelAVR Application Note. AVR32769: How to Compile the standalone AVR32 Software Framework in AVR32 Studio V2

APPLICATION NOTE. Authentication Counting. Atmel CryptoAuthentication. Features. Introduction

AVR106: C Functions for Reading and Writing to Flash Memory. Introduction. Features. AVR 8-bit Microcontrollers APPLICATION NOTE

AVR1309: Using the XMEGA SPI. 8-bit Microcontrollers. Application Note. Features. 1 Introduction SCK MOSI MISO SS

Application Note. 8-bit Microcontrollers. AVR270: USB Mouse Demonstration

AVR115: Data Logging with Atmel File System on ATmega32U4. Microcontrollers. Application Note. 1 Introduction. Atmel

AN3332 Application note

AVR1318: Using the XMEGA built-in AES accelerator. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

AVR32701: AVR32AP7 USB Performance. 32-bit Microcontrollers. Application Note. Features. 1 Introduction

AT91SAM ARM-based Flash MCU. Application Note

Capacitive Touch Technology Opens the Door to a New Generation of Automotive User Interfaces

APPLICATION NOTE. Atmel AT04389: Connecting SAMD20E to the AT86RF233 Transceiver. Atmel SAMD20. Description. Features

8-bit. Application Note. Microcontrollers. AVR282: USB Firmware Upgrade for AT90USB

Designing Feature-Rich User Interfaces for Home and Industrial Controllers

UM0834 User manual. Developing and debugging your STM8S-DISCOVERY application code. Introduction. Reference documents

Using CryptoMemory in Full I 2 C Compliant Mode. Using CryptoMemory in Full I 2 C Compliant Mode AT88SC0104CA AT88SC0204CA AT88SC0404CA AT88SC0808CA

AVR127: Understanding ADC Parameters. Introduction. Features. Atmel 8-bit and 32-bit Microcontrollers APPLICATION NOTE

APPLICATION NOTE. Atmel AT01095: Joystick Game Controller Reference Design. 8-/16-bit Atmel Microcontrollers. Features.

AVR317: Using the Master SPI Mode of the USART module. 8-bit Microcontrollers. Application Note. Features. Introduction

APPLICATION NOTE. AT17284: Proximetry Cloud Based Smart Plug User Guide. SMART ARM-based Microcontrollers. Introduction. Features

AVR319: Using the USI module for SPI communication. 8-bit Microcontrollers. Application Note. Features. Introduction

AVR32138: How to optimize the ADC usage on AT32UC3A0/1, AT32UC3A3 and AT32UC3B0/1 series. 32-bit Microcontrollers. Application Note.

Atmel AVR4920: ASF - USB Device Stack - Compliance and Performance Figures. Atmel Microcontrollers. Application Note. Features.

AVR1301: Using the XMEGA DAC. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

Application Note. 8-bit Microcontrollers. AVR272: USB CDC Demonstration UART to USB Bridge

AVR1600: Using the XMEGA Quadrature Decoder. 8-bit Microcontrollers. Application Note. Features. 1 Introduction. Sensors

APPLICATION NOTE. Atmel AVR443: Sensor-based Control of Three Phase Brushless DC Motor. Atmel AVR 8-bit Microcontrollers. Features.

AVR287: USB Host HID and Mass Storage Demonstration. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

AVR1510: Xplain training - XMEGA USART. 8-bit Microcontrollers. Application Note. Prerequisites. 1 Introduction

Introducing a platform to facilitate reliable and highly productive embedded developments

Atmel AT32UC3A3256 microcontroller 64MBit SDRAM Analog input (to ADC) Temperature sensor RC filter

Application Note. Atmel ATSHA204 Authentication Modes. Prerequisites. Overview. Introduction

AVR353: Voltage Reference Calibration and Voltage ADC Usage. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

APPLICATION NOTE. Atmel AT02985: User s Guide for USB-CAN Demo on SAM4E-EK. Atmel AVR 32-bit Microcontroller. Features. Description.

AVR125: ADC of tinyavr in Single Ended Mode. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

Figure 1. 8-Bit USB Debug Adapter

APPLICATION NOTE. Atmel LF-RFID Kits Overview. Atmel LF-RFID Kit. LF-RFID Kit Introduction

General Porting Considerations. Memory EEPROM XRAM

AVR315: Using the TWI Module as I2C Master. Introduction. Features. AVR 8-bit Microcontrollers APPLICATION NOTE

AN3265 Application note

AVR126: ADC of megaavr in Single Ended Mode. Introduction. Features. AVR 8-bit Microcontrollers APPLICATION NOTE

AVR32788: AVR 32 How to use the SSC in I2S mode. 32-bit Microcontrollers. Application Note. Features. 1 Introduction

Atmel AVR1017: XMEGA - USB Hardware Design Recommendations. 8-bit Atmel Microcontrollers. Application Note. Features.

AVR311: Using the TWI Module as I2C Slave. Introduction. Features. AVR 8-bit Microcontrollers APPLICATION NOTE

AVR030: Getting Started with IAR Embedded Workbench for Atmel AVR. 8-bit Microcontrollers. Application Note. Features.

Using the RS232 serial evaluation boards on a USB port

PC Base Adapter Daughter Card UART GPIO. Figure 1. ToolStick Development Platform Block Diagram

Atmel AVR ATxmega384C3 microcontroller OLED display with pixels resolution Analog sensors. Ambient light sensor Temperature sensor

AN2680 Application note

AVR305: Half Duplex Compact Software UART. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

AN3252 Application note

AN3354 Application note

AVR1321: Using the Atmel AVR XMEGA 32-bit Real Time Counter and Battery Backup System. 8-bit Microcontrollers. Application Note.

Develop a Dallas 1-Wire Master Using the Z8F1680 Series of MCUs

How To Design An Ism Band Antenna For 915Mhz/2.4Ghz Ism Bands On A Pbbb (Bcm) Board

SAMA5D2. Scope. Reference Documents. Atmel SMART ARM-based MPU ERRATA

Atmel SMART ARM Core-based Embedded Microprocessors

Atmel Power Line Communications. Solutions for the Smart Grid

Dell Statistica Statistica Enterprise Installation Instructions

Dell Spotlight on Active Directory Server Health Wizard Configuration Guide

Current Digital to Analog Converter

Temperature & Humidity SMS Alert Controller

Software Prerequisites Linux Ubuntu LTS. Estimated completion time: 15min. The goal of this hands-on is to:

Dell One Identity Cloud Access Manager How to Configure vworkspace Integration

COM Port Stress Test

Application Note. 8-bit Microcontrollers. AVR293: USB Composite Device

Spotlight Management Pack for SCOM

AT12181: ATWINC1500 Wi-Fi Network Controller - AP Provision Mode. Introduction. Features. Atmel SmartConnect APPLICATION NOTE

SAM D21 Xplained Pro. Preface. SMART ARM-based Microcontrollers USER GUIDE

AVR245: Code Lock with 4x4 Keypad and I2C LCD. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

UM1727 User manual. Getting started with STM32 Nucleo board software development tools. Introduction

AN3998 Application note

Application Note. Atmel CryptoAuthentication Product Uses. Atmel ATSHA204. Abstract. Overview

AVR2006: Design and characterization of the Radio Controller Board's 2.4GHz PCB Antenna. Application Note. Features.

UM1680 User manual. Getting started with STM32F429 Discovery software development tools. Introduction

Capacitive Touch Lab. Renesas Capacitive Touch Lab R8C/36T-A Family

USER GUIDE. ATWINC1500B Hardware Design Guidelines - IEEE b/g/n IoT Module. Atmel SmartConnect. Introduction

4.0. Offline Folder Wizard. User Guide

Transcription:

Atmel AVR 8-bit Microcontrollers AT12075: ATmega328PB Xplained Mini Demo APPLICATION NOTE Introduction This application note describes how to control the brightness of LED (USER LED on the ATmega328PB Xplained Mini kit) by using the Peripheral Touch Controller (PTC) module of the Atmel AVR ATmega328PB device. The PTC module is used for position sensing of the capacitive touch slider present on the Xplained Mini kit. The slider position is used to vary the PWM duty cycle hence control the brightness of the USER LED. The source code is available for download along with this application note. An ATmega328PB Xplained Mini kit is used to demonstrate the application. Features Low-power, high-sensitivity, environmentally robust capacitive touch buttons, sliders, wheels, and proximity sensing Minimal external components

Table of Contents Introduction...1 Features... 1 1. Abbreviation...3 2. Pre-requisties...4 3. ATmega328PB Xplained Mini... 5 3.1. Board Overview...5 3.2. Enumeration and Detection...5 4. PTC - Peripheral Touch Controller...7 4.1. Overview...7 4.2. Self-capacitance Sensor Arrangement...7 4.3. Functional Description...8 5. Demo Project...9 5.1. Application Overview...9 5.1.1. Software PWM...9 5.2. Configuration... 10 5.3. Flowchart... 11 5.4. Downloading and Executing the Application... 12 5.5. Procedure and Result...13 6. References... 15 7. Revision History...16 2

1. Abbreviation COM GPIO ITO IDP LED MCU medbg PC PCB PTC PWM USB Communication Port General Purpose Input/Output Pins Indium Tin Oxide Integrated Development Platform Light Emitting Diode Micro Controller Unit Mini Embedded Debugger Personal Computer Printed Circuit Board Peripheral Touch Controller Pulse Width Modulation Universal Serial Bus 3

2. Pre-requisties The solution discussed in this document requires: Atmel Studio 7.0 or later ATmega328PB Xplained Mini kit Example Source Code available for download with this application note 4

3. ATmega328PB Xplained Mini 3.1. Board Overview The ATmega328PB Xplained Mini evaluation kit is a hardware platform to evaluate the Atmel ATmega328PB microcontroller. The evaluation kit comes with a fully integrated debugger that provides seamless integration with Atmel Studio 6.2 (and later version). The kit provides access to the features of the ATmega328PB enabling easy integration of the device in a custom design. For more details about this kit, refer the Atmel ATmega328PB Xplained Mini user guide available at http:// www.atmel.com/images/atmel-42469-atmega328pb-xplained-mini_user-guide.pdf Figure 3-1. ATmega328PB Xplained Mini Kit 3.2. Enumeration and Detection When the ATmega328PB Xplained Mini kit is connected to the PC, Windows will enumerate the device and install appropriate driver. If the driver installed successfully, medbg will be listed in the Device Manager as medbg Virtual COM port under Ports as shown in the following screenshots. Figure 3-2. Tool Enumeration 5

Figure 3-3. Successful medbg Driver Installation 6

4. PTC - Peripheral Touch Controller 4.1. Overview Atmel QTouch Peripheral Touch Controller (PTC) offers built-in hardware for capacitive touch measurement on sensors that function as buttons, sliders, and wheels. The PTC supports both mutual and self-capacitance measurement without the need for any external component. It offers high sensitivity and noise tolerance, as well as self-calibration, and minimizes the sensitivity tuning effort by the user. The PTC is intended for autonomously performing capacitive touch sensor measurements. The external capacitive touch sensor is typically formed on a PCB, and the sensor electrodes are connected to the analog charge integrator of the PTC using the device I/O pins. The PTC supports mutual capacitance sensors organized as capacitive touch matrices in different X-Y configurations, including Indium Tin Oxide (ITO) sensor grids. In mutual capacitance mode, the PTC requires one pin per X-line (drive line) and one pin per Y-line (sense line). In self-capacitance mode, the PTC requires only one pin with a Y-line driver for each self-capacitance sensor. This application note uses self-capacitance mode to detect touch on capacitive sensors. For more details on the PTC module, refer the ATmega328PB datasheet. Figure 4-1. PTC Block Diagram Self-capacitance 4.2. Self-capacitance Sensor Arrangement The self-capacitance sensor is connected to a single pin on the Peripheral Touch Controller through the Y electrode for receiving the signal. The sense electrode capacitance is measured by the Peripheral Touch Controller. 7

Figure 4-2. Self-capacitance Sensor Arrangement For more information about designing the touch sensor, refer to Buttons, Sliders, and Wheels Touch Sensor Design Guide on http://www.atmel.com. 4.3. Functional Description In order to access the PTC, the user must use the QTouch Composer tool to configure and link the QTouch Library firmware with the application code. QTouch Library can be used to implement buttons, sliders, wheels, and proximity sensor in a variety of combinations on a single interface. Figure 4-3. QTouch Library Usage For more information about QTouch Library, refer to the Atmel QTouch Library Peripheral Touch Controller User Guide available at http://www.atmel.com/images/atmel-42195-qtouch-library-peripheral-touchcontroller_user-guide.pdf. 8

5. Demo Project The demo code associated with this application note is available as compressed zip file in Atmel Website. To load the code in the Atmel Studio, 1. Extract the zip file to get the project and associated source code. 2. Start Atmel Studio, go to File > Open and click on Project/Solution. The shortcut key is (CTRL + Shift + O). Figure 5-1. Opening Example Project in Atmel Studio 3. Open Project Dialog box will appear. 4. Select the Example project solution file (.atsln) and click Open. 5. Alternate method is to double click the (.atsln) file from the extracted folder, this action will start Atmel Studio and then load the project. 5.1. Application Overview The demo application consists of following two components: 1. The Atmel QTouch Library. 2. The demo code which controls the duty cycle of timer based software PWM. The QTouch Library is used by the Demo application to sense capacitive touch slider position using builtin hardware capacitive touch sense module (PTC), the application uses this slider position to vary the duty cycle of the software PWM, which controls the brightness of the USER LED connected to PORT PB5. For more details, refer section Software PWM on page 9. Figure 5-2. Application Block Diagram 5.1.1. Software PWM PWM waveform generated using manual setting/clearing of GPIO in periodic manner using a Timer is called software PWM. 9

5.2. Configuration The ATmega328PB Xplained Mini board contains an on-chip medbg debugger(atmega32u4) which provides 16MHz clock to the target ATmega328PB device. The target device prescales it by 2 to generate 8MHz device clock. Figure 5-3. Clock Configuration The modules used by this demo application are: Timer0: Used to generate Software PWM output on GPIO to control LED brightness. Timer2: Used to time the QTouch Library. PTC: Used to scan capacitive touch sensors. 10

5.3. Flowchart configure_prescaler: This function configures the prescaler to divides the 16MHz clock provided by the medbg debugger by 2 to generate 8MHz system clock. timer_init: Initializes Timer0 for software PWM and Timer2 for timing QTouch Library. touch_sensors_init: Initializes QTouch library and configures touch sensors. configure_port_pins: Configures USER LED pin as output. touch_sensors_measure: Measures the capacitive touch sensors. 11

5.4. Downloading and Executing the Application The firmware corresponding to this application note is available at www.atmel.com. The following steps will explain how to program and execute this application. 1. Open the project in Atmel Studio and compile it. Refer section Demo Project on page 9 for more information on how to open the solution in Atmel Studio. 2. To program the target device, go to Project > Project Properties>Tools tab. Select the tool as medbg and interface as debugwire as shown in the following image. Figure 5-4. Tool and Interface Configuration for Programming 3. To begin programming, click Start Without Debugging in the toolbar as shown in the following image. Figure 5-5. Programming the Device 4. To debug the code, go to Tools tab. Select medbg as Debugger/Programmer with debugwire Interface as in shown in the following image. 12

Figure 5-6. Tool and Interface Configuration for Debugging 5. To start debugging, click Start Debugging in the toolbar as shown in the following image. Figure 5-7. Debugging the Device 5.5. Procedure and Result When the application is programmed in to the device in Xplained Mini kit, slowly slide the finger on the capacitive touch slider and the brightness of the LED will increase when sliding slowly from left to right and brightness will decrease when sliding right to left. 13

Figure 5-8. Slider Location in ATmega328PB Xplained Mini kit 14

6. References Atmel QTouch Library Peripheral Touch Controller User Guide (http://www.atmel.com/images/ atmel-42195-qtouch-library-peripheral-touch-controller_user-guide.pdf) ATmega328PB datasheet (http://www.atmel.com/devices/atmega328pb.aspx) ATmega328PB Xplained Mini kit (http://www.atmel.com/tools/mega328pb-xmini.aspx) 15

7. Revision History Doc Rev. Date Comments 42652A 02/2016 Initial document release. 16

Atmel Corporation 1600 Technology Drive, San Jose, CA 95110 USA T: (+1)(408) 441.0311 F: (+1)(408) 436.4200 www.atmel.com 2016 Atmel Corporation. / Rev.: Atmel, Atmel logo and combinations thereof, Enabling Unlimited Possibilities, AVR, QTouch, and others are registered trademarks or trademarks of Atmel Corporation in U.S. and other countries. Other terms and product names may be trademarks of others. DISCLAIMER: The information in this document is provided in connection with Atmel products. No license, express or implied, by estoppel or otherwise, to any intellectual property right is granted by this document or in connection with the sale of Atmel products. EXCEPT AS SET FORTH IN THE ATMEL TERMS AND CONDITIONS OF SALES LOCATED ON THE ATMEL WEBSITE, ATMEL ASSUMES NO LIABILITY WHATSOEVER AND DISCLAIMS ANY EXPRESS, IMPLIED OR STATUTORY WARRANTY RELATING TO ITS PRODUCTS INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, CONSEQUENTIAL, PUNITIVE, SPECIAL OR INCIDENTAL DAMAGES (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS AND PROFITS, BUSINESS INTERRUPTION, OR LOSS OF INFORMATION) ARISING OUT OF THE USE OR INABILITY TO USE THIS DOCUMENT, EVEN IF ATMEL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. Atmel makes no representations or warranties with respect to the accuracy or completeness of the contents of this document and reserves the right to make changes to specifications and products descriptions at any time without notice. Atmel does not make any commitment to update the information contained herein. Unless specifically provided otherwise, Atmel products are not suitable for, and shall not be used in, automotive applications. Atmel products are not intended, authorized, or warranted for use as components in applications intended to support or sustain life. SAFETY-CRITICAL, MILITARY, AND AUTOMOTIVE APPLICATIONS DISCLAIMER: Atmel products are not designed for and will not be used in connection with any applications where the failure of such products would reasonably be expected to result in significant personal injury or death ( Safety-Critical Applications ) without an Atmel officer's specific written consent. Safety-Critical Applications include, without limitation, life support devices and systems, equipment or systems for the operation of nuclear facilities and weapons systems. Atmel products are not designed nor intended for use in military or aerospace applications or environments unless specifically designated by Atmel as military-grade. Atmel products are not designed nor intended for use in automotive applications unless specifically designated by Atmel as automotive-grade.