- Industrial & lab equipment
- Electrical equipment & supplies
- Atmel
- ATmega328PB Xplained Mini
- User manual
- 17 Pages
Atmel ATmega328PB Xplained Mini Microcontroller Application note
Below you will find brief information for ATmega328PB Xplained Mini. The Atmel ATmega328PB Xplained Mini evaluation kit is a hardware platform to evaluate the Atmel ATmega328PB microcontroller. It 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. The kit provides a capacitive touch slider that can be used to control the brightness of an LED.
advertisement
Assistant Bot
Need help? Our chatbot has already read the manual and is ready to assist you. Feel free to ask any questions about the device, but providing details will make the conversation more productive.
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
Atmel-42652A-ATmega328PB-Xplained-Mini-Demo_AT12075_Application Note-02/2016
Table of Contents
Atmel AT12075: ATmega328PB Xplained Mini Demo [APPLICATION NOTE]
Atmel-42652A-ATmega328PB-Xplained-Mini-Demo_AT12075_Application Note-02/2016
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
Atmel AT12075: ATmega328PB Xplained Mini Demo [APPLICATION NOTE]
Atmel-42652A-ATmega328PB-Xplained-Mini-Demo_AT12075_Application Note-02/2016
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
Atmel AT12075: ATmega328PB Xplained Mini Demo [APPLICATION NOTE]
Atmel-42652A-ATmega328PB-Xplained-Mini-Demo_AT12075_Application Note-02/2016
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
Atmel AT12075: ATmega328PB Xplained Mini Demo [APPLICATION NOTE]
Atmel-42652A-ATmega328PB-Xplained-Mini-Demo_AT12075_Application Note-02/2016
5
Figure 3-3. Successful mEDBG Driver Installation
Atmel AT12075: ATmega328PB Xplained Mini Demo [APPLICATION NOTE]
Atmel-42652A-ATmega328PB-Xplained-Mini-Demo_AT12075_Application Note-02/2016
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.
Atmel AT12075: ATmega328PB Xplained Mini Demo [APPLICATION NOTE]
Atmel-42652A-ATmega328PB-Xplained-Mini-Demo_AT12075_Application Note-02/2016
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
.
Atmel AT12075: ATmega328PB Xplained Mini Demo [APPLICATION NOTE]
Atmel-42652A-ATmega328PB-Xplained-Mini-Demo_AT12075_Application Note-02/2016
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
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.
Atmel AT12075: ATmega328PB Xplained Mini Demo [APPLICATION NOTE]
Atmel-42652A-ATmega328PB-Xplained-Mini-Demo_AT12075_Application Note-02/2016
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.
Atmel AT12075: ATmega328PB Xplained Mini Demo [APPLICATION NOTE]
Atmel-42652A-ATmega328PB-Xplained-Mini-Demo_AT12075_Application Note-02/2016
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.
Atmel AT12075: ATmega328PB Xplained Mini Demo [APPLICATION NOTE]
Atmel-42652A-ATmega328PB-Xplained-Mini-Demo_AT12075_Application Note-02/2016
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
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.
Atmel AT12075: ATmega328PB Xplained Mini Demo [APPLICATION NOTE]
Atmel-42652A-ATmega328PB-Xplained-Mini-Demo_AT12075_Application Note-02/2016
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.
Atmel AT12075: ATmega328PB Xplained Mini Demo [APPLICATION NOTE]
Atmel-42652A-ATmega328PB-Xplained-Mini-Demo_AT12075_Application Note-02/2016
13
Figure 5-8. Slider Location in ATmega328PB Xplained Mini kit
Atmel AT12075: ATmega328PB Xplained Mini Demo [APPLICATION NOTE]
Atmel-42652A-ATmega328PB-Xplained-Mini-Demo_AT12075_Application Note-02/2016
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
)
Atmel AT12075: ATmega328PB Xplained Mini Demo [APPLICATION NOTE]
Atmel-42652A-ATmega328PB-Xplained-Mini-Demo_AT12075_Application Note-02/2016
15
7. Revision History
Doc Rev.
42652A
Date
02/2016
Comments
Initial document release.
Atmel AT12075: ATmega328PB Xplained Mini Demo [APPLICATION NOTE]
Atmel-42652A-ATmega328PB-Xplained-Mini-Demo_AT12075_Application Note-02/2016
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-42652A-ATmega328PB-Xplained-Mini-Demo_AT12075_Application Note-02/2016
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.
advertisement
Key Features
- Low-power, high-sensitivity, environmentally robust capacitive touch buttons, sliders, wheels, and proximity sensing
- Minimal external components
- Easy integration of the device in a custom design
- Fully integrated debugger provides seamless integration with Atmel Studio
- Capacitive touch slider
- Control brightness of LED
- Control PWM duty cycle
Frequently Answers and Questions
What is the purpose of the Atmel ATmega328PB Xplained Mini evaluation kit?
What are the kit's features?
How can I use the capacitive touch slider to control the brightness of the LED?
Related manuals
advertisement
Table of contents
- 1 Introduction
- 1 Features
- 3 1. Abbreviation
- 4 2. Pre-requisties
- 5 3. ATmega328PB Xplained Mini
- 5 Board Overview
- 5 Enumeration and Detection
- 7 4. PTC - Peripheral Touch Controller
- 7 Overview
- 7 Self-capacitance Sensor Arrangement
- 8 Functional Description
- 9 5. Demo Project
- 9 Application Overview
- 9 Software PWM
- 10 Configuration
- 11 Flowchart
- 12 Downloading and Executing the Application
- 13 Procedure and Result
- 15 6. References
- 16 7. Revision History