Experience intuitive interaction like never before by integrating responsive touch controls into your projects for enhanced user experiences and functionality
A
A
Hardware Overview
How does it work?
CapSense Click is based on the CY8C201A0, a multi-channel capacitive touch sensor from Infineon Technologies. The CY8C201A0 takes human body capacitance as an input and directly provides real-time sensor information via a serial interface. The user can also configure registers with parameters needed to adjust the operation and sensitivity of the CapSense touch buttons and slider and permanently store the settings. As mentioned earlier, this board contains a 5-segment capacitive sensing slider that can detect a slide in either the UP or DOWN direction, as well as two touch button pads which are the only elements on the top side of the board. Each of these touch button pads has a
LED indicator representing the activity in that field. If a touch event is detected on one of these onboard pads, the state of the corresponding LED will be changed, indicating an activated channel; more precisely, touch has been detected on that specific field. CapSense Click communicates with MCU using the standard I2C 2-Wire interface to read data and configure settings. The CY8C201A0 contains multiple operating modes: Active, Periodic Sleep, and Deep Sleep Mode, to meet different power consumption requirements. In the case of using some of the existing Sleep modes, the user is provided with the possibility of controlling these states via the GPO pin, routed to the AN pin of the
mikroBUS™ socket, or this pin can be set in software as an interrupt pin indicating when a specific interrupt event occurs (touch detection). Besides, a Reset pin, routed to the RST pin of the mikroBUS™ socket, causes all operations of the CY8C201A0s CPU and blocks to stop and return to a pre-defined state. This Click board™ can operate with either 3.3V or 5V logic voltage levels selected via the PWR SEL jumper. This way, both 3.3V and 5V capable MCUs can use the communication lines properly. However, the Click board™ comes equipped with a library containing easy-to-use functions and an example code that can be used, as a reference, for further development.
Features overview
Development board
PIC32MZ Clicker is a compact starter development board that brings the flexibility of add-on Click boards™ to your favorite microcontroller, making it a perfect starter kit for implementing your ideas. It comes with an onboard 32-bit PIC32MZ microcontroller with FPU from Microchip, a USB connector, LED indicators, buttons, a mikroProg connector, and a header for interfacing with external electronics. Thanks to its compact design with clear and easy-recognizable silkscreen markings, it provides a fluid and immersive working experience, allowing access anywhere and under
any circumstances. Each part of the PIC32MZ Clicker development kit contains the components necessary for the most efficient operation of the same board. In addition to the possibility of choosing the PIC32MZ Clicker programming method, using USB HID mikroBootloader, or through an external mikroProg connector for PIC, dsPIC, or PIC32 programmer, the Clicker board also includes a clean and regulated power supply module for the development kit. The USB Micro-B connection can provide up to 500mA of current, which is more than enough to operate all onboard
and additional modules. All communication methods that mikroBUS™ itself supports are on this board, including the well-established mikroBUS™ socket, reset button, and several buttons and LED indicators. PIC32MZ Clicker is an integral part of the Mikroe ecosystem, allowing you to create a new application in minutes. Natively supported by Mikroe software tools, it covers many aspects of prototyping thanks to a considerable number of different Click boards™ (over a thousand boards), the number of which is growing every day.
Microcontroller Overview
MCU Card / MCU

Architecture
PIC32
MCU Memory (KB)
1024
Silicon Vendor
Microchip
Pin count
64
RAM (Bytes)
524288
Used MCU Pins
mikroBUS™ mapper
Take a closer look
Click board™ Schematic

Step by step
Project assembly
Track your results in real time
Application Output
1. Application Output - In Debug mode, the 'Application Output' window enables real-time data monitoring, offering direct insight into execution results. Ensure proper data display by configuring the environment correctly using the provided tutorial.

2. UART Terminal - Use the UART Terminal to monitor data transmission via a USB to UART converter, allowing direct communication between the Click board™ and your development system. Configure the baud rate and other serial settings according to your project's requirements to ensure proper functionality. For step-by-step setup instructions, refer to the provided tutorial.

3. Plot Output - The Plot feature offers a powerful way to visualize real-time sensor data, enabling trend analysis, debugging, and comparison of multiple data points. To set it up correctly, follow the provided tutorial, which includes a step-by-step example of using the Plot feature to display Click board™ readings. To use the Plot feature in your code, use the function: plot(*insert_graph_name*, variable_name);. This is a general format, and it is up to the user to replace 'insert_graph_name' with the actual graph name and 'variable_name' with the parameter to be displayed.

Software Support
Library Description
This library contains API for CapSense Click driver.
Key functions:
capsense_get_slider_lvl
- This function gets slider levelcapsense_read_data
- Read one byte from register addresscapsense_write_data
- Generic write data function
Open Source
Code example
The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.
/*!
* \file
* \brief CapSense Click example
*
* # Description
* This demo example shows level of the slider on the terminal.
*
* The demo application is composed of two sections :
*
* ## Application Init
* Initializes device.
*
* ## Application Task
* Waits user to press top and bottom button to turn click's LEDs ON or OFF.
* User can swipe slider to send log to the UART where one can track their changes.
*
*
* \author MikroE Team
*
*/
// ------------------------------------------------------------------- INCLUDES
#include "board.h"
#include "log.h"
#include "capsense.h"
// ------------------------------------------------------------------ VARIABLES
static capsense_t capsense;
static log_t logger;
// ------------------------------------------------------- ADDITIONAL FUNCTIONS
void bits_to_str( uint8_t num, uint8_t *s )
{
uint8_t mask = 0x80;
while ( mask )
{
if ( num & mask )
{
*s++ = '1';
}
else
{
*s++ = '0';
}
mask >>= 1;
}
*s = '\0';
}
// ------------------------------------------------------ APPLICATION FUNCTIONS
void application_init ( void )
{
log_cfg_t log_cfg;
capsense_cfg_t cfg;
/**
* Logger initialization.
* Default baud rate: 115200
* Default log level: LOG_LEVEL_DEBUG
* @note If USB_UART_RX and USB_UART_TX
* are defined as HAL_PIN_NC, you will
* need to define them manually for log to work.
* See @b LOG_MAP_USB_UART macro definition for detailed explanation.
*/
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, "---- Application Init ----" );
// Click initialization.
capsense_cfg_setup( &cfg );
CAPSENSE_MAP_MIKROBUS( cfg, MIKROBUS_1 );
capsense_init( &capsense, &cfg );
if ( CAPSENSE_ERROR == capsense_default_cfg ( &capsense ) )
{
log_error( &logger, " Default configuration." );
for ( ; ; );
}
log_info( &logger, " Application Task " );
}
void application_task ( void )
{
static uint8_t current_led_state = 0;
uint8_t output_lvl[ 10 ] = { 0 };
uint8_t button_select = 0;
uint8_t slider_lvl = 0;
capsense_read_data( &capsense, CAPSENSE_CS_READ_STATUS0, &button_select );
capsense_get_slider_lvl( &capsense, &slider_lvl );
capsense_write_data( &capsense, CAPSENSE_OUTPUT_PORT0, current_led_state );
Delay_ms( 100 );
if ( 8 == button_select )
{
current_led_state ^= 0x01;
log_printf( &logger, "Toggle LED1\r\n");
Delay_ms( 100 );
}
if ( 16 == button_select )
{
current_led_state ^= 0x02;
log_printf( &logger, "Toggle LED2\r\n");
Delay_ms( 100 );
}
if ( 24 == button_select )
{
current_led_state = ~current_led_state;
log_printf( &logger, "Toggle both LEDs\r\n");
Delay_ms( 100 );
}
if ( slider_lvl )
{
bits_to_str( slider_lvl, output_lvl );
log_printf( &logger, "Slider level - channels [5-1]:\t%s \r\n", &output_lvl[ 3 ] );
Delay_ms( 100 );
}
}
int main ( void )
{
application_init( );
for ( ; ; )
{
application_task( );
}
return 0;
}
// ------------------------------------------------------------------------ END