Transform capacitance into digital data for enhanced accuracy and control in your projects
A
A
Hardware Overview
How does it work?
CDC Click is based on the PCAP04, a capacitance-to-digital converter from ScioSense. It covers a wide capacitance input range from a few femtofarads to several hundreds of nanofarads. Configuring the PCAP04 for different capacitance measurement tasks, such as single and differential sensors in grounded or floating connections, is easy. The CDC Click is pre-assembled with 10pF capacitors on the PC0 – PC5 header to emulate capacitive sensors. They are connected as single sensors in floating mode. There is a GND connector for connecting the capacitive sensors in grounded mode. The typical value of the capacitive sensors that can be connected is in the range of 30pF to 3.5nF. The PCAP04 has four general
purpose input/output pins (PG prefix) and can be used as pulse-density/pulse-width modulation outputs. The PCAP04 features the RDC (resistance-to-digital converter) as well. The RDC unit is mainly intended for measuring temperature, using an internal sensor and reference, or using external resistors like the PT1000 onboard. You can, however, connect an external sensor over the PT1 and PTO connectors or any other resistance element. The DSP takes information from both the CDC and RDC processes, making it available to the host MCU. You can also add another temperature sensor or temperature reference on RT2. The auxiliary port (PCAUX – PCA on CDC Click) can be used for external compensation
capacitance or external discharge resistor and guarding port. You can make a selection by soldering an R7 jumper. CDC Click can communicate with the host MCU using a standard I2C or 4-wire SPI serial interface. The selection can be made over the COMM SEL jumpers. The I2C is set by default and supports up to 100kHz of the bus frequency clock. The SPI clock frequency is up to 20MHz. This Click board™ can be operated only with a 3.3V logic voltage level. The board must perform appropriate logic voltage level conversion before using MCUs with different logic levels. Also, it comes equipped with a library containing functions and an example code that can be used as a reference for further development.
Features overview
Development board
6LoWPAN 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 PIC microcontroller, the PIC32MX470F512H from Microchip, a USB connector, LED indicators, buttons, a mikroProg connector, and a header for interfacing with external electronics. Along with this microcontroller, the board also contains a 2.4GHz ISM band transceiver, allowing you to add wireless communication to your target application. Its compact design provides a fluid and immersive working experience, allowing access anywhere
and under any circumstances. Each part of the 6LoWPAN Clicker development kit contains the components necessary for the most efficient operation of the same board. In addition to the possibility of choosing the 6LoWPAN 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 for the Clicker board, which is more than enough to operate all onboard and additional modules, or it can power
over two standard AA batteries. 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. 6LoWPAN 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)
512
Silicon Vendor
Microchip
Pin count
64
RAM (Bytes)
131072
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 CDC Click driver.
Key functions:
cdc_write_config
- This function writes configuration data starting from the selected config addresscdc_send_opcode
- This function sends a desired opcode command bytecdc_read_results
- This function reads all results and status registers
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 main.c
* @brief CDC Click example
*
* # Description
* This example demonstrates the use of CDC click board by reading capacitance
* measurements from C3/C2 and C5/C4 ports calculated from pure capacitance ratio
* between those ports and port C1/C0 which is used as external C reference.
*
* The demo application is composed of two sections :
*
* ## Application Init
* Initializes the driver and performs the click default configuration.
*
* ## Application Task
* Starts measurement and reads the results. The results data is displayed on the USB UART.
*
* @note
* For better accuracy and higher measurement range, add 200pF external
* capacitor between C1/C0 ports and set it below as CDC_EXT_CAP_C1_C0_PF macro
* before running the application. This way you will be able to measure capacitance
* in range from 1 to 2000pF.
*
* @author Stefan Filipovic
*
*/
#include "board.h"
#include "log.h"
#include "cdc.h"
// Settings for reference capacitors
#define CDC_EXT_CAP_C1_C0_PF 0.0f
#define CDC_INT_CAP_PF 10.0f
#define CDC_REF ( CDC_EXT_CAP_C1_C0_PF + CDC_INT_CAP_PF )
static cdc_t cdc;
static log_t logger;
void application_init ( void )
{
log_cfg_t log_cfg; /**< Logger config object. */
cdc_cfg_t cdc_cfg; /**< Click config object. */
/**
* 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.
cdc_cfg_setup( &cdc_cfg );
CDC_MAP_MIKROBUS( cdc_cfg, MIKROBUS_1 );
err_t init_flag = cdc_init( &cdc, &cdc_cfg );
if ( ( I2C_MASTER_ERROR == init_flag ) || ( SPI_MASTER_ERROR == init_flag ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
if ( CDC_ERROR == cdc_default_cfg ( &cdc ) )
{
log_error( &logger, " Default configuration." );
for ( ; ; );
}
log_info( &logger, " Application Task " );
}
void application_task ( void )
{
cdc_results_t results;
cdc_send_opcode ( &cdc, CDC_OPCODE_CDC_START );
Delay_ms ( 200 );
if ( CDC_OK == cdc_read_results ( &cdc, &results ) )
{
log_printf ( &logger, " C1/C0: %.1f pF\r\n",
results.res_0 * CDC_REF - CDC_INT_CAP_PF );
log_printf ( &logger, " C3/C2: %.1f pF\r\n",
results.res_1 * CDC_REF - CDC_INT_CAP_PF );
log_printf ( &logger, " C5/C4: %.1f pF\r\n\n",
results.res_2 * CDC_REF - CDC_INT_CAP_PF );
Delay_ms ( 1000 );
}
}
void main ( void )
{
application_init( );
for ( ; ; )
{
application_task( );
}
}
// ------------------------------------------------------------------------ END