Your SlideShare is downloading. ×
Capacitance Sensing - PC-Compatible USB
Capacitance Sensing - PC-Compatible USB
Capacitance Sensing - PC-Compatible USB
Capacitance Sensing - PC-Compatible USB
Capacitance Sensing - PC-Compatible USB
Capacitance Sensing - PC-Compatible USB
Capacitance Sensing - PC-Compatible USB
Capacitance Sensing - PC-Compatible USB
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Capacitance Sensing - PC-Compatible USB

1,117

Published on

This Application Note discusses construction, firmware communication, and considerations for a capacitive sensing matrixed keyboard using PSoC® CapSense.

This Application Note discusses construction, firmware communication, and considerations for a capacitive sensing matrixed keyboard using PSoC® CapSense.

Published in: Technology
1 Comment
0 Likes
Statistics
Notes
  • This is an interesting article, if you are looking for detail information you can check out http://www.cypress.com/
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Be the first to like this

No Downloads
Views
Total Views
1,117
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
0
Comments
1
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Capacitance Sensing - PC-Compatible USB CapSense Matrix Keyboard AN2407 Author: Michael Macovetskyi, Ruslan Bachynskyy, Ryshtun Andrij Associated Project: Yes Associated Part Family: CY8C21434-24LKXI GET FREE SAMPLES HERE Software Version: PSoC Designer™ 4.3 SP2 Associated Application Notes: AN2233a, AN2292, AN2318, AN2352, AN2355 PSoC Application Notes Index Application Note Abstract This Application Note discusses construction, firmware communication, and considerations for a capacitive sensing matrixed keyboard using PSoC® CapSense. Table 1. Matrix Keyboard Specification Introduction Capacitive sensor keyboards are widely used in modern Characteristic Value compact devices. Keyboard sensors can be connected to Total Keys Quantity 69 (64 matrix + 5 separated) the microcontroller pin individually. However, such a connection scheme limits the number of sensors to the Matrix Structure 8x8 number of available sensing pins. For applications with only a small number of sensors, this is not an issue. For Sensor Dimension 11x11 mm keyboards with many sensors, a new connection scheme 2 Communication Interface I C™ must be devised to maximize the number of sensors while maintaining a small pin count. Creating a matrix of sensors Overlay Thickness 1-6 mm can drastically raise the number of sensors in an 2 PC Interface USB, via I C-USB bridge application without increasing the pin overhead needed to control them. Power Supply Voltage From USB 5 ± 0.25V Figure 1. CapSense Matrix Keyboard Usage Standard HID keyboard, no PC Implementation additional GUI required Keys Matrix Structure Keyboard keys are organized into two groups. The first group is comprised of special function keys such as Shift, Ctrl, Alt keys. These keys are connected to PSoC pins individually and are scanned separately. The rest of the keys are organized in a rectangular 8-row, 8-column This Application Note presents an example scheme for a matrix. The 64 keys in this matrix represent alphanumeric matrixed capacitive sensing keyboard. A system block keys as well as special keys such as WIN and EXC. diagram is shown in Figure 1. Shift, Ctrl, Alt and some other keys can be activated at the Technical specifications for the matrixed keyboard same time as other keys. Scanning these keys separately presented here are listed in Table 1. allows correct detection of simultaneous sensor activation of these and keys in the general matrix. February 16, 2007 Document No. 001-41442 Rev. ** 1 [+] Feedback
  • 2. AN2407 The sensor design implemented on the demonstration Figure 3. Key Press/Sensor Activation Examples board increases the reliability of sensor activation Sensors Keys detection. Each key consists of four segments. Segments opposite each other are connected to each other, creating COL1 COL2 two interwoven yet electrically distinct sensors for each key; there is a row sensor and column sensor for each ROW1 Key1 Key2 key. Figure 2 illustrates the row (gray) and column (white) construction in two colors. This interwoven key structure means that a key represents activation on a row and a column at the same time. ROW2 Key3 Key4 Figure 2. Matrix Keys Structure a) COL1 COL2 ROW1 Key1 Key2 ROW2 Key3 Key4 b) COL1 COL2 ROW1 Key1 Key2 Firmware for activation detection completed an analysis of the row=column intersections. This method works well when only one key (one row and one column) is pressed at a time. If more than one key is pressed, false activations can occur due to multiple row-column ROW2 Key3 Key4 activations. Figures 3a shows the activation scheme for a single c) pressed key. Figure 3b shows the activation scheme for a simultaneous-key press that can be detected by the COL1 COL2 controller. Figures 3c and 3d show different simultaneous- ROW1 Key1 Key2 key presses that exhibit the same activation state and cannot be distinguished. Two keys that do not show either a row or a column sensor, when pressed, are viewed as four active keys. ROW2 To avoid this phenomenon, keyboard design logic allows Key3 Key4 only one key to register as pressed by selecting only one row and column sensor at a time. The selected sensor is d) determined by using a sorting algorithm for signals. Legend: Activated Row Sensor Detected as Not Pressed Activated Column Sensor Detected as Non-activated Row Sensor Pressed Non-activated Column Sensor Touched Sensor February 16, 2007 Document No. 001-41442 Rev. ** 2 [+] Feedback
  • 3. AN2407 Keyboard Schematic and PCB Keyboard Firmware The proposed keyboard uses minimal external The PSoC Designer project for this Application Note uses components and no mechanical keys. All the keys are the CapSense Sigma Delta (CSD) User Module (UM) for capacitive sensors implemented on the PCB as copper capacitive sensing and the EzI2C UM to transmit the results of the capacitive scans to the host though an I2C pads. The proposed keyboard consists of a PSoC and several resistors and capacitors. The keyboard schematic interface. The firmware scans the individual and matrix is shown in Appendix A. Series resistors are placed on sensors and sends the key codes to the I2C-USB bridge. each sensing trace and close to the PSoC. These Keys activation detection logic and sound generation is resistors decrease the influence of the RF noise caused implemented in the firmware of the PSoC, not in the host by cell phones, microwave ovens, etc. For more or GUI. The CSD UM parameters are shown in Figure 4. information on this, see AN2292, “Layout Guidelines for Figure 4. CSD UM Parameters PSoC CapSense” and AN3218, “EMC Considerations for PSoC CapSense.” When multiple sensing elements are connected in parallel (sensors in rows and columns) the parasitic capacitance increases. A shield electrode is added behind the sensors to reduce this parasitic capacitance. The shield electrode is located on the bottom PCB layer. Some sensors (Space, Enter) have much larger area than other sensors. This difference causes large sensor-to- sensor raw count variation, yielding different optimal modulator feedback resistor, R32 values. To balance raw counts for different sensors, resistor R27 is connected in parallel to the modulator capacitor when large area sensors are scanned. This connection is done in the firmware. For details on the modulator resistor and its impact on raw counts in CSD capacitive sensing, see AN2233a, “Capacitive Sensing Switch Scan/Theory and Operation.” For information on how to determine the value of R32 for other applications, see AN2355, “Calibrating CapSense Applications.” Speaker LS1 is used to emulate the ‘click’ of a mechanical button. When key press is detected, PSoC generates a click signal on port P1[7] using a pulse width modulator A sorting algorithm is used to detect which buttons are (PWM). This signal is amplified through VT1 and played really pressed when multiple keys are active. When a via speaker LS1. finger is near a key, non-zero signals exist on several neighboring key row and column elements at the same Connector J3 is used for ISSP and for I2C data transfer. time. The activation may be on a particular key (row and The following requirements should be applied to board column), but other rows and columns exhibit some signal layout for optimal matrix keyboard performance. as well. The most upper element is used to detect which element is really being pressed by the sensor when • Reduce spacing between row and column sensors for multiple sensors show possible activation. each button (8-12 mill/0.2-0.3 mm). • Keep the size and spacing of sensors consistent After the active row and column are determined, the when possible. internal-use key code is derived using the following • Use the physical key structure to determine the formula connection matrix structure for simplified layout. KeyCode=(RowMaxSenNum<<3)+ColMaxSenNum[15]-8; The Enter and Space keys are not special function keys For Shift, Ctrl, Alt, Space, and Return key activation as are Ctrl, Shift and Alt. But they are very large by the detection, CSD high-level APIs are used. After, the mechanical design. Therefore, these keys have individual scanning key state is read from the PSoC pins and are scanned with individual threshold CSD_baSnsOnMask[2] array. parameters. February 16, 2007 Document No. 001-41442 Rev. ** 3 [+] Feedback
  • 4. AN2407 When finger is between two keys, false activation is Figure 7. HID Report Description possible. To avoid this, an additional selection algorithm and hysteresis are used. A key pressed event is detected only when the signal from this key is two times or more greater than the signal from neighboring keys. If it is not, the key activation state is not changed. USB HID Device To test and demonstrate the matrix keyboard unit, we use special firmware that was developed for Cypress, I2C to USB Bridge Kit CY3240-I2USB. The PC operating system detects the I2C-USB bridge as an HID keyboard. The bridge firmware converts internal key code to HID key codes. We used two different PSoC devices for sensor scanning (CY8C21434-24LKXI) and USB communication (CY8C24894-24LFXI). It is possible to implement this design using a single CY8C24784-24LKXI, which supports both CSD capacitive sensing and USB communication. When a user holds a finger on the button for a long time, the PC operating system automatically runs character auto-repeat. This is implemented by the operating system, not the I2C-USB bridge. The USB HID keyboard endpoint descriptors and HID report description are shown in Figure 5 and Figure 7. The Windows device manager screen is shown in Figure 6. The sample text in Figure 8 was typed using the USB Figure 5. USB HID Keyboard Endpoint Descriptors CapSense Matrix Keyboard. Figure 8. Sample Text Figure 6. Windows Device Manager The matrix keyboard PCB pictures are shown in Appendix B. Gerber files are included in the project archive for reference. The CapSense matrix keyboard with I2C-USB bridge photo is shown in Appendix C. February 16, 2007 Document No. 001-41442 Rev. ** 4 [+] Feedback
  • 5. AN2407 Appendix A. Keyboard Schematic C_1 C_2 C_3 C_4 C_5 C_6 C_7 C_8 R16 R17 R18 R19 R20 R21 R23 R22 200 200 200 200 200 200 200 200 R8 200 R_1 3 4 3 4 3 4 3 4 3 4 3 4 3 4 3 4 1 1 1 1 1 1 1 1 Esc ! @ # $ % ^ & 2 1 2 2 2 3 2 4 2 5 2 6 2 7 2 R10 200 K1 K2 K3 K4 K5 K6 K7 K8 R_2 3 4 3 4 3 4 3 4 3 4 3 4 3 4 3 4 1 1 1 1 1 1 1 1 ~ Q W E R T Y U 2 2 2 2 2 2 2 2 R9 200 K17 K10 K11 K12 K13 K14 K15 K16 R_3 3 4 3 4 3 4 3 4 3 4 3 4 3 4 3 4 1 1 1 1 1 1 1 1 TAB A S D F G H J 2 2 2 2 2 2 2 2 R12 200 K9 K18 K19 K20 K21 K22 K23 K24 R_4 3 4 3 4 3 4 3 4 3 4 3 4 3 4 3 4 1 1 1 1 1 1 1 1 BACK Z X C V B N M 2 2 2 2 2 2 2 2 R14 200 K41 K26 K27 K28 K29 K30 K31 K32 R_5 3 4 3 4 3 4 3 4 3 4 3 4 3 4 3 4 1 1 1 1 1 1 1 1 * ( ) __ + PRINT Scroll Lock PAUSE 8 2 9 2 0 2 _ 2 = 2 2 2 2 R11 200 K36 K37 K38 K39 K40 K70 K71 K72 R_6 3 4 3 4 3 4 3 4 3 4 3 4 3 4 3 4 1 1 1 1 1 1 1 1 I O P { } Insert Home PUp 2 2 2 [ 2 ] 2 2 2 2 R13 200 K44 K45 K46 K47 K48 K64 K65 K67 R_7 3 4 3 4 3 4 3 4 3 4 3 4 3 4 3 4 1 1 1 1 1 1 1 1 K L : quot; | DELETE End PDown 2 2 ; 2 ' 2 2 2 2 2 R24 200 K52 K53 K54 K55 K56 K42 K66 K68 R_8 3 4 3 4 3 4 3 4 3 4 3 4 3 4 3 4 1 1 1 1 1 1 1 1 < < > ? < > > , 2 . 2 / 2 2 2 2 2 2 K59 K60 K61 K73 K43 K49 K50 K51 VCC ENTER SPACE SHIFT R5 200 ALT1 C3 C4 + ALT ALT2 4.7uF 0.1uF R6 200 SHIFT SHIFT1 SHIFT2 R7 200 SPACE SPACE R15 200 ENTER ENTER 32 31 30 29 28 27 26 25 R26 200 CTRL1 CTRL Vdd CTRL2 Vss P0[3] P0[5] P0[7] P0[6] P0[4] P0[2] R_1 R_2 R_3 1 24 R_4 P0[1] P0[0] 2 23 R_5 C_7 P2[7] P2[6] LS1 3 22 R_6 C_8 P2[5] P2[4] 4 U1 21 R_7 C_6 P2[3] P2[2] 5 CY 8C21434 20 R_8 C_5 P2[1] P2[0] 6 19 CTRL C_4 P3[3] P3[2] 7 18 ALT SHILD P3[1] P3[0] 8 17 CEM-1206S C_1 SPK P1[7] XRES C2 4.7uF C_2 R25 P1[5] P1[3] P1[1] P1[0] P1[2] P1[4] P1[6] C_3 VT1 Vss SPK BC807-40 T/R R1 1k 9 10 11 12 13 14 15 16 5K1 R3 2K2 VD1 VCC STPS340U R27 6K2 C1 J3 10nF 1 VCC 2 3 4 5 ISSP/DATA February 16, 2007 Document No. 001-41442 Rev. ** 5 [+] Feedback
  • 6. AN2407 Appendix B. Keyboard Layout Figure 9. PCB Top. Scale 50% Figure 10. PCB Bottom. Scale 50% Figure 10. PCB Silk Screen Top. Scale 50% February 16, 2007 Document No. 001-41442 Rev. ** 6 [+] Feedback
  • 7. AN2407 Appendix C. Device Photo Figure 12. CapSense Matrix Keyboard with I2C-USB Bridge Photo February 16, 2007 Document No. 001-41442 Rev. ** 7 [+] Feedback
  • 8. AN2407 In March of 2007, Cypress recataloged all of its Application Notes using a new documentation number and revision code. This new documentation number and revision code (001-xxxxx, beginning with rev. **), located in the footer of the document, will be used in all subsequent revisions. PSoC is a registered trademark of Cypress Semiconductor Corp. quot;Programmable System-on-Chip,quot; PSoC Designer, and PSoC Express are trademarks of Cypress Semiconductor Corp. All other trademarks or registered trademarks referenced herein are the property of their respective owners. Cypress Semiconductor 198 Champion Court San Jose, CA 95134-1709 Phone: 408-943-2600 Fax: 408-943-4730 http://www.cypress.com/ © Cypress Semiconductor Corporation, 2007. The information contained herein is subject to change without notice. Cypress Semiconductor Corporation assumes no responsibility for the use of any circuitry other than circuitry embodied in a Cypress product. Nor does it convey or imply any license under patent or other rights. Cypress products are not warranted nor intended to be used for medical, life support, life saving, critical control or safety applications, unless pursuant to an express written agreement with Cypress. Furthermore, Cypress does not authorize its products for use as critical components in life-support systems where a malfunction or failure may reasonably be expected to result in significant injury to the user. The inclusion of Cypress products in life-support systems application implies that the manufacturer assumes all risk of such use and in doing so indemnifies Cypress against all charges. This Source Code (software and/or firmware) is owned by Cypress Semiconductor Corporation (Cypress) and is protected by and subject to worldwide patent protection (United States and foreign), United States copyright laws and international treaty provisions. Cypress hereby grants to licensee a personal, non-exclusive, non-transferable license to copy, use, modify, create derivative works of, and compile the Cypress Source Code and derivative works for the sole purpose of creating custom software and or firmware in support of licensee product to be used only in conjunction with a Cypress integrated circuit as specified in the applicable agreement. Any reproduction, modification, translation, compilation, or representation of this Source Code except as specified above is prohibited without the express written permission of Cypress. Disclaimer: CYPRESS MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS MATERIAL, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Cypress reserves the right to make changes without further notice to the materials described herein. Cypress does not assume any liability arising out of the application or use of any product or circuit described herein. Cypress does not authorize its products for use as critical components in life-support systems where a malfunction or failure may reasonably be expected to result in significant injury to the user. The inclusion of Cypress’ product in a life-support systems application implies that the manufacturer assumes all risk of such use and in doing so indemnifies Cypress against all charges. Use may be limited by and subject to the applicable Cypress software license agreement. February 16, 2007 Document No. 001-41442 Rev. ** 8 [+] Feedback

×