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
UNI Clicker is a compact development board designed as a complete solution that brings the flexibility of add-on Click boards™ to your favorite microcontroller, making it a perfect starter kit for implementing your ideas. It supports a wide range of microcontrollers, such as different ARM, PIC32, dsPIC, PIC, and AVR from various vendors like Microchip, ST, NXP, and TI (regardless of their number of pins), four mikroBUS™ sockets for Click board™ connectivity, a USB connector, LED indicators, buttons, a debugger/programmer connector, and two 26-pin headers for interfacing with external electronics. Thanks to innovative manufacturing technology, it allows you to build
gadgets with unique functionalities and features quickly. Each part of the UNI Clicker development kit contains the components necessary for the most efficient operation of the same board. In addition to the possibility of choosing the UNI Clicker programming method, using a third-party programmer or CODEGRIP/mikroProg connected to onboard JTAG/SWD header, the UNI Clicker board also includes a clean and regulated power supply module for the development kit. It provides two ways of board-powering; through the USB Type-C (USB-C) connector, where onboard voltage regulators provide the appropriate voltage levels to each component on the board, or using a Li-Po/Li
Ion battery via an onboard battery connector. All communication methods that mikroBUS™ itself supports are on this board (plus USB HOST/DEVICE), including the well-established mikroBUS™ socket, a standardized socket for the MCU card (SiBRAIN standard), and several user-configurable buttons and LED indicators. UNI 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

Type
8th Generation
Architecture
ARM Cortex-M4
MCU Memory (KB)
256
Silicon Vendor
Texas Instruments
Pin count
100
RAM (Bytes)
32768
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