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
EasyPIC v8 is a development board specially designed for the needs of rapid development of embedded applications. It supports many high pin count 8-bit PIC microcontrollers from Microchip, regardless of their number of pins, and a broad set of unique functions, such as the first-ever embedded debugger/programmer. The development board is well organized and designed so that the end-user has all the necessary elements, such as switches, buttons, indicators, connectors, and others, in one place. Thanks to innovative manufacturing technology, EasyPIC v8 provides a fluid and immersive working experience, allowing access anywhere and under any
circumstances at any time. Each part of the EasyPIC v8 development board contains the components necessary for the most efficient operation of the same board. In addition to the advanced integrated CODEGRIP programmer/debugger module, which offers many valuable programming/debugging options and seamless integration with the Mikroe software environment, the board also includes a clean and regulated power supply module for the development board. It can use a wide range of external power sources, including a battery, an external 12V power supply, and a power source via the USB Type-C (USB-C) connector.
Communication options such as USB-UART, USB DEVICE, and CAN are also included, including the well-established mikroBUS™ standard, two display options (graphical and character-based LCD), and several different DIP sockets. These sockets cover a wide range of 8-bit PIC MCUs, from the smallest PIC MCU devices with only eight up to forty pins. EasyPIC v8 is an integral part of the Mikroe ecosystem for rapid development. Natively supported by Mikroe software tools, it covers many aspects of prototyping and development 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
PIC
MCU Memory (KB)
48
Silicon Vendor
Microchip
Pin count
28
RAM (Bytes)
3968
Used MCU Pins
mikroBUS™ mapper
Take a closer look
Click board™ Schematic

Step by step
Project assembly
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 );
}
}
int main ( void )
{
/* Do not remove this line or clock might not be set correctly. */
#ifdef PREINIT_SUPPORTED
preinit();
#endif
application_init( );
for ( ; ; )
{
application_task( );
}
return 0;
}
// ------------------------------------------------------------------------ END

































