You are on page 1of 49

Introduction to mTouch

Capacitive Touch Sensing

2007 Microchip Technology Incorporated. All Rights Reserved.

Introduction to mTouch Capacitive Touch Sensing

Slide 1

Hello, my name is Marc McComb, Technical Training Engineer in the Security Microcontroller and Technology Division here at Microchip. Thank you for viewing this webseminar detailing Microchips mTouch Capacitive Touch Sensing Technology.

Agenda
What is mTouch Capacitive Touch Sensing Main components:
Touch Sensor Relaxation Oscillator Circuit Frequency Measurement Software

2007 Microchip Technology Incorporated. All Rights Reserved.

introduction to mTouch Capacitive Touch Sensing

Slide 2

During this webseminar we will discuss a number of topics including what exactly is mTouch Capacitive Touch Sensing. We will go on to describe sensor construction as well as a detailed discussion on the various components of the sensors interface circuitry to a PIC Microcontroller. So lets get started

What is mTouch Capacitive Touch Sensing?


Alternative to traditional push-button user interfaces No mechanical movement Completely sealed Modern-looking design

Royalty-Free license!
Microchip provides a multitude of resources to ease the design process
2007 Microchip Technology Incorporated. All Rights Reserved. introduction to mTouch Capacitive Touch Sensing Slide 3

What exactly is mTouch? Well, mTouch is an alternative to traditional mechanical pushbuttons with some distinct advantages. The system is completely sealed, has no mechanical components that will wear with time and provides a modern looking design. Most importantly, Microchip offers a royalty-free license along with a multitude of resources to aid in the development of your own mTouch applications.

Overview of mTouch Capacitive Touch Sensing


PICmicro MCU
+
_

S Q R Q

+
_

TIMER0

Software

Capacitive Touch Sensor

TIMER1

2007 Microchip Technology Incorporated. All Rights Reserved.

introduction to mTouch Capacitive Touch Sensing

Slide 4

So how exactly do we implement mTouch Capacitive Touch Sensing? If we look at a simplified block diagram of an mTouch system, we can identify some main components.

Relaxation Oscillator Circuit


PICmicro MCU
+
_

S Q R Q

+
_

TIMER0

Software

Capacitive Touch Sensor

TIMER1

2007 Microchip Technology Incorporated. All Rights Reserved.

introduction to mTouch Capacitive Touch Sensing

Slide 5

First, we have the touch sensor itself. As the Capacitive Touch Sensing name implies, this sensor will produce a varying capacitance that will interact with a relaxation oscillator circuit. When the capacitance from the sensor changes, for example when touched by a finger, the oscillators frequency will change.

Frequency Measurement
PICmicro MCU
+
_

S Q R Q

+
_

TIMER0

Software

Capacitive Touch Sensor

TIMER1

2007 Microchip Technology Incorporated. All Rights Reserved.

introduction to mTouch Capacitive Touch Sensing

Slide 6

In order to interpret this change in oscillator frequency, a frequency measurement component is required in our system. This component will interface hardware and software to accurately determine if and when a sensor has been touched.

Touch Sensors

2007 Microchip Technology Incorporated. All Rights Reserved.

Introduction to mTouch Capacitive Touch Sensing

Slide 7

So lets take a closer look at each component of our mTouch system. FirstTouch Sensor construction.

Capacitance

0r A C= d
0 r
A C d
Area of Plates (meters) Capacitance (Farads)

A
d

Permittivity of Free Space (8.854 Pico-Farad/meter) Relative Dielectric Constant (unit-less)

Distance between plates (meters)


introduction to mTouch Capacitive Touch Sensing Slide 8

2007 Microchip Technology Incorporated. All Rights Reserved.

Recalling the equation for capacitance, we can see that there are a number of variables that could change the capacitance produced by our touch sensors. As we will see, the most important variables that we will be concerned with is Area and distance. From this equation we can see that the greater the Area, the greater the capacitance. As the distance becomes larger, the capacitance drops. Keep this in mind as we proceed through this presentation. Sohow do we build a sensor?

Touch Sensor Construction


Fiberglass (FR- 4) Printed Circuit Board (PCB)
laminate made from woven glass fiber impregnated with epoxy resin

2007 Microchip Technology Incorporated. All Rights Reserved.

introduction to mTouch Capacitive Touch Sensing

Slide 9

We begin with a simple printed circuit board. Constructed of FR-4, a composite of laminated woven glass fiber and epoxy, the PCB will enable us to produce a natural capacitance for our application.

Touch Sensor Construction


Copper (Cu) pads (thickness exaggerated)

CP
2007 Microchip Technology Incorporated. All Rights Reserved. introduction to mTouch Capacitive Touch Sensing Slide 10

A copper pad is next introduced. The shape of this pad is not very important. Therefore, we have the freedom to shape the sensor aesthetically to suit a particular design. However, the area of the pad is very important. The larger the pad, the better the sensitivity and a sensor touch will be more easily detected by the rest of the system. As you can see in the slide above, a natural parasitic capacitance to grounds elsewhere in the system has been introduced here which I have labeled Pad Capacitance or Cp

10

Touch Sensor Construction


Glass or Plexiglas
2 to 5mm thick

CP
2007 Microchip Technology Incorporated. All Rights Reserved. introduction to mTouch Capacitive Touch Sensing Slide 11

Next, a touch surface is applied in the form of either Window glass or Plexiglas. Other materials could be used as long as the dielectric constant of the material is evaluated for functionality. Typically it is best to design a thin touch surface. Remember back to the capacitance equation, as distance increases, the capacitance will effectively decrease. Therefore, using a surface that is very thin produces a more sensitive system.

11

How does it work?


Introduction of finger produces a parallel capacitance

CF

CP
2007 Microchip Technology Incorporated. All Rights Reserved. introduction to mTouch Capacitive Touch Sensing Slide 12

A finger touch will add a second capacitance in parallel with the pads capacitance. The iron in an individuals blood creates strings of capacitors between every surface of their body. So, when someone creates a capacitance by moving his or her hand into close proximity of another conductor, it creates a capacitance essentially coupled to ground.

12

Equivalent Circuit
CP

Sensor Capacitance (CS) = CP

CP

CF

Sensor Capacitance (CS) = CP + CF

2007 Microchip Technology Incorporated. All Rights Reserved.

introduction to mTouch Capacitive Touch Sensing

Slide 13

Looking at equivalent circuits, we have the capacitance from the pad alone and then a parallel combination of pad capacitance and the finger capacitance which add together to form a total sensor capacitance labeled Cs. We should mention here that the capacitance introduced by the finger is known to be very small in the area of 5-15pF. Therefore, we will want to ensure that the capacitance created by our pad is small as well to ensure that a touch is sensed. Further information on physical design guidelines can be found in application note number AN1102 referenced at the end of this webseminar.

13

Relaxation Oscillator Circuit

2007 Microchip Technology Incorporated. All Rights Reserved.

Introduction to mTouch Capacitive Touch Sensing

Slide 14

So, we now know how to create a sensor that varies capacitance with the touch from a finger. But how do we use this information to detect a sensor touch. This leads us to our next component in the system, the relaxation oscillator.

14

RC Circuit
R + CS
VCS VCS

=R*C

time

2007 Microchip Technology Incorporated. All Rights Reserved.

introduction to mTouch Capacitive Touch Sensing

Slide 15

The RC time constant for a charging capacitor is calculated by multiplying the systems resistance by its capacitance as shown above. Remembering that the RC time constant represented by the Greek letter Tau, is the time it takes to charge a capacitor to about 63% of its supply voltage and five times this time constant is the time to charge the capacitor to within 1% of the supply. The sensor capacitance alone with no finger introduced will create a steeper charging time as shown above.

15

RC Circuit
R + CS
VCS VCS

=R*C

time

2007 Microchip Technology Incorporated. All Rights Reserved.

introduction to mTouch Capacitive Touch Sensing

Slide 16

If a finger is introduced, the capacitance of the system increases thereby increasing the RC time constant resulting in a longer charging period. Lets add a few more components to our RC circuit.

16

Oscillator Circuit
PICmicro MCU
CVREF 2/3 VDD VDD
3K + _ C1

S Q R Q

1/4VDD
0.1F 1K

+ _ C2

VCS

120K CS

2007 Microchip Technology Incorporated. All Rights Reserved.

introduction to mTouch Capacitive Touch Sensing

Slide 17

The RC circuit discussed in the previous slide is interfaced with the dual comparator module with SR Latch found on newer PIC Microcontrollers. The Voltage across the Sensor capacitor labeled Vcs is used as the inverting input to both comparators.

17

Oscillator Circuit
PICmicro MCU
CVREF 2/3 VDD VDD
3K INVERTED + _ C1

S Q R Q

1/4VDD
0.1F 1K

+ _ C2

VCS

120K CS

2007 Microchip Technology Incorporated. All Rights Reserved.

introduction to mTouch Capacitive Touch Sensing

Slide 18

Comparator 1 uses the internal reference voltage available on newer PIC Microcontrollers set to approximately 2/3 of the supply voltage. Comparator 2 will need an external reference. Therefore, we use a simple voltage divider to produce a voltage of the supply voltage on the Comparators non-inverting input. The 0.1F capacitor is added to reject high frequency noise from the power supply and ensure a stable lower limit voltage.

18

Oscillator Circuit
PICmicro MCU
CVREF 2/3 VDD VDD
3K INVERTED + _ C1 C1IN - > C1IN+ (2/3 VDD) C1OUT = 0

S Q R Q

1/4VDD
0.1F 1K

+ _ C2

120K CS C2IN - > C2IN+ (1/4VDD) C2OUT = 1

2007 Microchip Technology Incorporated. All Rights Reserved.

introduction to mTouch Capacitive Touch Sensing

Slide 19

We are using the comparator to create a window of operation. If the voltage across Cs drops below Vdd, the output of comparator 2 will go HIGH. Looking closely at comparator 1 notice that the outputs polarity is inverted. Therefore, if the voltage across Cs rises above 2/3 Vdd, the comparator 1 output will go LOW. Both comparator 1 and comparator 2 outputs enter into the SR Flip-Flops Set and Reset inputs respectively. Lets explain how this will work.

19

Oscillator Circuit
PICmicro MCU
CVREF 2/3 VDD VDD
3K + _ C1

S Q R Q

S 0 0 1 1

R Q Q OPERATION Outputs hold last known 0 values (HOLD) RESET 1 0 1 SET 0 1 0 RESET 1 0 1

1/4VDD
0.1F 1K

+ _ C2

120K CS

2007 Microchip Technology Incorporated. All Rights Reserved.

introduction to mTouch Capacitive Touch Sensing

Slide 20

In the slide above, note the SR Latchs truth table. If the Set input is driven HIGH, the pin connected to the Q bar output of the latch will be driven LOW. If the Reset input is driven HIGH, the pin connected to the Q bar output will be driven HIGH. Looking at the condition where both S and R inputs are HIGH, we notice that the operation of the Latch will be in Reset mode since this Latch is Reset dominant. More importantly is the condition where both inputs are driven LOW. What happens in this condition is that the outputs of the Latch will hold the last know output values. As you will see, this will become important in the operation of our relaxation oscillator design. Lets step through the operation of this oscillator

20

Oscillator Operation
PICmicro MCU
CVREF 2/3 VDD
+ _ C1

VCS

CHARGING
2/3 VDD

0
S Q

1/4VDD

+ _ C2

R Q

1/4VDD

POWER UP

time

120K

CS

+ _ VCS

S 0 0 1 1

R Q Q OPERATION Outputs hold last known 0 values (HOLD) RESET 1 0 1 SET 0 1 0 RESET 1 0 1
Slide 21

2007 Microchip Technology Incorporated. All Rights Reserved.

introduction to mTouch Capacitive Touch Sensing

In this slide, the graph on the right represents the voltage across the sensor capacitor. We will indicate changes in the SR Latch state by highlighting the appropriate row in the SR Latch truth table in green. Starting at the very beginning of operation, device power-up, the voltage across the sensor capacitor is 0. Therefore, comparator 2 output goes HIGH while the inverted output of comparator 2 goes low since both inverting inputs are less than the non-inverting input threshold voltages. This places the SR Latch into Reset driving the Q bar output to 1 which in turn charges the sensor capacitor.

21

Oscillator Operation
PICmicro MCU
CVREF 2/3 VDD
+ _ C1

VCS

CHARGING
2/3 VDD

0
S Q

1/4VDD

+ _ C2

R Q

1/4VDD

1/4VDD time

120K

CS

+ _ VCS

S 0 0 1 1

R Q Q OPERATION Outputs hold last known 0 values (HOLD) RESET 1 0 1 SET 0 1 0 RESET 1 0 1
Slide 22

2007 Microchip Technology Incorporated. All Rights Reserved.

introduction to mTouch Capacitive Touch Sensing

As the voltage across the sensor cap increases it eventually surpasses the 1/4Vdd threshold, the non-inverting input voltage to Comparator 2. This causes the output of Comparator 2 to go to 0. Referring to the SR latch truth table, this condition holds the last known output value on the Q bar output at 1 and the sense capacitor continues to charge.

22

Oscillator Operation
PICmicro MCU
CVREF 2/3 VDD
+ _ C1

VCS

CHARGING
2/3 VDD

0
S Q

1/4VDD

+ _ C2

R Q

1/4VDD

time

120K

CS

+ _ VCS

S 0 0 1 1

R Q Q OPERATION Outputs hold last known 0 values (HOLD) RESET 1 0 1 SET 0 1 0 RESET 1 0 1
Slide 23

2007 Microchip Technology Incorporated. All Rights Reserved.

introduction to mTouch Capacitive Touch Sensing

23

Oscillator Operation
PICmicro MCU
CVREF 2/3 VDD
+ _ C1

VCS

START DISCHARGING
2/3 VDD

1
S Q

1/4VDD

+ _ C2

R Q

1/4VDD

2/3VDD

time

120K

CS

+ _ VCS

S 0 0 1 1

R Q Q OPERATION Outputs hold last known 0 values (HOLD) RESET 1 0 1 SET 0 1 0 RESET 1 0 1
Slide 24

2007 Microchip Technology Incorporated. All Rights Reserved.

introduction to mTouch Capacitive Touch Sensing

Once the voltage across the sensor capacitor exceeds the internal voltage reference on the non-inverting input of comparator 1, the inverted comparator output connected to the Set input goes to 1 driving the Q bar output of the SR latch to 0. The sensor capacitor then starts to discharge.

24

Oscillator Operation
PICmicro MCU
CVREF 2/3 VDD
+ _ C1

VCS

DISCHARGING
2/3 VDD

0
S Q

1/4VDD

+ _ C2

R Q

1/4VDD

time

120K

CS

+ _ VCS

S 0 0 1 1

R Q Q OPERATION Outputs hold last known 0 values (HOLD) RESET 1 0 1 SET 0 1 0 RESET 1 0 1
Slide 25

2007 Microchip Technology Incorporated. All Rights Reserved.

introduction to mTouch Capacitive Touch Sensing

Once below the 2/3 Vdd threshold, the output of comparator 1 goes to 0. This places the SR latch into the hold state allowing the sensor capacitor to continue discharging.

25

Oscillator Operation
PICmicro MCU
CVREF 2/3 VDD
+ _ C1

VCS

START CHARGING

0
S Q

2/3 VDD

1/4VDD

+ _ C2

1/4VDD
1/4VDD

R Q

time

120K

CS

+ _ VCS

S 0 0 1 1

R Q Q OPERATION Outputs hold last known 0 values (HOLD) RESET 1 0 1 SET 0 1 0 RESET 1 0 1
Slide 26

2007 Microchip Technology Incorporated. All Rights Reserved.

introduction to mTouch Capacitive Touch Sensing

The voltage across the sensor capacitor eventually drops below the 1/4Vdd threshold causing the comparator 2 output to go to 1 driving the SR latch Q bar output HIGH. This, once again, begins charging the sensor capacitor.

26

Oscillator Operation
PICmicro MCU
CVREF 2/3 VDD
+ _ C1

VCS

CHARGING
2/3 VDD

0
S Q

1/4VDD

+ _ C2

R Q

1/4VDD

time

120K

CS

+ _ VCS

S 0 0 1 1

R Q Q OPERATION Outputs hold last known 0 values (HOLD) RESET 1 0 1 SET 0 1 0 RESET 1 0 1
Slide 27

2007 Microchip Technology Incorporated. All Rights Reserved.

introduction to mTouch Capacitive Touch Sensing

This charging and discharging process repeats as long as there is power to the system.

27

Oscillator Operation
PICmicro MCU
CVREF 2/3 VDD
+ _ C1

VCS

START DISCHARGING
2/3 VDD

1
S Q

1/4VDD

+ _ C2

R Q

1/4VDD

2/3VDD

time

120K

CS

+ _ VCS

S 0 0 1 1

R Q Q OPERATION Outputs hold last known 0 values (HOLD) RESET 1 0 1 SET 0 1 0 RESET 1 0 1
Slide 28

2007 Microchip Technology Incorporated. All Rights Reserved.

introduction to mTouch Capacitive Touch Sensing

28

Oscillator Operation
PICmicro MCU
CVREF 2/3 VDD
+ _ C1

VCS

DISCHARGING
2/3 VDD

1
S Q

0
1/4VDD

1/4VDD

+ _ C2

R Q

time

120K

CS

+ _ VCS

S 0 0 1 1

R Q Q OPERATION Outputs hold last known 0 values (HOLD) RESET 1 0 1 SET 0 1 0 RESET 1 0 1
Slide 29

2007 Microchip Technology Incorporated. All Rights Reserved.

introduction to mTouch Capacitive Touch Sensing

We have implemented the RC circuit containing the sensor capacitor into a very good relaxation oscillator. As the capacitance changes in the circuit, so will the RC time constant, changing the frequency of oscillation.

29

Frequency Measurement

2007 Microchip Technology Incorporated. All Rights Reserved.

Introduction to mTouch Capacitive Touch Sensing

Slide 30

So lets look at how we will determine a sensor touch based off of this frequency change using a frequency measurement circuit.

30

Frequency Measurement
PICmicro MCU
CVREF 2/3 VDD

VC2OUT pin
S Q R Q

VDD
3K

+ _C1 1/4VDD + _ C2

C2OUT pin
HIGH LOW

0.1F

1K

time
T0CKI pin

TIMER1

120K CS

2007 Microchip Technology Incorporated. All Rights Reserved.

introduction to mTouch Capacitive Touch Sensing

Slide 31

We should first note that the output from the SR latch on pin C2OUT is actually a square wave.

31

Frequency Measurement
PICmicro MCU
CVREF 2/3 VDD

VC2OUT pin
S Q R Q

VDD
3K

+ _C1 1/4VDD + _ C2

C2OUT pin
HIGH LOW

0.1F

1K

time
TMR1+1 TMR1+1 TMR1+1 TMR1+1 T0CKI pin

TIMER1

TMR1H

TMR1L

120K CS

16-bits = 0

(216 1) = 0

65535

2007 Microchip Technology Incorporated. All Rights Reserved.

introduction to mTouch Capacitive Touch Sensing

Slide 32

Connecting the SR latch output on C2OUT to the Timer1 input pin (T1CKI), we could use this square wave as the Timer1 clock source. Configuring TMR1 register to increment on every positive edge of the square wave allows us to count the number of clock pulses. However, this isnt enough to determine the frequency of the square wave. To do this will need to have a fixed period clock source to gate the 16-bit TMR1 value to.

32

Frequency Measurement
PICmicro MCU
CVREF 2/3 VDD

TMR0 interrupt provides a fixed time base for measurement TMR1H:TMR1L Increment Frequency

VDD
3K

+ _C1 1/4VDD + _ C2

S Q R Q

C2OUT pin time


TMR0 0 255
T0CKI pin

0.1F

1K

TIMER0 TIMER1

TMR0 0 255

TMR0 0 255

time

120K CS

TMR0 overflow

TMR0 overflow

2007 Microchip Technology Incorporated. All Rights Reserved.

introduction to mTouch Capacitive Touch Sensing

Slide 33

For this we use the Timer0 module. Here the PIC MCU is configured to generate an interrupt when the TMR0 register overflows. Therefore, the interrupts will occur at a fixed rate. We could detect a change in square wave frequency by observing a change in the TMR1 registers values on each TMR0 interrupt.

33

Frequency Measurement
VDD
3K

PICmicro MCU 1/4VDD

TMR0 interrupt provides a fixed time base for measurement TMR1H:TMR1L Increment Frequency

1000pF

1K

C2OUT

C12INx T1CKI

time
TMR0 0 255

time

CP

TMR0 overflow

2007 Microchip Technology Incorporated. All Rights Reserved.

introduction to mTouch Capacitive Touch Sensing

Slide 34

Capacitance created by the pad alone results in a corresponding square wave frequency. On a TMR0 interrupt, we read the current count value in the TMR1 registers and store it for later reference.

34

Frequency Measurement
VDD
3K

PICmicro MCU 1/4VDD

TMR0 interrupt provides a fixed time base for measurement TMR1H:TMR1L Increment Frequency

0.1F

1K

C2OUT

C12INx T1CKI

time
TMR0 0 255

CF CP

time

TMR0 overflow

2007 Microchip Technology Incorporated. All Rights Reserved.

introduction to mTouch Capacitive Touch Sensing

Slide 35

Once a finger touch is introduced, the sensor capacitance increases. This increases the RC time constant effectively decreasing the frequency of our square wave output.

35

Frequency Measurement
VDD
3K

PICmicro MCU 1/4VDD

TMR0 interrupt provides a fixed time base for measurement TMR1H:TMR1L Increment Frequency

0.1F

1K

C2OUT

C12INx T1CKI

time
TMR0 0 255 TMR0 0 255

CF CP

time

TMR0 overflow

TMR0 overflow

Frequency change of 1
2007 Microchip Technology Incorporated. All Rights Reserved. introduction to mTouch Capacitive Touch Sensing

5%
Slide 36

Therefore, on the next TMR0 interrupt, when we read the contents of the TMR1 registers, we should get a smaller value than the previous interrupt. Using a software algorithm to compare both values, we can identify a sensor touch. In the above diagram, the frequency difference is exaggerated in the interest of highlighting these changes. In reality, we can expect a frequency change of between 1 and 5%.

36

Frequency Measurement
VDD
3K

PICmicro MCU 1/4VDD

TMR0 interrupt provides a fixed time base for measurement TMR1H:TMR1L Increment Frequency

1000pF

1K

C2OUT

C12INx T1CKI

time
TMR0 0 255 TMR0 0 255

TMR0 0 255

time

CP

TMR0 overflow

TMR0 overflow

2007 Microchip Technology Incorporated. All Rights Reserved.

introduction to mTouch Capacitive Touch Sensing

Slide 37

Once, the finger is removed, sensor capacitance is again reduced. This decreases the RC time constant and increases the frequency of the square wave.

37

Frequency Measurement
VDD
3K

PICmicro MCU 1/4VDD

TMR0 interrupt provides a fixed time base for measurement TMR1H:TMR1L Increment Frequency

1000pF

1K

C2OUT

C12INx T1CKI

time
TMR0 0 255 TMR0 0 255

TMR0 0 255

time

CP

TMR0 overflow

TMR0 overflow

2007 Microchip Technology Incorporated. All Rights Reserved.

introduction to mTouch Capacitive Touch Sensing

Slide 38

The next TMR0 interrupt reads the value of the TMR1 registers, recognizes that it is greater than the previous result confirming that the sensor is released.

38

Software Algorithm to Detect a Sensor touch

2007 Microchip Technology Incorporated. All Rights Reserved.

Introduction to mTouch Capacitive Touch Sensing

Slide 39

The hardware section of our system is essentially completed. We will now move on to the software component.

39

Detecting a Sensor touch


Using 2 Variables and 1 Constant: variable average
running average of previous 16
samples of TMR1H:TMR1L
TMR0 interrupt provides a fixed time base for measurement TMR1H:TMR1L Increment Frequency

time
TMR0 0 255 TMR0 0 255

variable raw
current value of TMR1H:TMR1L

TMR0 0 255

constant trip
value of difference below
average that indicates a sensor touch

time

2007 Microchip Technology Incorporated. All Rights Reserved.

introduction to mTouch Capacitive Touch Sensing

Slide 40

To accurately detect a change in frequency of the relaxation oscillator, two variables and one constant are used. The average variable: keeps a running average of 16 previous samples from the TMR1 registers. This running average is used to eliminate noise created by changes in temperature, voltage and environment. The raw variable: holds the current value in TMR1 registers, and the predetermined trip constant: is the minimum difference between the raw data and the average value.

40

Detecting a Sensor Touch


TMR0 interrupt provides a fixed time base for measurement
TMR0 Overflow

TMR1H:TMR1L Increment Frequency

NO

is raw < (average trip) ???????

time
TMR0 0 255 TMR0 0 255

YES
NO SENSOR TOUCH SENSOR TOUCH

TMR0 0 255

time

2007 Microchip Technology Incorporated. All Rights Reserved.

introduction to mTouch Capacitive Touch Sensing

Slide 41

Implementing this in a software routine, on a TMR0 interrupt, the current data is read into the raw variable, if the average value less the trip value is greater than the raw value, a sensor touch has occurred and the software responds accordingly. Otherwise, the sensor is determined to be untouched.

41

Detecting a Sensor Touch


TMR0 interrupt provides a fixed time base for measurement
TMR0 Overflow

TMR1H:TMR1L Increment Frequency

NO

is raw < (average trip) ???????

time
TMR0 0 255 TMR0 0 255

YES
NO SENSOR TOUCH SENSOR TOUCH

TMR0 0 255

time

average =

average 16

* 15 + raw 16

CLEAR TMR1H:TMR1L

END

2007 Microchip Technology Incorporated. All Rights Reserved.

introduction to mTouch Capacitive Touch Sensing

Slide 42

If a sensor touch has not occurred, the current value in TMR1 registers is averaged into the 16-point running average. The TMR1 registers are always cleared at the end of every TMR0 interrupt routine and the CPU returns to whatever it was doing prior to the interrupt. This completes the basic system.

42

Moving Beyond the Basics

2007 Microchip Technology Incorporated. All Rights Reserved.

Introduction to mTouch Capacitive Touch Sensing

Slide 43

This is the fundamentals of a basic capacitive touch system. Lets take a look at some resources available from Microchip that will help you to move beyond the basics.

43

Beyond the Basics


Multiple sensors
using programmable comparator inputs
PICmicro MCU
CVREF 2/3 VDD
+ _C1

S Q R Q

+ _ C2

TIMER0 TIMER1

Multiple Sensors

External Reference

2007 Microchip Technology Incorporated. All Rights Reserved.

introduction to mTouch Capacitive Touch Sensing

Slide 44

We can further enhance this design by using features available on newer PIC Microcontrollers. For example, multiple sensors can be easily used in our design by using the programmable input selection of inverted inputs to both comparators. Notice in this example that both comparators are able to share the same input pin at one time.

44

Beyond the Basics


mTouch Software Development Kit (SDK)
Intuitive analysis of capacitive system Windows application that communicates with system

2007 Microchip Technology Incorporated. All Rights Reserved.

introduction to mTouch Capacitive Touch Sensing

Slide 45

The mTouch Software Development Tool is provided as a free download at www.microchip.com providing an intuitive means of analyzing a capacitive system. This tool features the ability to communicate with your system via the PICKit Serial Analyzer using the I2C protocol. Application critical information such as Trip threshold and acceptable hysteresis signaling a sensor touch can easily determined by visualizing sensor behavior.

45

Summary
mTouch
Non-mechanical Aesthetically diverse solution

Provided royalty free from Microchip Technology


Supporting resources
Application Notes Source Code Software Development Kit Online Design Center
introduction to mTouch Capacitive Touch Sensing Slide 46

2007 Microchip Technology Incorporated. All Rights Reserved.

The mTouch Capacitive Touch Sensing is a robust solution to traditional sensors that significantly reduces failure due to worn mechanical parts. Furthermore, some liberty can be taken with shape of the touch pads adding some aesthetic diversity to your design. Free licensing is provided by Microchip while making available a number of supporting resources such as application notes, source code, the mTouch Software Development Kit and an online design center.

46

Summary
Typical mTouch Capacitive Touch Sensing system:
PICmicro MCU Software

TIMER0

Capacitive Touch Sensor

DUAL COMPARATORS WITH SR LATCH

TIMER1

RELAXATION OSCILLATOR
2007 Microchip Technology Incorporated. All Rights Reserved.

FREQUENCY MEASUREMENT
Slide 47

introduction to mTouch Capacitive Touch Sensing

The Capacitive Touch Sensing system shown in this webseminar utilizes a relaxation oscillator circuit in which the touch sensors capacitance is used to affect the frequency. Frequency measurement incorporates the Timer1 and Timer0 modules in conjunction with software. Timer1 provides a 16-bit value based on the frequency of the oscillator while Timer0 interrupts provide a fixed, gated period over which to read these values. This particular design offers a number of advantages including minimal software impact on the design, fewer external components and an averaging software algorithm that tends to reduce the impact of noise on the system.

47

For More Information


AN1101: Introduction to Capacitive Sensing AN1102: Layout and Physical Design Guidelines for Capacitive Sensing AN1103: Software Handling for Capacitive Sensing AN1104: Capacitive Multi-Button Configurations mTouch Design Center at www.microchip.com/mTouch
2007 Microchip Technology Incorporated. All Rights Reserved. introduction to mTouch Capacitive Touch Sensing Slide 48

For more information on mTouch Capacitive Touch Sensing, please refer to the application notes listed above. Future mTouch webseminar topics will include layout/design techniques, software algorithms and multi-button configurations. You may also be interested in visiting the mTouch Design Center at www.microchip.com/mTouch. Here you will find links to the most current information and resources for this technology.

48

Thank You!!

2007 Microchip Technology Incorporated. All Rights Reserved.

Introduction to mTouch Capacitive Touch Sensing

Slide 49

My name is Marc McComb and I thank you for viewing this webseminar.

49

You might also like