Prices incl. GST
Out of Stock.
- Product Code: MIKROE-2964
- MPN: MIKROE-2964
Cap Touch 2 click is a capacitive touch sensing Click board™ which features the CAP1166, an advanced touch/proximity sensor IC, packed with a range of different touch/proximity functionalities, allowing development of robust and aesthetically pleasing touch interfaces. Besides six touch sensitive channels, the sensor IC has six independent LED drivers, with several operating modes, including touch sensor linking, as well as the pulsing and breathing effects. It also supports Multiple Touch Pattern Detection (MTPD), and press-and-hold function. Capacitive touch sensor inputs are protected from false detections, which can be caused by the low noise and RF interferences, providing a very reliable touch sensing functionality.
Due to advanced capacitive touch proximity functions and technologies that allow reliable sensing, Cap Touch 2 click offers very reliable and accurate sensing for any application that uses capacitive touch sensing functions, such as desktop or notebook computers, LCD/TFT monitors, various types of consumer electronics, home appliances, and other applications that can benefit of having an appealing, reliable and feature-rich touch activated user interface.
How does it work?
The capacitive sensor IC used on the Cap Touch 2 click is the CAP1166, a 6 channel capacitive touch sensor with 6 LED drivers, from Microchip. This IC is composed of six input capacitive touch channels, implemented with the RightTouch® technology, six LED drives with programmable signaling functions, and the logic section, which uses the standard SPI communication interface. Besides the SPI bus, the logic section uses few more lines - for the device reset and for triggering the alert (interrupt) event.
The click board itself has six PCB pads, used to sense touch or proximity events. These pads are the only elements on the top of the board, allowing installation of the protective acrylic glass layer. These pads can be programmed to generate a touch event for both when they are pressed, and when they are released. The capacitive sensor channels feature programmable sensitivity and an automatic recalibration, used to compensate for environmental changes. The recalibration procedure can be triggered either automatically, or on-demand, and it is used to set the base register value for the “not touched” state of the input channel. The enabled input channels are polled in a cyclic order and if the difference between the base value and the measured value on a particular channel is over the threshold, a touch event will be generated.
The CAP1166 IC also integrates sections that provide an efficient interference protection. The EMI and RFI detection sections provide protection by discarding the corrupted bytes if the detected noise threshold is exceeded. Also, false input readings, such as the negative values and “stuck button” events are handled by the internal algorithms, which will set the respective bits to indicate the problem, and can be set to trigger a recalibration procedure.
There are three power modes of operation:
- Fully Active mode, which monitors all the input channels and all the LED drivers are active. Registers are available for both reading and writing.
- Stand-by mode, which will monitor only the selected channels. The selected channels will be able to trigger interrupts. Communication will be still functional and the device can be set to a Fully Active mode. This mode uses less power than the Fully Active mode.
- Deep Sleep mode, which consumes the least power. In this mode, all the input channels and LED drivers are disabled. The communication is possible only when the CAP1166 IC is targeted by the host MCU.
Multiple touch pattern detection (MTPD) is used to set the pattern which will generate a touch event. This pattern may consist of multiple specific sensors touched at once, a minimal number of touched sensors, or when their noise flag bit is set in the status register. This function can be used to detect a closed lid or similar event.
Cap Touch 2 click contains six LEDs, mounted on the back side of the PCB, inside the specially designed openings. These LEDs can be linked to the corresponding sensing channel or can be controlled by the host MCU. As described above, these LEDs can be programmed to indicate a touch event with a range of lighting effects, including breathing, two modes of pulsing with the programmable parameters, and an ON-OFF state.
The interrupt engine allows to differentiate between the simple touch, and touch and hold events. The interrupt can be generated once when a pad touch is detected, or it can be repeatedly generated while the pad is touched. The programmable timer is started after the first touch event on a specific channel, and if no release event is detected after the timer expires, the interrupt is generated, in the programmed intervals. This function is very useful for building volume up/down buttons, light dimming buttons, and similar applications. The interrupt event will also drive the /ALERT pin to a state, defined in the respective configuration register. This pin is routed to the mikroBUS™ INT pin and it is used to trigger an interrupt event on the host MCU.
The RST pin is routed to the RST pin of the mikroBUS™ and it is used to reset the CAP1166 IC. To reset the device, this pin has to be set to a HIGH logic level. This will clear all the readings and reset the configuration registers to their factory default values. The device will be kept in a Deep Sleep mode until this pin is set to a LOW logic level. This pin is equipped with a pull-down resistor.
More information about the registers and their functions can be found in the CAP1166 IC datasheet. However, the provided click library offers a function for easy and simple control of the Cap Touch 2 click. The provided application example demonstrates their functionality and it can be used as a reference for custom projects.
Specifications
Type | Proximity |
Applications | It can be used for desktop or notebook computers control, LCD/TFT monitors, various types of consumer electronic, home appliances, and other applications that can benefit of having a reliable and feature-rich touch activated user interface. |
On-board modules | CAP1166, a 6 channel capacitive touch sensor with 6 LED drivers, from Microchip |
Key Features | Reliable capacitive touch detection technology, noise filtering, six input channels, six programmable LED drivers, press and hold function, automatic recalibration and programmable sensitivity for each channel, etc. |
Interface | SPI |
Input Voltage | 3.3V |
Pinout diagram
This table shows how the pinout on Cap Touch 2 click corresponds to the pinout on the mikroBUS™ socket (the latter shown in the two middle columns).
Onboard settings and indicators
Label | Name | Default | Description |
---|---|---|---|
LD1 - LD6 | LED1 - LED6 | - | Programmable touch LED indicators |
LD7 | PWR | - | Power LED Indicator |
Software support
We provide a library for Cap Touch 2 click on our Libstock page, as well as a demo application (example), developed using MikroElektronika compilers and mikroSDK. The provided click library is mikroSDK standard compliant. The demo application can run on all the main MikroElektronika development boards.
Library Description
The library initializes and defines SPI bus driver and driver functions which offer a choice to write data in registers and to read data from registers. The library also offers a choice to detect a touch on enabled sensor inputs in two possible modes, Active and Standby mode. Sensor inputs can also be configured to detect when touch is released and can generate an interrupt as long as the touch is detected. For more details check the documentation.
Key functions:
void captouch2_writeReg( const uint8_t register_address, const uint8_t transfer_data )
- The function writes one byte to register.
void captouch2_readReg( const uint8_t register_address, uint8_t *dataOut, const uint8_t nBytes )
- The function reads data from the register.
void captouch2_detectTouch( uint8_t *inputSens )
- The function detects a touch on sensor inputs and checks if touch is detected or if touch is released.
void captouch2_setActiveMode( const uint8_t analogGain, const uint8_t enInput )
- Function puts the device in Active mode and enables desired inputs in Active mode.
Examples Description
The demo application is composed of three sections:
- System Initialization - Initializes peripherals and pins.
- Application Initialization - Initializes SPI driver and sets configuration for Cap Touch 2 click. Cap Touch 2 is configured to works in Active mode (Normal mode). All inputs are enabled in this mode. In this example, the interrupt will be generated when touch is detected and when touch is released. Also, inputs 4, 5 and 6 will generate an interrupt as long as the touch is detected (press and hold event), while inputs 1, 2 and 3 will generate interrupt only once on one touch detection, after which the touch will be released.
Note: Standby mode should be used when fewer sensor inputs are enabled, and when they are programmed to have more sensitivity. - Application Task - (code snippet) - Calls function to check touch detection (is interrupt occurred) and shows a message on USB UART on which input touch is detected or on which input touch is released. Also turns on LED on which linked input interrupt occurred.
void applicationTask() { captouch2_detectTouch( &sensorResults[0] ); for (cnt = 0; cnt < 6; cnt++) { if (sensorResults[ cnt ] == 1) { if (cnt == 0) mikrobus_logWrite( "Input 1 is touched", _LOG_LINE ); else if (cnt == 1) mikrobus_logWrite( "Input 2 is touched", _LOG_LINE ); else if (cnt == 2) mikrobus_logWrite( "Input 3 is touched", _LOG_LINE ); else if (cnt == 3) mikrobus_logWrite( "Input 4 is touched", _LOG_LINE ); else if (cnt == 4) mikrobus_logWrite( "Input 5 is touched", _LOG_LINE ); else mikrobus_logWrite( "Input 6 is touched", _LOG_LINE ); } else if (sensorResults[ cnt ] == 2) { if (cnt == 0) mikrobus_logWrite( "Input 1 is released", _LOG_LINE ); else if (cnt == 1) mikrobus_logWrite( "Input 2 is released", _LOG_LINE ); else if (cnt == 2) mikrobus_logWrite( "Input 3 is released", _LOG_LINE ); else if (cnt == 3) mikrobus_logWrite( "Input 4 is released", _LOG_LINE ); else if (cnt == 4) mikrobus_logWrite( "Input 5 is released", _LOG_LINE ); else mikrobus_logWrite( "Input 6 is released", _LOG_LINE ); mikrobus_logWrite( "", _LOG_LINE ); } } }
The full application code, and ready to use projects can be found on our Libstock page.
Other mikroE libraries used in the example:
- SPI
- UART
Additional notes and information
Depending on the development board you are using, you may need USB UART click, USB UART 2 click or RS232 click to connect to your PC, for development systems with no UART to USB interface available on the board. The terminal available in all MikroElektronika compilers, or any other terminal application of your choice, can be used to read the message.
mikroSDK
This click board is supported with mikroSDK - MikroElektronika Software Development Kit. To ensure proper operation of mikroSDK compliant click board demo applications, mikroSDK should be downloaded from the LibStock and installed for the compiler you are using.