Unlock infinite possibilities with our inductance-to-digital marvel, which effortlessly converts inductance values into digital data, making it a vital component for real-time monitoring, quality control, and system automation
A
A
Hardware Overview
How does it work?
LDC Click is based on the LDC1312-Q1, two-channel, 12-bit inductance to digital converters (LDCs) for inductive sensing solutions from Texas Instruments. This Click board™ is easy to use, requiring only the sensor frequency within 1kHz and 10MHz to begin sensing. It measures the oscillation frequency of an LC resonator and outputs a digital value proportional to frequency. Inductive sensing offers better performance, reliability, and flexibility than competitive technologies at lower cost and power. This board is ideal for exact short-range measurements of conductive targets' position, motion, or composition. Conductive objects in contact with an AC electromagnetic (EM) field will induce field changes that can be detected using a sensor such
as an inductor. Conveniently, an inductor and a capacitor are used to construct an LC resonator, also known as an LC tank, to produce an EM field. In the case of an LC tank, the effect of the field disturbance is an apparent shift in the inductance of the sensor, which can be observed as a shift in the resonant frequency - using this principle, the LDC1312-Q1 works. LDC Click communicates with MCU using the standard I2C 2-Wire interface with a maximum clock frequency of 400kHz. In addition to I2C communication, two GPIO pins connected to the mikroBUS™ socket pins are also used. The SD pin routed to the RST pin of the mikroBUS™ socket, is used to place the LDC1312-Q1 in Shutdown mode, saving current, while the INT pin may be configured as an interrupt
to notify the host MCU of changes in system status. Besides, it also allows the choice of the least significant bit of its I2C slave address by positioning the SMD jumper labeled ADDR SEL to an appropriate position marked as 1 and 0. It also can connect additional external LC sensors, allowing you to replace the provided onboard sensor and solder your own at places marked with COIL1 and COIL2. 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
PIC18F57Q43 Curiosity Nano evaluation kit is a cutting-edge hardware platform designed to evaluate microcontrollers within the PIC18-Q43 family. Central to its design is the inclusion of the powerful PIC18F57Q43 microcontroller (MCU), offering advanced functionalities and robust performance. Key features of this evaluation kit include a yellow user LED and a responsive
mechanical user switch, providing seamless interaction and testing. The provision for a 32.768kHz crystal footprint ensures precision timing capabilities. With an onboard debugger boasting a green power and status LED, programming and debugging become intuitive and efficient. Further enhancing its utility is the Virtual serial port (CDC) and a debug GPIO channel (DGI
GPIO), offering extensive connectivity options. Powered via USB, this kit boasts an adjustable target voltage feature facilitated by the MIC5353 LDO regulator, ensuring stable operation with an output voltage ranging from 1.8V to 5.1V, with a maximum output current of 500mA, subject to ambient temperature and voltage constraints.
Microcontroller Overview
MCU Card / MCU

Architecture
PIC
MCU Memory (KB)
128
Silicon Vendor
Microchip
Pin count
48
RAM (Bytes)
8196
You complete me!
Accessories
Curiosity Nano Base for Click boards is a versatile hardware extension platform created to streamline the integration between Curiosity Nano kits and extension boards, tailored explicitly for the mikroBUS™-standardized Click boards and Xplained Pro extension boards. This innovative base board (shield) offers seamless connectivity and expansion possibilities, simplifying experimentation and development. Key features include USB power compatibility from the Curiosity Nano kit, alongside an alternative external power input option for enhanced flexibility. The onboard Li-Ion/LiPo charger and management circuit ensure smooth operation for battery-powered applications, simplifying usage and management. Moreover, the base incorporates a fixed 3.3V PSU dedicated to target and mikroBUS™ power rails, alongside a fixed 5.0V boost converter catering to 5V power rails of mikroBUS™ sockets, providing stable power delivery for various connected devices.
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 LDC Click driver.
Key functions:
ldc_get_interrupt
- Get interrupt pin statusldc_get_frequency
- Get frequency value calculated for specific channelldc_calculate_inductance
- Calculate inductance relative to frequency
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 LDC Click example
*
* # Description
* This example showcases the ability of the device to detect
* metal objects. It configures a device for reading data from
* channel 0, checks if ID's are OK and reads data when interrupting
* is asserted and logs result.
*
* The demo application is composed of two sections :
*
* ## Application Init
* Initialization of communication modules (I2C, UART) and
* additional pins. Then configures the device for reading data from
* channel 0, and checks if device ID's are correctly read, and
* read the currently set divider.
*
* ## Application Task
* Checks if interrupt pin is asserted, if so reads data from channel 0.
* Calculates and returns the frequency of the sensor. If the frequency
* is greater than 0, then it calculates the inductance of the sensor.
* It will log error and error values if it occurred.
*
* @author Luka Filipovic
*
*/
#include "board.h"
#include "log.h"
#include "ldc.h"
#include "math.h"
static ldc_t ldc;
static log_t logger;
uint16_t divider;
void application_init ( void )
{
log_cfg_t log_cfg; /**< Logger config object. */
ldc_cfg_t ldc_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.
ldc_cfg_setup( &ldc_cfg );
LDC_MAP_MIKROBUS( ldc_cfg, MIKROBUS_1 );
err_t init_flag = ldc_init( &ldc, &ldc_cfg );
if ( I2C_MASTER_ERROR == init_flag )
{
log_error( &logger, " Application Init Error. " );
log_info( &logger, " Please, run program again... " );
for ( ; ; );
}
if ( ldc_default_cfg ( &ldc ) < 0 )
{
log_error( &logger, " Default configuration. " );
for ( ; ; );
}
uint16_t temp_data = 0;
ldc_generic_read( &ldc, LDC_REG_MANUFACTURER_ID, &temp_data );
log_printf( &logger, "> Manufacturer ID: 0x%.4X\r\n", temp_data );
if ( LDC_MANUFACTURER_ID != temp_data )
{
log_error( &logger, " Manufacturer ID. " );
for ( ; ; );
}
ldc_generic_read( &ldc, LDC_REG_DEVICE_ID, &temp_data );
log_printf( &logger, "> Device ID 0x%.4X\r\n", temp_data );
if ( LDC_DEVICE_ID != temp_data )
{
log_error( &logger, " Device ID. " );
for ( ; ; );
}
ldc_generic_read( &ldc, LDC_REG_CLOCK_DIVIDERS_CH0, &temp_data );
divider = temp_data & 0x3FF;
log_info( &logger, " Application Task " );
}
void application_task ( void )
{
if ( !ldc_get_interrupt( &ldc ) )
{
float frequency = 0.0;
float inductance = 0.0;
uint16_t status = 0;
ldc_generic_read( &ldc, LDC_REG_STATUS, &status );
if ( status & LDC_STATUS_DRDY )
{
err_t ret_val = ldc_get_frequency( &ldc, LDC_REG_DATA_CH0, divider, &frequency );
if ( !ret_val )
{
log_printf( &logger, "> Freq[MHz]: %.3f\r\n", frequency );
if ( frequency > 0 )
{
inductance = ldc_calculate_inductance( frequency );
}
log_printf( &logger, "> L[uH]: %.3f\r\n", inductance );
log_printf( &logger, "> ************************\r\n" );
Delay_ms ( 500 );
}
else
{
log_error( &logger, " Reading data: %ld", ret_val );
}
}
}
}
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