AN-829 APPLICATION NOTE One Technology Way • P.O. Box 9106 • Norwood, MA 02062-9106, U.S.A. • Tel: 781.329.4700 • Fax: 781.461.3113 • www.analog.com Environmental Compensation on the AD7142: The Effects of Temperature and Humidity on Capacitance Sensors by Susan Pratt INTRODUCTION Capacitance sensing has the potential to replace current user input mechanisms in consumer devices. Products as diverse as cell phones, digital cameras, MP3 players, and other portable media players are all suitable for implementing capacitance sensing. Capacitance sensing has many benefits. It gives the user an interface with greater sensitivity and control. Capacitance sensors are easy to manufacture and reliable, and have advantages over current mechanical interfaces. However, all types of capacitance sensors are affected by capacitance changes in the surrounding environment. Changes in humidity or temperature can interfere with the operation of the sensors, in some cases stopping the sensor from working altogether. Analog Devices’ capacitance sensing solution consists of the AD7142 capacitive-to-digital converter IC, sensors on the PCB, and software to communicate with the AD7142. A crucial element of the AD7142 is the on-chip digital logic that performs environmental compensation. This ensures that the capacitance sensor is automatically compensated for the effect of environmental changes. This application note describes the importance of this on-chip logic by quantifying the effects changing environmental factors have on typical sensor configurations. This document also explains how the compensation routines on the AD7142 ensure that the sensors continue to operate correctly in changing environmental conditions. Rev. 0 | Page 1 of 8 AN-829 TABLE OF CONTENTS Introduction ...................................................................................... 1 Sensor Configurations ..................................................................... 3 Effects of Temperature and Humidity ........................................... 4 Sensor Operation.............................................................................. 5 Environmental Compensation ................................................... 5 REVISION HISTORY 12/05—Revision 0: Initial Version Rev. 0 | Page 2 of 8 AN-829 SENSOR CONFIGURATIONS Three types of sensor configuration were tested to quantify the effect of temperature and humidity changes on the measured capacitance. The sensor configurations included a joy pad, a button, and a slider, all connected to the AD7142 as shown in Figure 1. SENSOR PCB LAYER 4 SENSOR PCB LAYER 3 30 29 28 27 26 CIN0 VREF – VREF + TEST GPIO 25 INT 31 1 CIN3 CS/ADD1 24 2 CIN4 SCLK 23 3 CIN5 SDI/ADD0 22 4 CIN6 5 CIN7 VDRIVE 20 6 CIN8 DGND2 19 7 CIN9 DGND1 18 8 CIN10 SDO/SDA 21 AD7142 AGND SRC SRC 9 10 11 12 13 14 15 16 05848-001 AVCC DVCC 17 CBIAS B CIN13 B B CIN12 B CIN11 SENSOR PCB LAYER 2 SENSOR PCB LAYER 2 SENSOR PCB LAYER 1 SLIDER JOY PAD 32 CIN1 SLIDER CIN2 VCC Figure 1. Sensor Configurations Rev. 0 | Page 3 of 8 AN-829 EFFECTS OF TEMPERATURE AND HUMIDITY 31700 Figure 2 through Figure 4 show the changes in the measured ADC value that occur when the ambient temperature or humidity in and around the sensors change. The measured value here is on the ambient capacitance—that is, when the sensor is not touched. 31600 JOY PAD VALUE (CIN4) 70°C The effect of an increase in humidity in the ambient environment is also shown in Figure 2 through Figure 4. Again, the outputs from the sensors change in response to the humidity, but not in a predictable way. JOY PAD VALUE (CIN6) 70°C 31300 31200 JOY PAD VALUE (CIN6) 50°C 31000 10 30 50 70 90 05848-003 JOY PAD VALUE (CIN6) 30°C 31100 98 HUMIDITY (%) Figure 3. Environmental Effects on Joy Pad Sensor ACTIVATION (CIN1) 30°C MEASURED VALUE 40700 BUTTON 2 (CIN8) 50°C 51500 51000 BUTTON 2 (CIN8) 30°C ACTIVATION (CIN1) 10°C 40500 ACTIVATION (CIN1) 50°C 40300 40100 39900 ACTIVATION (CIN1) 70°C 05848-004 39700 50000 39500 49500 BUTTON 1 (CIN7) 30°C 10 BUTTON 1 (CIN7) 50°C 30 50 70 90 HUMIDITY (%) 49000 Figure 4. Environmental Effects on Slider Sensor 48500 05848-002 MEASURED VALUE JOY PAD VALUE (CIN4) 50°C 31400 40900 52000 BUTTON 2 (CIN8) 70°C MEASURED VALUE 31500 The figures show that as the ambient temperature increases, the capacitance measured from each of the sensors changes. (The measured value is the ADC code output from the capacitive-todigital converter on the AD7142). These changes are not predictable, because the capacitance measured can increase or decrease. For example, at 30°C, the Button 1 sensor measures at roughly 48550. When the temperature increases to 50°C, the sensor output also increases. However, when the temperature increases further to 70°C, the output from the sensor drops to below 48500, which is less than the measured value at 30°C. 50500 JOY PAD VALUE (CIN4) 30°C BUTTON 1 (CIN7) 70°C 48000 10 30 50 70 90 98 HUMIDITY (%) Figure 2. Environmental Effect on Button Sensors Rev. 0 | Page 4 of 8 98 AN-829 SENSOR OPERATION 52000 When a sensor is touched, the total capacitance associated with that sensor, and measured by the AD7142, changes. When the capacitance changes to such an extent that a set threshold is exceeded, the AD7142 registers this as a sensor activation. BUTTON 2 VALUE (CIN8) MEASURED VALUE 51000 For example, consider the case of a button sensor that is connected to the AD7142. When the button is pressed, the AD7142 registers an increase in capacitance. If the button is not pressed, the AD7142 measures the background or ambient capacitance level. Preprogrammed threshold levels are used to determine if a change in capacitance is due to a button being pressed. If the capacitance exceeds the threshold limit, the AD7142 registers this as a true button press. BUTTON 2 THRESHOLD 50000 49000 05848-006 BUTTON 1 VALUE (CIN7) BUTTON 1 THRESHOLD 48000 10 30 50 70 90 98 HUMIDITY (%) SENSOR TOUCH Figure 6. Button Sensors with Fixed Thresholds The measured capacitance from a sensor may also increase due to environmental changes. In this case, the sensor may never register as being activated, as the capacitance value may never fall below the threshold even when the sensor is pressed. Figure 5. Sensor Activation The same principle of thresholds is used to determine if other types of sensors, such as sliders or joy pads, are being touched. ENVIRONMENTAL COMPENSATION Changes in the background capacitance level are generally much smaller than the changes that occur when a sensor is touched. However, if the change in measured capacitance due to the environment is great enough to cross the threshold, the sensor registers as being touched, when in fact, it was not. Analog Device’s complete capacitance solution takes the changing environment into account by actively adapting the threshold values with the changing environment. This ensures that the sensors operate correctly in all environments and prevents false touches or failure to register a valid touch. This compensation is part of the digital logic on board the AD7142, and is performed by the part automatically at regular intervals. Figure 7 shows how the environmental compensation algorithm changes the threshold levels with changing humidity and thus ensures that the measured values from the button sensors do not fall below the threshold value to register a false touch. In Figure 6, Button 2 threshold is fixed at 51000. When the measured value from Button 2 falls below this threshold, this registers as a sensor activation. At low humidity values, the measured value is well above the threshold, an indication the button is not touched. However, as the humidity increases, the value measured from Button 2 decreases and crosses the threshold at humidity values above 70%. Once the threshold is crossed, a button press is registered, which in this case is a false activation. Consider a real-world application in which a you are listening to an MP3 player. When you leave an air-conditioned building to go outside on a humid summer day, the MP3 player could start rewinding a tune midsong. Button 1 is also affected by the humidity in the same manner. Rev. 0 | Page 5 of 8 51500 BUTTON 2 VALUE (CIN8) 51000 BUTTON 2 THRESHOLD 50500 50000 49500 49000 BUTTON 1 VALUE (CIN7) 48500 48000 05848-007 AMBIENT CAPACITANCE VALUE 05848-005 THRESHOLD MEASURED VALUE CDC OUTPUT CODE 65536 BUTTON 1 THRESHOLD 10 30 50 70 90 HUMIDITY (%) Figure 7. Button Sensors with Adaptive Sensors 98 AN-829 Similarly, the threshold values for other sensor types are adjusted for changing temperature and humidity by the compensation algorithm. For the slider sensor, shown in Figure 8, the sensor is registered as being active when the activation level exceeds either the higher or lower threshold level. An increase or decrease in ambient temperature could potentially activate the sensor. However, the adaptive thresholds ensure that no false touches are registered. Figure 9 shows how the thresholds governing operation of the joy pad adapt to changing humidity. The joy pad registers a touch if the CIN4 measured value exceeds with the left or right thresholds, or if the CIN6 measured value exceeds either the up or down thresholds. Again, the environmental compensation algorithm ensures that the threshold values track the environmental changes and ensures correct operation of the sensor. 41000 32000 40800 RIGHT THRESHOLD 40600 31800 40200 40000 ACTIVATION (CIN1) 39800 LOWER THRESHOLD 39600 39400 JOY PAD VALUE (CIN4) 31600 LEFT THRESHOLD 31400 UP THRESHOLD 05848-008 31200 39200 39000 30 50 31000 JOY PAD VALUE (CIN6) DOWN THRESHOLD 10 70 TEMPERATURE (°C) 05848-009 MEASURED VALUE MEASURED VALUE UPPER THRESHOLD 40400 30 50 70 90 98 HUMIDITY (%) Figure 8. Slider Sensor with Adaptive Thresholds at Constant 50% Humidity Rev. 0 | Page 6 of 8 Figure 9. Joy Pad Sensor + Thresholds at Constant 30°C. AN-829 NOTES Rev. 0 | Page 7 of 8 AN-829 NOTES ©2005 Analog Devices, Inc. All rights reserved. Trademarks and registered trademarks are the property of their respective owners. AN05848-0-12/05(0) Rev. 0 | Page 8 of 8