AT12405: Low Power Sensor Design with...
Transcript of AT12405: Low Power Sensor Design with...
APPLICATION NOTE
AT12405: Low Power Sensor Design with PTC
Atmel MCU Integrated Touch
Introduction
“A mA saved (reduced) is a mAh gained” – the philosophical engineer…
The challenges for improving battery life for wearables and remote IoT node
applications require designing of components that consume very low power or
use battery with higher charge capacity.
Improvements in battery technology are noteworthy but they are not evolving fast
enough. Although batteries are becoming energy dense, designers are adopting
low capacity batteries to reduce overall physical form factor and cost. Power
consumption remains an important factor in the design of any portable gadget.
The Atmel® capacitive touch technology using the Peripheral Touch Controller
(PTC) provides features to design a Low Power Touch sensor that can wake-up
on touch from standby sleep without CPU intervention.
This document describes the details of designing a Low Power Touch sensor,
different sensor configurations, tips and tricks to optimize the power
consumption.
Atmel-42441A-Low-Power-Sensor-Design-with-PTC_ApplicationNote_AT12405_042015
AT12405: Low Power Sensor Design with PTC [APPLICATION NOTE] Atmel-42441A-Low-Power-Sensor-Design-with-PTC_ApplicationNote_AT12405_042015 2
2
Table of Contents
1 Touch Sensing with PTC ............................................................................................. 3
2 SleepWalking ............................................................................................................... 4
3 Low Power Mode ......................................................................................................... 5
4 Implementing Low Power Sensor............................................................................... 6
4.1 State Machine ....................................................................................................................................... 6
4.2 Lumped Mode ....................................................................................................................................... 7
4.2.1 Lumped Sensor in Self Capacitance ........................................................................................ 7
4.2.2 Lumped Sensor in Mutual Capacitance .................................................................................... 7
4.3 Sensor Configurations ........................................................................................................................... 9
4.3.1 Power ON Key .......................................................................................................................... 9
4.3.2 All Keys Lumped Together ....................................................................................................... 9
4.3.3 Some Keys Lumped Together ................................................................................................ 10
5 Firmware ................................................................................................................... 11
5.1 Configuring Low Power Sensor ........................................................................................................... 11
5.2 Configuring Lumped Sensor ................................................................................................................ 11
5.2.1 Configuring Lumped Sensor in Self Capacitance ................................................................... 12
5.2.2 Configuring Lumped Sensor in Mutual Capacitance ............................................................... 12
5.3 Sensitivity Tuning of Low Power Sensor ............................................................................................. 12
6 Optimizing Design for Low Power ............................................................................ 13
6.1 Active Scan Rate ................................................................................................................................. 13
6.2 Awake Timeout ................................................................................................................................... 13
6.3 Low Power Scan Rate ......................................................................................................................... 13
6.4 Low Power Drift Rate .......................................................................................................................... 13
7 Current Consumption ................................................................................................ 14
8 References ................................................................................................................. 15
9 Revision History ........................................................................................................ 16
AT12405: Low Power Sensor Design with PTC [APPLICATION NOTE] Atmel-42441A-Low-Power-Sensor-Design-with-PTC_ApplicationNote_AT12405_042015
3
3
1 Touch Sensing with PTC
The Peripheral Touch Controller (PTC) has been designed to perform capacitive touch acquisition on sensors
independently from the CPU. This releases the CPU to perform other processor intensive application tasks.
Alternatively the CPU can be put to sleep during touch acquisition, thereby reducing power consumption.
In user application, RTC/Timer interrupt wakes up the CPU periodically to initiate the PTC to perform touch
measurement. This mechanism is referred to as Active Measurement Mode.
In active measurement, the CPU configures the PTC and goes to sleep. The PTC performs touch acquisition
sequentially on all enabled sensor channels, while the CPU is in sleep. The PTC issues an interrupt to wake up
the CPU after acquisition is completed for each individual sensor channel. On wakeup, the CPU re-configures
the PTC to start acquisition on next sensor channel.
This cycle of CPU (PTC Configuration) ↔ PTC (Acquisition) continues until acquisition is done on all the
enabled sensor channels. On completion of acquisition on the last channel, the CPU performs post processing
on acquired signal data.
Figure 1-1. Active Measurement
AT12405: Low Power Sensor Design with PTC [APPLICATION NOTE] Atmel-42441A-Low-Power-Sensor-Design-with-PTC_ApplicationNote_AT12405_042015 4
4
2 SleepWalking
Atmel has added intelligence to the peripherals which allows the peripherals to determine if the incoming data
requires use of CPU or not. This feature is termed as SleepWalking because it allows the CPU to continue in
sleep mode and wake up only on a pre-qualified event. This eliminates unnecessary CPU wakeups and helps
to reduce power consumption.
The CPU and RAM consume the majority of the power in active mode. SleepWalking allows the Event System
to handle asynchronous events in various sleep modes by requesting a local clock module for the duration of
the Event Processing. Once the event processing is done, the requested clock is disabled and the module
goes back to sleep.
Figure 2-1. Event System
The Peripheral Event System allows for direct communication between peripherals without involving the CPU.
It is a routing network independent of the traditional data path (system buses). Different triggers can be
handled at the peripheral level that would result in an event; like a data transfer to another peripheral or
activating some peripheral.
The Event System simplifies the way of handling data or actions for a power limited application. As no
interrupts are required to pass information, this avoids any CPU usage for data transfer, action, or computation.
So the CPU can be put in low power mode.
AT12405: Low Power Sensor Design with PTC [APPLICATION NOTE] Atmel-42441A-Low-Power-Sensor-Design-with-PTC_ApplicationNote_AT12405_042015
5
5
3 Low Power Mode
Low Power mode utilizes the SleepWalking feature of the PTC to perform capacitive touch sensing
autonomously on a single sensor channel that is designated as the low power sensor. This mechanism utilizes
the Event System and allows the CPU to be in sleep throughout the operation, thereby minimizing power
consumption. PTC issues an interrupt to wake up the CPU only when a valid touch event is detected on the
low power sensor.
Figure 3-1. Low Power Measurement
Although PTC performs touch measurement on the configured low power sensor, it has
no inbuilt mechanism to adjust the Reference value to compensate for the gradual
environmental changes. To accomplish the Drift Compensation feature in low power
mode, the CPU wakes up at periodic intervals to perform one active measurement. This
measurement is performed by the QTouch® Library to monitor the real-time Signal and
adjust the Reference accordingly.
AT12405: Low Power Sensor Design with PTC [APPLICATION NOTE] Atmel-42441A-Low-Power-Sensor-Design-with-PTC_ApplicationNote_AT12405_042015 6
6
4 Implementing Low Power Sensor
In user application, the low power sensor is implemented as a wakeup source. Once a valid touch is detected
on the low power sensor, an interrupt is issued that wakes up the CPU for further processing.
4.1 State Machine
The firmware switches between low power mode and active measurement mode during the entire operation to
achieve optimal performance with lowest power consumption.
Figure 4-1. Low Power Sensor State Machine
After the initialization of the sensors, the device starts with active measurement mode by default. If there is no
touch activity detected for a certain interval of time, the device automatically switches to low power mode.
Before switching to low power mode, the Event System is enabled and the designated sensor is configured as
low power sensor.
The device keeps scanning the low power sensor autonomously until it detects any activity. If the touch delta is
found to be greater than the Detect Threshold on the low power sensor, the PTC issues an interrupt and wakes
up the CPU. On wakeup, the CPU disables the Event System and resumes the active measurement.
AT12405: Low Power Sensor Design with PTC [APPLICATION NOTE] Atmel-42441A-Low-Power-Sensor-Design-with-PTC_ApplicationNote_AT12405_042015
7
7
4.2 Lumped Mode
PTC features Lumped mode configuration that allows to combine multiple Y-lines (Self Capacitance) or
multiple X- and Y-lines (Mutual Capacitance) to form a single sensor. This feature allows combining multiple
physical sensors and configure them as a single sensor called a lumped sensor.
The use of Lumped mode improves power consumption and response time. In applications with large number
of keys, the sensors can be arranged in groups to form multiple lumped sensors. Scanning can be performed
only on the lumped sensors. When one of the lumped sensor shows touch detection, only the keys within that
lumped sensor is individually measured to determine which key is actually touched. This improves the
efficiency of the system since lesser number of measurement cycles are needed compared to scanning for all
the individual keys.
4.2.1 Lumped Sensor in Self Capacitance
In a self-capacitance design, the user needs to configure the Y-lines that are combined together to form a
lumped sensor. In this example we consider a system with three Y-lines that are combined to create one
lumped sensor.
Figure 4-2. Self Capacitance Lumped Mode
4.2.2 Lumped Sensor in Mutual Capacitance
In a mutual-capacitance design, the user needs to configure the X-lines and the Y-lines that are combined
together to form a lumped sensor. In this example we consider a system with three X- and three Y-lines, out of
which three X- and two Y-lines are combined to create one lumped sensor.
Figure 4-3. Mutual Capacitance Lumped Mode
AT12405: Low Power Sensor Design with PTC [APPLICATION NOTE] Atmel-42441A-Low-Power-Sensor-Design-with-PTC_ApplicationNote_AT12405_042015 8
8
Capacitive load of a lumped sensor should not exceed the maximum limit of ~30pF for
both self and mutual capacitance. The designer must select appropriate number of keys
to form a lumped sensor ensuring this limit is not exceeded. If this limit is exceeded
QTouch Library will throw a calibration error.
AT12405: Low Power Sensor Design with PTC [APPLICATION NOTE] Atmel-42441A-Low-Power-Sensor-Design-with-PTC_ApplicationNote_AT12405_042015
9
9
4.3 Sensor Configurations
Any sensor can be configured as a low power sensor. The following section covers the typical application
scenarios for a low power sensor.
4.3.1 Power ON Key
This is the most basic configuration for a low power sensor implementation. One key out of all the available
keys in a touch panel is configured as the low power sensor. This acts as a Power ON key for the entire touch
panel.
Figure 4-4. One Button as the Low Power Sensor
4.3.2 All Keys Lumped Together
Lumped Mode configuration in the PTC allows to combine multiple sensors as one. Using this feature all the
sensor electrodes can be combined together to form a big sensor. This lumped sensor can be configured as a
low power sensor. Touching any key in the panel would wake up the device.
Figure 4-5. All Buttons Lumped and Configured as Low Power Sensor
AT12405: Low Power Sensor Design with PTC [APPLICATION NOTE] Atmel-42441A-Low-Power-Sensor-Design-with-PTC_ApplicationNote_AT12405_042015 1
0
10
4.3.3 Some Keys Lumped Together
Instead of all keys configured as a one lumped sensor, only some few keys are configured as a lumped sensor.
This will allow user to limit the wakeup region on touch panel to a few sensors.
Figure 4-6. Partial Group of Keys Lumped and Configured as Low Power Sensor
Low power sensor configuration only allows use of one X- and Y-channel. Thus in principle, a
slider or a rotor cannot be configured as low power sensor since they are composed of multiple
sensor channels. However all the channels of a slider or rotor can be configured as a single
lumped sensor and this can be configured as a low power sensor.
AT12405: Low Power Sensor Design with PTC [APPLICATION NOTE] Atmel-42441A-Low-Power-Sensor-Design-with-PTC_ApplicationNote_AT12405_042015
11
11
5 Firmware
The QTouch Library has example projects for Low Power configuration. There are separate example projects
for Self Capacitance and Mutual Capacitance.
These are available in the Atmel Studio under File → New → Example Project…
Figure 5-1. Low Power Example Projects
The example projects are configured to run on the SAM D20 Xplained Pro kit along with QT1 Xplained Pro
extension board. Both example projects feature lumped sensor as the low power sensor.
QTouch Library 5.5.0.167 and QTouch Composer 5.5.170.0 or above extensions must
be installed in Atmel Studio for these projects to be available.
5.1 Configuring Low Power Sensor
Any key or lumped sensor can be configured as a low power sensor by assigning its corresponding sensor ID
to DEF_LOWPOWER_SENSOR_ID in the touch.h file.
5.2 Configuring Lumped Sensor
Although the lumped sensor is created out of the existing sensors, the QTouch Library considers it to be a
separate sensor. The lumped sensor is provided with its own unique Channel ID and Sensor ID.
Lumped sensors are configured using the touch_selfcap_sensor_config() or
touch_mutlcap_sensor_config() function and need to be defined as SENSOR_TYPE_LUMP in the
function arguments.
Lumped sensors are viewed as additional sensors by the library and must be added to the macro
DEF_SELFCAP_NUM_SENSORS or DEF_SELFCAP_NUM_SENSORS.
AT12405: Low Power Sensor Design with PTC [APPLICATION NOTE] Atmel-42441A-Low-Power-Sensor-Design-with-PTC_ApplicationNote_AT12405_042015 1
2
12
5.2.1 Configuring Lumped Sensor in Self Capacitance
The Y lines for the lumped sensor should be defined as follows:
#define DEF_SELFCAP_LINES Y(0), Y(1), Y(2), LUMP_Y(0,1,2)
The lumped sensor has been defined as the 3rd channel above, thus it is assigned as CHANNEL_3. The
sensor configuration should be done as follows:
touch_selfcap_sensor_config(SENSOR_TYPE_LUMP, CHANNEL_3, CHANNEL_3, NO_AKS_GROUP,
40u, HYST_6_25, RES_8_BIT, &sensor_id);
5.2.2 Configuring Lumped Sensor in Mutual Capacitance
The X- and Y-lines for the lumped sensor should be defined as follows:
#define DEF_MULTCAP_NODES X(0),Y(0), X(1),Y(0), X(2),Y(0), \
X(0),Y(1), X(1),Y(1), X(2),Y(1), \
X(0),Y(2), X(1),Y(2), X(2),Y(2), \
LUMP_X(0,1,2),LUMP_Y(1,2)
The lumped sensor node has been defined as the 10th channel above, thus it is assigned as CHANNEL_10.
The sensor configuration should be done as follows:
touch_multcap_sensor_config(SENSOR_TYPE_LUMP, CHANNEL_10, CHANNEL_10,
NO_AKS_GROUP, 40u, HYST_6_25, RES_8_BIT, &sensor_id);
5.3 Sensitivity Tuning of Low Power Sensor
The sensitivity tuning performed for the sensor in active measurement mode is still valid in low power mode.
The detect threshold of a sensor is passed as an argument to the touch_xxxxcap_sensor_config() function.
The same detect threshold value set during the sensor configuration is used in both active as well as low
power mode.
Ensure that lump sensor configuration does not results in a calibration error
(TOUCH_CC_CALIB_ERROR).
It can be tracked using p_XXXXcap_measure_data->p_sensors[<SENSOR>] state variable.
AT12405: Low Power Sensor Design with PTC [APPLICATION NOTE] Atmel-42441A-Low-Power-Sensor-Design-with-PTC_ApplicationNote_AT12405_042015
13
13
6 Optimizing Design for Low Power
Following are the parameters a designer can consider to optimize for low power.
6.1 Active Scan Rate
This refers to the interval between two successive acquisitions on all the enabled touch sensors when in active
measurement mode.
A high value for this parameter will increase the gap between two consecutive measurements, which increases
the duration of sleep between the measurements. This reduces the power consumption. However, since the
measurements happen at longer intervals, this will affect the touch response.
DEF_TOUCH_MEASUREMENT_PERIOD_MS parameter configures the scan interval in milliseconds.
6.2 Awake Timeout
This refers to the time the device will be in active measurement mode from the last sensor release state. Any
subsequent sensor state change would reinitialize the timeout interval.
Once the device is in active measurement mode it would continue to be in the same mode as long as the
sensors remains in detect. If there is no sensor activity for a period longer than the timeout interval, the device
returns to low power mode.
A low value for this parameter will ensure that the device goes to low power mode quickly, thereby reducing
power consumption.
NO_ACTIVITY_TRIGGER_TIME parameter configures the awake timeout interval in milliseconds.
6.3 Low Power Scan Rate
This configures the scan interval for the low power sensor in low power mode. This parameter accepts some
pre-defined scan rate settings. A high value for this parameter will reduce power consumption but increase
response time for the low power sensor.
DEF_LOWPOWER_SENSOR_EVENT_PERIODICITY parameter configures the low power scan rate.
Possible scan rates are 3.9, 7.8, 15.625, 31.25, 62.5, 125, 250, and 500 milliseconds.
6.4 Low Power Drift Rate
This parameter configures the scan interval for a single active measurement during low power mode. This
active measurement is required for reference tracking of low power sensor.
A high value for this parameter will perform an active measurement less frequently, thereby decreasing current
consumption. However, this will reduce the drift rate for the low power sensor to adjust its reference with
changing environmental conditions.
DEF_LOWPOWER_SENSOR_DRIFT_PERIODICITY_MS configures the scan interval in milliseconds.
To optimize on power, it is better to disable all the sensors, expect the low power sensor, before
entering Low Power mode. This will prevent drifting on all the sensors during the Low Power
Mode. The sensors should be re-enabled when the device returns back to active measurement
mode.
Also, disabling QDebug interface ensures that the device does not spend any extra time trying to
send Signal data. This will also lead to power savings.
AT12405: Low Power Sensor Design with PTC [APPLICATION NOTE] Atmel-42441A-Low-Power-Sensor-Design-with-PTC_ApplicationNote_AT12405_042015 1
4
14
7 Current Consumption
Table 7-1 and Table 7-2 provides current consumption values in Low Power Mode.
Hardware: SAM D20 Xplained Pro Kit with QT1 Xplained Pro Sensor.
Sensor Configuration: One channel configured as Low Power Sensor.
GAIN = 1
FILTER LEVEL = 16
Table 7-1. Current Consumption at Different Low Power Scan Rates
DEF_LOWPOWER_SENSOR_DRIFT_PERIODICITY_MS = 2000ms
DEF_LOWPOWER_SENSOR
_EVENT_PERIODICITY SELF – CAPACITANCE [µA] MUTUAL – CAPACITANCE [µA]
3.9ms 26.00 27.20
7.8ms 14.60 15.20
15.625ms 9.00 9.20
31.25ms 6.10 6.30
62.5ms 4.70 4.80
125ms 3.90 4.00
250ms 3.65 3.70
500ms 3.50 3.50
Table 7-2. Current Consumption at Different Low Power Drift Rate
DEF_LOWPOWER_SENSOR_EVENT_PERIODICITY = 500ms
DEF_LOWPOWER_SENSOR
_DRIFT_PERIODICITY SELF – CAPACITANCE [µA] MUTUAL – CAPACITANCE [µA]
1000ms 4.40 4.50
2000ms 3.50 3.50
3500ms 3.15 3.20
5000ms 3.00 3.00
AT12405: Low Power Sensor Design with PTC [APPLICATION NOTE] Atmel-42441A-Low-Power-Sensor-Design-with-PTC_ApplicationNote_AT12405_042015
15
15
8 References
[1] Atmel QTouch Library Peripheral Touch Controller User Guide
http://www.atmel.com/Images/Atmel-42195-QTouch-General-Library-Peripheral-Touch-
Controller_User-Guide.pdf
[2] AT04188: SAM D20/D21/D10 – How to Achieve Power Numbers
http://www.atmel.com/Images/Atmel-42248-SAM-D20-Power-
Measurements_ApplicationNote_AT04188.pdf
[3] AT06549: Ultra Low Power Techniques
http://www.atmel.com/images/atmel-42411-ultra-low-power-techniques-at06549_application-note.pdf
AT12405: Low Power Sensor Design with PTC [APPLICATION NOTE] Atmel-42441A-Low-Power-Sensor-Design-with-PTC_ApplicationNote_AT12405_042015 1
6
16
9 Revision History
Doc Rev. Date Comments
42441A 04/2015 Initial document release.
AT12405: Low Power Sensor Design with PTC [APPLICATION NOTE] Atmel-42441A-Low-Power-Sensor-Design-with-PTC_ApplicationNote_AT12405_042015
17
17
Atmel Corporation 1600 Technology Drive, San Jose, CA 95110 USA T: (+1)(408) 441.0311 F: (+1)(408) 436.4200 │ www.atmel.com
© 2015 Atmel Corporation. / Rev.: Atmel-42441A-Low-Power-Sensor-Design-with-PTC_ApplicationNote_AT12405_042015. Atmel®, Atmel logo and combinations thereof, Enabling Unlimited Possibilities®, QTouch®, and others are registered trademarks or trademarks of Atmel Corporation in U.S. and other countries. ARM®, ARM Connected® logo, and others are the registered trademarks or trademarks of ARM Ltd. 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, b y 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 LI MITATION, 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 t o 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 lif e.
SAFETY-CRITICAL, MILITARY, AND AUTOMOTIVE APPLICATIONS DISCLAIMER: Atmel products are not designed for and will not be used in conne ction 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 o f nuclear facilities and weapons systems. Atmel
products are not designed nor intended for use in military or aerospace applications or environments unless specifically desi gnated 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.