25
APPLICATION NOTE Atmel AT03030: QMatrix Touchpad – 2D Position Tracking Atmel QTouch Features Two-dimensional position tracking using touch sensors Single tap detection Supports single finger operation Sensor design guidelines X-Y position reported in serial terminal 400dpi resolution Status LEDs Introduction This reference design demonstrates techniques to use QMatrix touch sensors for 2D position tracking application. ATxmega16D4 device is used in this touchpad design. X-Y position determined is displayed in PC HyperTerminal through USART interface. This design is suitable only for single-touch operation. The firmware solution provided consists of QMatrix library, Touchpad library, USART driver and status LED control code. Firmware is written in C and supports GCC (Atmel ® Studio) tool-chain. This reference design can be used for low cost and low resolution touchpad applications, up to a maximum resolution of 400dpi. Applications that require higher resolution (more than 400dpi) and additional features like multi-touch can use the Atmel maXTouch ® solution. For this reference design, the hardware design files (schematic, BOM and PCB Gerber) and software source code can be downloaded from Atmel website. The provided hardware documentation can be used with no limitations to manufacture the reference hardware solution for the design. 42202AQTOUCH11/2013

Atmel AT03030: QMatrix Touchpad – 2D Position …ww1.microchip.com/downloads/en/AppNotes/Atmel-42202...Atmel AT03030: QMatrix Touchpad – 2D Position Tracking [APPLICATION NOTE]

  • Upload
    others

  • View
    13

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Atmel AT03030: QMatrix Touchpad – 2D Position …ww1.microchip.com/downloads/en/AppNotes/Atmel-42202...Atmel AT03030: QMatrix Touchpad – 2D Position Tracking [APPLICATION NOTE]

APPLICATION NOTE

Atmel AT03030: QMatrix Touchpad – 2D Position Tracking

Atmel QTouch

Features

• Two-dimensional position tracking using touch sensors

• Single tap detection

• Supports single finger operation

• Sensor design guidelines

• X-Y position reported in serial terminal

• 400dpi resolution

• Status LEDs

Introduction

This reference design demonstrates techniques to use QMatrix touch sensors for 2D position tracking application. ATxmega16D4 device is used in this touchpad design. X-Y position determined is displayed in PC HyperTerminal through USART interface. This design is suitable only for single-touch operation.

The firmware solution provided consists of QMatrix library, Touchpad library, USART driver and status LED control code. Firmware is written in C and supports GCC (Atmel® Studio) tool-chain.

This reference design can be used for low cost and low resolution touchpad applications, up to a maximum resolution of 400dpi. Applications that require higher resolution (more than 400dpi) and additional features like multi-touch can use the Atmel maXTouch® solution.

For this reference design, the hardware design files (schematic, BOM and PCB Gerber) and software source code can be downloaded from Atmel website. The provided hardware documentation can be used with no limitations to manufacture the reference hardware solution for the design.

42202A−QTOUCH−11/2013

Page 2: Atmel AT03030: QMatrix Touchpad – 2D Position …ww1.microchip.com/downloads/en/AppNotes/Atmel-42202...Atmel AT03030: QMatrix Touchpad – 2D Position Tracking [APPLICATION NOTE]

Atmel AT03030: QMatrix Touchpad – 2D Position Tracking [APPLICATION NOTE] 42202A−QTOUCH−11/2013

2

Table of Contents

1. Abbreviations and Definitions .............................................................. 3

2. Hardware Design ................................................................................. 4 2.1 System Block Diagram ...................................................................................... 4 2.2 Sensor Design................................................................................................... 6

2.2.1 Design Guidelines ............................................................................... 7 2.2.1.1 Sensor Arrangement ......................................................... 9

2.3 LED Indication ................................................................................................... 9 2.4 Communication Interface .................................................................................. 9 2.5 Power Supply Considerations ......................................................................... 11

2.5.1 USB Supply ...................................................................................... 11 2.5.2 External Supply ................................................................................. 11 2.5.3 On-board Regulator .......................................................................... 11

2.6 Programming and Debugging ......................................................................... 11 2.6.1 PDI Interface ..................................................................................... 11 2.6.2 Touch Data ....................................................................................... 11

3. Firmware ............................................................................................ 12 3.1 Touchpad Library ............................................................................................ 12

3.1.1 touchpad.h – header file ................................................................... 12 3.1.2 Public functions ................................................................................. 12

3.1.2.1 qt_init_touchpad .............................................................. 12 Resolution ………….. ................................................................................................. 13 Position Hysteresis .................................................................................................... 13

3.1.2.2 qt_get_xy ........................................................................ 13 3.2 QMatrix Library ................................................................................................ 13 3.3 USART Module ............................................................................................... 14 3.4 LED Interface .................................................................................................. 14 3.5 Application Code ............................................................................................. 14

3.5.1 Single Tap Detection......................................................................... 16

4. Schematic Design .............................................................................. 17

5. PCB Layout ........................................................................................ 19

6. Bill of Materials (BOM) ....................................................................... 21

7. References ......................................................................................... 22

Appendix A. Sensor Pattern for Flooded-X (Two-Layer) Design ....... 23

Appendix B. Revision History ............................................................ 24

Page 3: Atmel AT03030: QMatrix Touchpad – 2D Position …ww1.microchip.com/downloads/en/AppNotes/Atmel-42202...Atmel AT03030: QMatrix Touchpad – 2D Position Tracking [APPLICATION NOTE]

Atmel AT03030: QMatrix Touchpad – 2D Position Tracking [APPLICATION NOTE] 42202A−QTOUCH−11/2013

3

1. Abbreviations and Definitions Following is a list of terms which will be used throughout this document.

• Acquisition: A single capacitive measurement process.

• QMatrix (Mutual Capacitance): A type of capacitive touch sensing technology that measures the mutual capacitance between two electrodes. Each channel has a drive electrode (X Electrode) and a receive electrode (Y Electrode).

• X Line: The Sense Line connected to the X Electrode used in QMatrix Technology.

• Y Line: The Sense Line connected to the Y Electrode used in QMatrix Technology.

• SMP: Sampling pin used in QMatrix Sensor Design.

• AIN0: Analog ground Reference pin used in QMatrix Design.

• Sensor: A channel or group of channels used to form a touch sensor. The three types of sensors are Buttons, Sliders and Wheels.

• Button (zero-dimensional sensor): It is a zero dimensional sensor used to implement On/Off digital sensors, and is composed of a single channel. It is also known as a Key.

• Coplanar (Single Layer) design: Both X and Y electrodes fabricated on the same layer of the PCB in QMatrix sensor design.

• Flooded-X (Two-Layer) design: Both X and Y electrodes are distributed in two layers of the PCB in QMatrix sensor design.

• Atmel QTouch® Library: The set of libraries for the touch sensing technologies offered by Atmel (QTouch, QTouchADC and QMatrix).

• Channel: A channel is a logical group of pins used to perform the touch acquisition measurement. It can be composed of a single pin (QTouchADC), a pair of pins (QTouch) or a matrix of pins (QMatrix).

• Sense Electrode: Electrodes are typically areas of copper on a printed circuit board. An electrode or a pair of electrodes used to detect a finger touch.

• Delta: Difference between Reference and Signal value of sensors.

• Detection threshold: It defines how much the touch sensor’s signal value must drop below its reference level to qualify as a potential touch detect.

• 2D: Indicates Two – Dimensional.

For more details refer to BSW Touch Sensor Design Guide and Atmel QTouch Library User Guide.

Page 4: Atmel AT03030: QMatrix Touchpad – 2D Position …ww1.microchip.com/downloads/en/AppNotes/Atmel-42202...Atmel AT03030: QMatrix Touchpad – 2D Position Tracking [APPLICATION NOTE]

Atmel AT03030: QMatrix Touchpad – 2D Position Tracking [APPLICATION NOTE] 42202A−QTOUCH−11/2013

4

2. Hardware Design

2.1 System Block Diagram The generic block diagram of this reference design is provided in Figure 2-1.

Figure 2-1. System Block Diagram

Page 5: Atmel AT03030: QMatrix Touchpad – 2D Position …ww1.microchip.com/downloads/en/AppNotes/Atmel-42202...Atmel AT03030: QMatrix Touchpad – 2D Position Tracking [APPLICATION NOTE]

Atmel AT03030: QMatrix Touchpad – 2D Position Tracking [APPLICATION NOTE] 42202A−QTOUCH−11/2013

5

Touchpad design comprises of 56 touch sensors organized using 8 X lines and 7 Y lines. Table 2-1 provides pin configuration used in touchpad sensor design. QMatrix touch sensors require X + 2Y + 2 general-purpose I/O pins for realization, as shown in Figure 2-2.

Figure 2-2. Typical QMatrix Circuit

Table 2-1. Pin Configuration for Touchpad

ATxmega16D4 GPIO Pin Pin Description Comments

PD4 X0 Configurable I/O Pin

PD5 X1 Configurable I/O Pin

PD6 X2 Configurable I/O Pin

PD7 X3 Configurable I/O Pin

PE0 X4 Configurable I/O Pin

PE1 X5 Configurable I/O Pin

PE2 X6 Configurable I/O Pin

PE3 X7 Configurable I/O Pin

PC0 Y0A Configurable I/O Pin

PC1 Y1A Configurable I/O Pin

PC2 Y2A Configurable I/O Pin

PC3 Y3A Configurable I/O Pin

PC4 Y4A Configurable I/O Pin

PC5 Y5A Configurable I/O Pin

PC6 Y6A Configurable I/O Pin

PA0 Y0B ADC Port Pin

Page 6: Atmel AT03030: QMatrix Touchpad – 2D Position …ww1.microchip.com/downloads/en/AppNotes/Atmel-42202...Atmel AT03030: QMatrix Touchpad – 2D Position Tracking [APPLICATION NOTE]

Atmel AT03030: QMatrix Touchpad – 2D Position Tracking [APPLICATION NOTE] 42202A−QTOUCH−11/2013

6

PA1 Y1B ADC Port Pin

PA2 Y2B ADC Port Pin

PA3 Y3B ADC Port Pin

PA4 Y4B ADC Port Pin

PA5 Y5B ADC Port Pin

PA6 Y6B ADC Port Pin

PC7 SMP Sampling Pin

PA7 AIN0 Analog Ground Reference Pin

2.2 Sensor Design Sensor design is very important for designing touchpad using zero-dimensional touch sensors (buttons), which is used to determine 2D position. Accuracy and resolution of touch position is greatly dependent on Touch Sensor design.

The touchpad design consists of set of sensors arranged in rows and columns to form a matrix. The reference design uses a sensor pattern of eight rows (X lines) and seven columns (Y lines) similar to 56 touch keys. Mutual capacitance (QMatrix) method is used in this design. Sensor Design uses Coplanar (Single Layer) method and 1mm thick front panel is used.

Coplanar design provides flexibility for controlling the sensitivity, by adjusting XY gap in sensor electrode. This allows usage of thicker front panel. This method can be easily implemented on a flex PCB.

Refer Figure 2-3 for sensor pattern used in this reference design.

Figure 2-3. Coplanar (Single Layer) Sensor Design

Page 7: Atmel AT03030: QMatrix Touchpad – 2D Position …ww1.microchip.com/downloads/en/AppNotes/Atmel-42202...Atmel AT03030: QMatrix Touchpad – 2D Position Tracking [APPLICATION NOTE]

Atmel AT03030: QMatrix Touchpad – 2D Position Tracking [APPLICATION NOTE] 42202A−QTOUCH−11/2013

7

2.2.1 Design Guidelines Sensor Design guidelines specific to touchpad design is listed below:

• Fundamental guideline is to place the sensors in close proximity as shown in Figure 2-4. To locate sensors closely follow the below recommendation. • Sensors that share same X line, the X regions can be merged.

As shown in Figure 2-4, each row has seven sensors sharing same X line but uses different Y line and so there is no gap between the sensors horizontally.

• Sensors using different X lines need to have minimal separation, which should be maintained between 0.1mm to 0.5mm gap.

As shown in Figure 2-4, each column has eight sensors sharing same Y line but uses different X line. So minimal gap is maintained between the sensors vertically.

• Touchpad sensor pattern is formed using sensors arranged in rows and columns organized as a matrix. Touchpad library implementation puts restrictions on the number of rows / columns in the design. • Minimum number of rows / columns that can be used is limited to two. • Maximum number of rows / columns that can be used is limited to eight.

• Segment size of the sensor for a given X and Y line should be in the range 5mm to 8mm. • Segment size of sensor used beyond 8mm will not have proper linearity and have low resolution.

• Touchpad designs that use small segment size say 5mm x 5mm, Flooded-X (Two-Layer) design is preferred. Since it is difficult to realize Coplanar (Single layer) touchpad designs for small segment size. Refer Figure 2-5 for spacing recommendations for Flooded-X (Two-Layer) design.

• Shape of the touchpad sensor pattern should be rectangular or square. Other fancy shapes are not recommended, as they may not provide expected results.

• No additional touch sensor should be designed using same Atmel MCU used to design touchpad. • This is restricted by touchpad library implementation.

• Resolution is mainly dependent on sensor size and number of sensors used to form sensor pattern. • Better resolution can obtained using many sensors of small segment size. • Designs using few sensors which are bigger in size, the resolution achieved will be low.

For general Sensor Design Guidelines refer to “BSW Touch Sensor Design Guide”.

Page 8: Atmel AT03030: QMatrix Touchpad – 2D Position …ww1.microchip.com/downloads/en/AppNotes/Atmel-42202...Atmel AT03030: QMatrix Touchpad – 2D Position Tracking [APPLICATION NOTE]

Atmel AT03030: QMatrix Touchpad – 2D Position Tracking [APPLICATION NOTE] 42202A−QTOUCH−11/2013

8

Figure 2-4. Recommended Spacing for Coplanar (Single Layer) Design

‘T’ refers to Front panel thickness used in design.

Figure 2-5. Recommended Spacing for Flooded-X (Two Layer) Design

Page 9: Atmel AT03030: QMatrix Touchpad – 2D Position …ww1.microchip.com/downloads/en/AppNotes/Atmel-42202...Atmel AT03030: QMatrix Touchpad – 2D Position Tracking [APPLICATION NOTE]

Atmel AT03030: QMatrix Touchpad – 2D Position Tracking [APPLICATION NOTE] 42202A−QTOUCH−11/2013

9

2.2.1.1 Sensor Arrangement Sensors in touchpad should be connected sequential as shown in Figure 2-6.

In this reference design, 56 sensors are arranged in the below order for 8 X lines and 7 Y lines.

Figure 2-6. Sensor Arrangement

X0 X1 X2 X3 X4 X5 X6 X7

Y0 S0 S1 S2 S3 S4 S5 S6 S7

Y1 S8 S9 S10 S11 S12 S13 S14 S15

Y2 S16 S17 S18 S19 S20 S21 S22 S23

Y3 S24 S25 S26 S27 S28 S29 S30 S31

Y4 S32 S33 S34 S35 S36 S37 S38 S39

Y5 S40 S41 S42 S43 S44 S45 S46 S47

Y6 S48 S49 S50 S51 S52 S53 S54 S55

2.3 LED Indication Two LEDs are used to indicate the single tap and touchpad state. These LEDs are driven by BC847B transistor. The state of the transistor is controlled by connected ATxmega16D4 GPIO pin.

LED1 is configured for single tap indication. This is set to operate in toggle mode. The LED1 turns ON when single tap event is detected first time and turns OFF in the subsequent single tap detection.

LED2 is configured to indicate touchpad active status. This LED will be in ON as long as there is a touch.

Table 2-2 details pin configuration used for LEDs.

Table 2-2. Pin Configuration for LEDs

GPIO Pin Pin Description

PD0 LED1

PD1 LED2

2.4 Communication Interface Serial communication using USART interface is used to display the touchpad X-Y position on HyperTerminal of host PC. Figure 2-7 shows the communication header available on the PCB. Table 2-3 details pin configuration of USARTD0 used in touchpad.

Table 2-3. Pin Configuration for USART

GPIO Pin Pin Description

PD3 USART_TX

PD2 USART_RX

Page 10: Atmel AT03030: QMatrix Touchpad – 2D Position …ww1.microchip.com/downloads/en/AppNotes/Atmel-42202...Atmel AT03030: QMatrix Touchpad – 2D Position Tracking [APPLICATION NOTE]

Atmel AT03030: QMatrix Touchpad – 2D Position Tracking [APPLICATION NOTE] 42202A−QTOUCH−11/2013

10

Figure 2-7. Communication Header

Figure 2-8. Communication Signals – USART

Figure 2-9 shows PC HyperTerminal screenshot, with X-Y Position display and Single tap indication.

Figure 2-9. X-Y Position Display

Page 11: Atmel AT03030: QMatrix Touchpad – 2D Position …ww1.microchip.com/downloads/en/AppNotes/Atmel-42202...Atmel AT03030: QMatrix Touchpad – 2D Position Tracking [APPLICATION NOTE]

Atmel AT03030: QMatrix Touchpad – 2D Position Tracking [APPLICATION NOTE] 42202A−QTOUCH−11/2013

11

2.5 Power Supply Considerations The reference design can be powered by using any of the following power supply sources.

2.5.1 USB Supply The reference board can be powered with the Mini-B USB header available on the board. This supply acts as a source of power to the on-board voltage regulator and power indication LED.

2.5.2 External Supply The reference board can be powered using +5V external supply. Power can be provided using J7 header available on board. This also acts as source of power to the on-board voltage regulator and power indication LED.

2.5.3 On-board Regulator A linear drop-out regulator, which is mounted on the board acts as a regulated power supply source for the Atmel ATxmega16D4 device. This on-board regulator can be bypassed using zero Ohm resistor provision available. In such case, external supply provided should be +3.3V.

Using external supply, which is not regulated by the on-board regulator, should adhere to the power supply considerations mentioned in the application note Atmel AT02259: QTouch® Schematic and Layout Checklist.

2.6 Programming and Debugging

2.6.1 PDI Interface The ATxmega16D4 device can be programmed using PDI interface. The on-board PDI header can be used for programming the device. This can also be used for On-Chip Debugging (OCD). Figure 2-10 shows the programming header available on the PCB.

Figure 2-10. Programming Header

2.6.2 Touch Data Touch data is transmitted using QDebug protocol through Bit Bang SPI interface. QT600 USB Interface Bridge is used to transmit touch data to QTouch Analyzer. The real time touch data can be used for debugging and analysis. Table 2-4 shows pins configured for QDebug in Touch Data Header available.

Table 2-4. Pin Configuration for Touch Data Debug

ATxmega16D4 GPIO Pin Pin Description

PB0 DBG_MISO

PB1 DBG_SS

PB2 DBG_MOSI

PB3 DBG_SCK

Page 12: Atmel AT03030: QMatrix Touchpad – 2D Position …ww1.microchip.com/downloads/en/AppNotes/Atmel-42202...Atmel AT03030: QMatrix Touchpad – 2D Position Tracking [APPLICATION NOTE]

Atmel AT03030: QMatrix Touchpad – 2D Position Tracking [APPLICATION NOTE] 42202A−QTOUCH−11/2013

12

3. Firmware

Figure 3-1. Firmware Block Diagram

3.1 Touchpad Library Touchpad library (libtouchpad.a) is a software library which calculates X-Y position of the touchpad sensor for the given resolution. This library is built for the Atmel ATxmega16D4 device and linked into application code to calculate the X-Y position.

This library is available as part of firmware that can be downloaded along with this document.

The below sections provides details of touchpad library APIs and its usage.

3.1.1 touchpad.h – Header File The touchpad.h header file which needs to be included in user’s application and it has the type definitions and function prototypes of the API’s needs to be used for touchpad X-Y calculation.

3.1.2 Public Functions This section provides details of touchpad library public functions and its usage.

3.1.2.1 qt_init_touchpad

Table 3-1. qt_init_touchpad

Function Description

uint8_t qt_init_touchpad(uint8_t num_x, uint8_t num_y, xy_resolution_t resolution, uint8_t position_hysteresis)

Initializes touchpad library with the input parameters provided

Input num_x: Number of X lines of the touchpad sensor num_y: Number of Y lines of the touchpad sensor resolution: Number of positions to be reported per sensor area position_hysteresis: Hysteresis of reported X-Y position value

Output None

Return Returns TRUE if successful or FALSE otherwise

Page 13: Atmel AT03030: QMatrix Touchpad – 2D Position …ww1.microchip.com/downloads/en/AppNotes/Atmel-42202...Atmel AT03030: QMatrix Touchpad – 2D Position Tracking [APPLICATION NOTE]

Atmel AT03030: QMatrix Touchpad – 2D Position Tracking [APPLICATION NOTE] 42202A−QTOUCH−11/2013

13

Resolution Resolution is the number of positions to be reported for each sensor area. It can have values from four to seven bits (16 to 128 positions).

The total resolution for X-axis = no. of X lines * no. of positions for one sensor.

The total resolution for Y-axis = no. of Y lines * no. of positions for one sensor.

Touchpad resolution (dpi) = no. of sensors available in 1 inch area * no. of positions for one sensor.

Where, no. of sensors available in 1 inch area = 1 inch area in mm / 1 sensor area in mm.

In this reference design, one sensor area is 8mm x 8mm and firmware uses seven bit position resolution. Using above calculation, touchpad resolution for this design is 406 dpi.

Table 3-2, shows position and resolution possible with 8X x 7Y sensor configuration with one sensor area 8mm x 8mm for different resolution inputs.

Table 3-2. Touchpad Position Resolution

Resolution [bits] Positions Per Sensor X-axis Positions Y-axis Positions Touchpad Resolution [dpi]

7 128 1024 896 406

6 64 512 448 203

5 32 256 224 102

4 16 128 112 51

Resolution Range: 4 to 7bits.

Position Hysteresis It is the number of positions the user has to move back, before the new X-Y touch position is reported when the direction of scrolling is changed. This is used to avoid jittering in the reported X-Y position.

Hysteresis can range from 0 (1 position) to 7 (8 positions). Hysteresis setting can be used when the reported position jitters due to noise effects.

Position Hysteresis Range: 0 to 7.

3.1.2.2 qt_get_xy

Table 3-3. qt_init_touchpad

Function Description touch_position_t qt_get_xy(void)

Calculates X-Y position and returns it

Input None

Output None

Return Updates the X and Y values computed in structure ‘touch_position_t’

3.2 QMatrix Library QMatrix library is a software library which performs touch acquisition and post-processing. This reference design uses ATxmega16D4 8X x 7Y sensor configuration library which supports up to 56 channels.

Refer QTouch Library User Guide for QMatrix Library API usage.

Page 14: Atmel AT03030: QMatrix Touchpad – 2D Position …ww1.microchip.com/downloads/en/AppNotes/Atmel-42202...Atmel AT03030: QMatrix Touchpad – 2D Position Tracking [APPLICATION NOTE]

Atmel AT03030: QMatrix Touchpad – 2D Position Tracking [APPLICATION NOTE] 42202A−QTOUCH−11/2013

14

3.3 USART Module USART Module consists of USART driver code and functions to convert integer to ASCII to display X-Y Position in HyperTerminal of host PC using RS232 interface. This module is sending data using polling method. ATxmega16D4 USARTD0 peripheral is used and it is configured as below.

Baud rate : 115200

Start bits : 1

Data bits : 8

Parity : Disabled

Stop bits : 1

3.4 LED Interface This module controls LED indication for the single tap and touchpad state.

3.5 Application Code The application code implementation flow is provided in the Figure 3-2.

Page 15: Atmel AT03030: QMatrix Touchpad – 2D Position …ww1.microchip.com/downloads/en/AppNotes/Atmel-42202...Atmel AT03030: QMatrix Touchpad – 2D Position Tracking [APPLICATION NOTE]

Atmel AT03030: QMatrix Touchpad – 2D Position Tracking [APPLICATION NOTE] 42202A−QTOUCH−11/2013

15

Figure 3-2. Application Flow Diagram

Measurement period depends on touch acquisition duration and USART transmission time. In this firmware solution, measurement period is set to 30ms.

Note: Things to be taken care while tuning the Touchpad sensor: QTouch Analyzer can be used for tuning purpose.

Page 16: Atmel AT03030: QMatrix Touchpad – 2D Position …ww1.microchip.com/downloads/en/AppNotes/Atmel-42202...Atmel AT03030: QMatrix Touchpad – 2D Position Tracking [APPLICATION NOTE]

Atmel AT03030: QMatrix Touchpad – 2D Position Tracking [APPLICATION NOTE] 42202A−QTOUCH−11/2013

16

• The delta for each sensor in the touchpad should be peaking at the same amplitude. This gives improved linearity of reported X-Y position and also uniform sensitivity across the touchpad. Burst Length can be adjusted to compensate for imbalance.

• Make sure the delta for each sensor in the touchpad peak at around 25 counts and above. If touch delta is not enough to calculate position, the reported X-Y position can be jittery.

• Set the Detection Threshold for each sensor in the touchpad to report a touch when the finger lightly contacts the touchpad surface.

3.5.1 Single Tap Detection Firmware solution provides demonstration of single tap detection feature. This single tap detection is indicated using LED and also indicated in PC HyperTerminal. The LED toggles for every single tap detection.

Note: Below listed features also can be implemented in user application code.

• Double-tap detection

• Horizontal Scroll detection

• Vertical Scroll detection

Page 17: Atmel AT03030: QMatrix Touchpad – 2D Position …ww1.microchip.com/downloads/en/AppNotes/Atmel-42202...Atmel AT03030: QMatrix Touchpad – 2D Position Tracking [APPLICATION NOTE]

Atmel AT03030: QMatrix Touchpad – 2D Position Tracking [APPLICATION NOTE] 42202A−QTOUCH−11/2013

17

4. Schematic Design

Figure 4-1. Schematic – Part 1

PA7(

AD

CA

7/A

CA

7)3

PB0(

AD

CA

8/A

REF

B)

4

PB1(

AD

CA9)

5

PB2(

AD

CA10

)6

PB3(

AD

CA11

)7

PC4(SS/OC1A) 14

PC5(MOSI/OC1B) 15

PC6(MISO) 16

PC7(SCK) 17

PD1(OC0B/XCK0) 21PD0(OC0A) 20(O

C0D

/TX

D0)

PD3

23(S

S)PD

424

(MO

SI)P

D5

25(M

ISO

)PD

626

(SCK

)PD

727

GND 18

VCC 19

(ADCA2/ACA2)PA242

(ADCA1/ACA1)PA141

(AREFA/ADCA0/ACA0)PA040

AVCC39

GND38

(XTAL1/TOSC1)PR137

(XTAL2/TOSC2)PR036

PDI_CLK/RESET35

(ADCA3/ACA3)PA343 (ADCA4/ACA4)PA444

PA5(

AD

CA

5/A

CA

5)1

PA6(

AD

CA

6/A

CA

6)2

GN

D8

VC

C9

PC0(

SDA

/OC0

A)

10

PC1(

SCL/

OC

0B)

11

PC2(OC0C/RXD0) 12

PC3(OC0D/TXD0) 13G

ND

30V

CC31

PD2(OC0C/RXD0) 22

(OC0

A/S

DA

)PE0

28(O

C0B

/SC

L)PE

129

(OC

0C)P

E232

(OC

0D)P

E333

PDI_DATA34

ATx

meg

a16D

4-A

U

U1

22n

C1

1kR

9

1kR1

GN

D

X0

1kR2

X1

1kR3

X2

1kR4

X3

1kR5

X4

1kR6

X5

1kR7

X6

1kR8

X7

22n

C2

1kR

10

22n

C3

1kR

11

22n

C4

1kR

12

22n

C5

1kR

13

22n

C6

1kR

14

22n

C7

1kR

15

470k

R16

470kR1

7

470k

R18

470k

R19

470k

R20

470kR2

1

470k

R22

Y0

Y1

Y2

Y3

Y4

Y5

Y6

YA

0

YB0

YA

1

YB1

YA

2

YB2

YA

3

YB3

YA

4

YB4

YA

5

YB5

YB6

YA

6

YB0YB1YB2YB3YB4

YB

5Y

B6

YA6

X0A

X1A

X2A

X3A

X4A

X5A

X6A

X7A

DA

TA

CLO

CK

AIN

0

GN

D

GN

DV

CC

VCC

VCC

GN

D

12

34

56

PIN

HEA

DER

2x3

PDI

VC

C GN

D

X0

1

X1

2

X2

3

X3

4

X4

5

X5

6

X6

7

X7

8

Y0 9

Y1 10

Y2 11

Y3 12

Y4 13

Y5 14

Y6 15

Touc

hpad

SMP

100n

fC

810

0nf

C9

100n

fC

11

100n

fC

10

VC

CV

CC

VC

C

VC

C

GN

DG

ND

GN

D

GN

DV

CC

GN

D

DB

G_M

ISO

DB

G_S

SD

BG

_MO

SID

BG_S

CK

X7A

X6A

X4A

X5A

X0A

X1A

X2A

X3A

YA

0Y

A1

YA2YA3YA4YA5

VC

C GN

D1

23

45

6 87

109

TOU

CH

DA

TA

220R

R23

LED

2

VC

C1KR2

4

LED

1

UA

RT_

TX

UA

RT_

RX

BC

847B

Q3

NPN

BEC

GN

D

BC84

7B

Q4

NPN

BEC

1KR26

GN

D

220R

R25

1nf

C13

1nf

C14

Page 18: Atmel AT03030: QMatrix Touchpad – 2D Position …ww1.microchip.com/downloads/en/AppNotes/Atmel-42202...Atmel AT03030: QMatrix Touchpad – 2D Position Tracking [APPLICATION NOTE]

Atmel AT03030: QMatrix Touchpad – 2D Position Tracking [APPLICATION NOTE] 42202A−QTOUCH−11/2013

18

Figure 4-2. Schematic – Part 2

TTL/CMOS

RS-232

C1+

1

C1-

3

C2+

4

C2-

5V

+2

V-

6

T1IN

8

T2IN

9

R1O

UT

11

R2O

UT

10R

2IN

14

R1I

N15

T2O

UT

16

T1O

UT

17

GND 18

VCC20

VL13

FOR

CEO

FF19

FOR

CEO

N12

INV

ALI

D7

MA

X33

80EC

UP+

U3

MA

X33

80

100n

F

C25

100n

F

C27

100n

F

C26

100n

F

C28

GN

D100n

FC

24

VC

C

GN

D

UA

RT_

RX

UA

RT_

TXR

S232

_TX

RS2

32_R

X

12345 678911 10

09-6

6-15

2-76

11

J3

RS2

32_R

X

RS2

32_T

X

GN

D

GN

D

VO

LTA

GE

REG

ULA

TOR

Use

J3 fo

r pow

er c

onsu

mpt

ion

4u7

C30

4u7

C29

0RR

45R

egul

ator

Byp

ass

VIN

3V

OU

T2

GN

D1

VO

UT_

PAD

4

LMS8

117A

MP-

3.3

U4

Farn

ell n

o: 1

4690

32

VC

C-5

V

TP1

VC

C

+

47uF

/35V

C23

CA

P-PO

L

VC

C-5

V

+

47uF

/35V

C31

CA

P-PO

L

100n

f

C32

+47

uF/3

5VC

33

CA

P-PO

L

UA

RT_

TX

UA

RT_

RX

GN

D

1KR46

21

QTL

P650

D5T

RD

1

LED

_12

VC

C

12

34

J7G

ND

0RR48

VB

US

1

D-

2

D+

3

GN

D5

SHIE

LD1

6

SHIE

LD2

7

ID4

SHIE

LD3

8

SHIE

LD4

9

J1

USB

Min

i B

VC

C-5

V

GN

D

Page 19: Atmel AT03030: QMatrix Touchpad – 2D Position …ww1.microchip.com/downloads/en/AppNotes/Atmel-42202...Atmel AT03030: QMatrix Touchpad – 2D Position Tracking [APPLICATION NOTE]

Atmel AT03030: QMatrix Touchpad – 2D Position Tracking [APPLICATION NOTE] 42202A−QTOUCH−11/2013

19

5. PCB Layout

Figure 5-1. Top Layer

21

11

12345

6789

10

12

21

4

321

21

12

12

121 2

12

1 2 12

12

34

56

78

910

11

1213141516171819202122

2324

2526

2728

2930

3132

33

34 35 36 37 38 39 40 41 42 43 44

2 1

21

21

21

21

21

21

21

2112

12

12

12

12

12

12

12

12

12

12

12

12

12

12

121

2121

2

12

12

12

2 1

2 1

21

21

109

64

213

57 8

64

213

5

12 12

312

4

21

21

2 1

2 1

8 7

9 6

10 10

2 1

2 1

12

3

12

3

1 2 1 2

1

Page 20: Atmel AT03030: QMatrix Touchpad – 2D Position …ww1.microchip.com/downloads/en/AppNotes/Atmel-42202...Atmel AT03030: QMatrix Touchpad – 2D Position Tracking [APPLICATION NOTE]

Atmel AT03030: QMatrix Touchpad – 2D Position Tracking [APPLICATION NOTE] 42202A−QTOUCH−11/2013

20

Figure 5-2. Bottom Layer

21

2 1

21

21

109

64

213

57 8

64

213

5

312

4

10 10

2 1

2 1

12

3

1 2 1 2

Page 21: Atmel AT03030: QMatrix Touchpad – 2D Position …ww1.microchip.com/downloads/en/AppNotes/Atmel-42202...Atmel AT03030: QMatrix Touchpad – 2D Position Tracking [APPLICATION NOTE]

Atmel AT03030: QMatrix Touchpad – 2D Position Tracking [APPLICATION NOTE] 42202A−QTOUCH−11/2013

21

6. Bill of Materials (BOM)

Table 6-1. BOM

Description Designator Qty. Value

Ceramic capacitor, SMD 0603, X7R, 50V, ±10% C1, C2, C3, C4, C5, C6, C7 7 22nF

Ceramic capacitor, SMD 0603, X7R, 50V, ±10% C8, C9, C10, C11, C24, C25, C26, C27, C28, C32 10 100nF

Ceramic capacitor, SMD 0603, NPO, 100V, ±1% C13, C14 1 1nF

SMD tantalum capacitor, 35V C23, C31, C33 3 47µF

Ceramic capacitor, SMD 0603, X7R, 16V, ±10% C29, C30 1 4µ7

Yellow SMD LED D1 1 Power indication

Yellow SMD LED LED1, LED2 2 Single tap and touchpad state indication

BJT Transistor, NPN Q3, Q4 2 BC847B

Thick film resistor, SMD 0603, 1/10W, 1% R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12, R13, R14, R15, R24, R26, R46 18 1kΩ

Thick film resistor, SMD 0603, 1/10W, 1% R16, R17, R18, R19, R20, R21, R22 7 470kΩ

Thick film resistor, SMD 0603, 1/10W, 1% R23, R25 2 220R

Thick film resistor, SMD 0603, 1/10W, 1% R45 1 0Ω

Thick film resistor, SMD 1206, 1/10W, 1% R48 1 0Ω

AVR® 8-bit RISC MCU U1 1 ATxmega16D4-AU

RS232 Level Converter, 2.35V to 5.5V U3 1 MAX3380ECUP

3.3V 1A Low Dropout Linear Regulator SOT223_4

U4 1 LMS8117AMP-3.3

USB Mini-AB Connector, SMD J1 1 MUSB-05-F-AB-SM-A

Page 22: Atmel AT03030: QMatrix Touchpad – 2D Position …ww1.microchip.com/downloads/en/AppNotes/Atmel-42202...Atmel AT03030: QMatrix Touchpad – 2D Position Tracking [APPLICATION NOTE]

Atmel AT03030: QMatrix Touchpad – 2D Position Tracking [APPLICATION NOTE] 42202A−QTOUCH−11/2013

22

7. References [1]. Atmel QTouch Library User Guide

http://www.atmel.com/Images/doc8207.pdf

[2]. BSW Touch Sensor Design Guide http://www.atmel.com/Images/doc10752.pdf

[3]. Atmel AT02259: QTouch Schematic and Layout Checklist http://www.atmel.com/Images/Atmel-42094-QTouch-Schematic-and-Layout-Checklist_Application-Note_AT02259.pdf

[4]. AVR XMEGA® D4 Devices Datasheet http://www.atmel.com/Images/Atmel-8135-8-and-16-bit-AVR-microcontroller-ATxmega16D4-32D4-64D4-128D4_datasheet.pdf

[5]. Atmel AVR XMEGA D Manual http://www.atmel.com/Images/Atmel-8210-8-and-16-bit-AVR-Microcontrollers-XMEGA-D_Manual.pdf

Page 23: Atmel AT03030: QMatrix Touchpad – 2D Position …ww1.microchip.com/downloads/en/AppNotes/Atmel-42202...Atmel AT03030: QMatrix Touchpad – 2D Position Tracking [APPLICATION NOTE]

Atmel AT03030: QMatrix Touchpad – 2D Position Tracking [APPLICATION NOTE] 42202A−QTOUCH−11/2013

23

Appendix A. Sensor Pattern for Flooded-X (Two-Layer) Design Refer to Figure A-1 for Flooded-X sensor pattern that could be used in touchpad design.

Figure A-1. 8X x 7Y QMatrix Flooded-X (Two-Layer) Design

Page 24: Atmel AT03030: QMatrix Touchpad – 2D Position …ww1.microchip.com/downloads/en/AppNotes/Atmel-42202...Atmel AT03030: QMatrix Touchpad – 2D Position Tracking [APPLICATION NOTE]

Atmel AT03030: QMatrix Touchpad – 2D Position Tracking [APPLICATION NOTE] 42202A−QTOUCH−11/2013

24

Appendix B. Revision History Doc. Rev. Date Comments

42202A 11/2013 Initial document release

Page 25: Atmel AT03030: QMatrix Touchpad – 2D Position …ww1.microchip.com/downloads/en/AppNotes/Atmel-42202...Atmel AT03030: QMatrix Touchpad – 2D Position Tracking [APPLICATION NOTE]

Atmel Corporation 1600 Technology Drive San Jose, CA 95110 USA Tel: (+1)(408) 441-0311 Fax: (+1)(408) 487-2600 www.atmel.com

Atmel Asia Limited Unit 01-5 & 16, 19F BEA Tower, Millennium City 5 418 Kwun Tong Road Kwun Tong, Kowloon HONG KONG Tel: (+852) 2245-6100 Fax: (+852) 2722-1369

Atmel Munich GmbHBusiness Campus Parkring 4 D-85748 Garching b. Munich GERMANY Tel: (+49) 89-31970-0 Fax: (+49) 89-3194621

Atmel Japan G.K.16F Shin-Osaki Kangyo Building 1-6-4 Osaki, Shinagawa-ku Tokyo 141-0032 JAPAN Tel: (+81)(3) 6417-0300 Fax: (+81)(3) 6417-0370

© 2013 Atmel Corporation. All rights reserved. / Rev.: 42202A−QTOUCH−11/2013

Atmel®, Atmel logo and combinations thereof, AVR®, Enabling Unlimited Possibilities®, maXTouch®, QTouch®, XMEGA®, and others are registered trademarks or trademarks of Atmel Corporation or its subsidiaries. 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.