TOP Contributors

  1. MIKROE (2784 codes)
  2. Alcides Ramos (387 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (118 codes)
  5. Bugz Bensce (97 codes)
  6. S P (73 codes)
  7. dany (71 codes)
  8. MikroBUS.NET Team (35 codes)
  9. NART SCHINACKOW (34 codes)
  10. Armstrong Subero (27 codes)

Most Downloaded

  1. Timer Calculator (139945 times)
  2. FAT32 Library (72296 times)
  3. Network Ethernet Library (57464 times)
  4. USB Device Library (47771 times)
  5. Network WiFi Library (43396 times)
  6. FT800 Library (42725 times)
  7. GSM click (29999 times)
  8. mikroSDK (28512 times)
  9. PID Library (27003 times)
  10. microSD click (26408 times)
Libstock prefers package manager

Package Manager

We strongly encourage users to use Package manager for sharing their code on Libstock website, because it boosts your efficiency and leaves the end user with no room for error. [more info]

< Back
mikroSDK Library

LDC 2 Click

Rating:

0

Author: MIKROE

Last Updated: 2024-10-31

Package Version: 2.1.0.18

mikroSDK Library: 2.0.0.0

Category: Inductance

Downloaded: 237 times

Not followed.

License: MIT license  

LDC 2 Click is a compact add-on board that measures inductance change which a conductive target causes when it moves into the inductor's AC magnetic field. This board features the LDC1041, inductance-to-digital converter (LDC) for inductive sensing solutions from Texas Instruments.

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "LDC 2 Click" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "LDC 2 Click" changes.

Do you want to report abuse regarding "LDC 2 Click".

  • Information
  • Comments (0)

mikroSDK Library Blog


LDC 2 Click

LDC 2 Click is a compact add-on board that measures inductance change which a conductive target causes when it moves into the inductor's AC magnetic field. This board features the LDC1041, inductance-to-digital converter (LDC) for inductive sensing solutions from Texas Instruments.

ldc2_click.png

Click Product page


Click library

  • Author : Stefan Filipovic
  • Date : Jul 2021.
  • Type : SPI type

Software Support

We provide a library for the LDC2 Click as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.

Package can be downloaded/installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.

Library Description

This library contains API for LDC2 Click driver.

Standard key functions :

  • ldc2_cfg_setup Config Object Initialization function.

    void ldc2_cfg_setup ( ldc2_cfg_t *cfg );
  • ldc2_init Initialization function.

    err_t ldc2_init ( ldc2_t *ctx, ldc2_cfg_t *cfg );
  • ldc2_default_cfg Click Default Configuration function.

    err_t ldc2_default_cfg ( ldc2_t *ctx );

Example key functions :

  • ldc2_measure_resonance_impedance This function measures the resonance impedance and proximity data.

    err_t ldc2_measure_resonance_impedance ( ldc2_t *ctx, uint8_t *prox_data, float *rp_data );
  • ldc2_measure_inductance This function measures the inductance and sensor frequency.

    err_t ldc2_measure_inductance ( ldc2_t *ctx, float *freq, float *inductance );
  • ldc2_get_sensor_frequency This function reads and calculates the sensor frequency.

    err_t ldc2_get_sensor_frequency ( ldc2_t *ctx, float *freq );

Example Description

This example demonstrates the use of LDC 2 Click board.

The demo application is composed of two sections :

Application Init

Initializes the driver and configures the Click board.


void application_init ( void )
{
    log_cfg_t log_cfg;      /**< Logger config object. */
    ldc2_cfg_t ldc2_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 );
    Delay_ms ( 100 );
    log_info( &logger, " Application Init " );

    // Click initialization.

    ldc2_cfg_setup( &ldc2_cfg );
    LDC2_MAP_MIKROBUS( ldc2_cfg, MIKROBUS_1 );
    if ( SPI_MASTER_ERROR == ldc2_init( &ldc2, &ldc2_cfg ) )
    {
        log_error( &logger, " Application Init Error. " );
        log_info( &logger, " Please, run program again... " );

        for ( ; ; );
    }

    if ( LDC2_ERROR == ldc2_default_cfg ( &ldc2 ) )
    {
        log_error( &logger, " Default Config Error. " );
        log_info( &logger, " Please, run program again... " );

        for ( ; ; );
    }
    log_info( &logger, " Application Task " );
}

Application Task

Measures the resonance impedance and proximity as well as the inductance and sensor frequency approximately every 200ms and displays all values on the USB UART.


void application_task ( void )
{
    uint8_t prox_data = 0;
    float rp_data = 0;
    float freq = 0;
    float inductance = 0;

    if ( LDC2_OK == ldc2_measure_resonance_impedance( &ldc2, &prox_data, &rp_data ) )
    {
        log_printf( &logger, " Proximity: %u\r\n Resonance Impedance: %.3f kOhm\r\n\n", ( uint16_t ) prox_data, rp_data );
    }

    if ( LDC2_OK == ldc2_measure_inductance( &ldc2, &freq, &inductance ) )
    {
        log_printf( &logger, " Sensor Frequency: %.3f MHz\r\n Inductance: %.6f uH\r\n\n", freq, inductance );
    }

    Delay_ms ( 200 );
}

The full application code, and ready to use projects can be installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.

Other Mikroe Libraries used in the example:

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.LDC2

Additional notes and informations

Depending on the development board you are using, you may need USB UART Click, USB UART 2 Click or RS232 Click to connect to your PC, for development systems with no UART to USB interface available on the board. The terminal available in all MikroElektronika compilers, or any other terminal application of your choice, can be used to read the message.


ALSO FROM THIS AUTHOR

Radiation click

5

Radiation Click is a Click boardâ„¢ based on BG51 radiation sensor from Teviso Sensor Technologies. The function of the BG51 radiation sensor is based on an array of customized PIN diodes.

[Learn More]

Current 6 Click

0

Current 6 Click is a compact add-on board providing a precise and accurate current sensing solution. This board features the MAX40080, a fast-response bi-directional current-sense amplifier from Analog Devices. The device features ultra-low 5uV input offset voltage, very-low 0.2% gain error, and includes an analog-to-digital converter with programmable sample rate and 12-bit resolution featuring I2C compatible interface. It also features a wake-up current-threshold and auto-shutdown mode when the I2C is inactive, both designed to minimize power consumption. The current-shunt monitor can measure voltage signals on common-mode voltages ranging from -0.1V (ground sensing) to 36V, independent of the supply voltage. This Click board™ delivers higher performance to industrial control and automation applications, load and power supplies monitoring, telecom equipment, and many more.

[Learn More]

POT 4 Click

0

POT 4 Click is a compact add-on board with accurate selectable reference voltage output. This board features the PRS11R-425F-S103B1, a high-quality 11mm rotary 10k potentiometer from Bourns. The PRS11R-425F-S103B1 features a small form factor, offers an push-on momentary switch, a flatted shaft style, and a wide operating temperature range. It comes with a high-resolution 12-bit ADC, detecting even the slightest move while digitizing its position, alongside a rail-to-rail buffering operational amplifier, which provides constant input and output impedance. Besides, the user can process the output signal in analog or digital form.

[Learn More]