TOP Contributors

  1. MIKROE (2762 codes)
  2. Alcides Ramos (374 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (118 codes)
  5. Bugz Bensce (90 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 (139252 times)
  2. FAT32 Library (71751 times)
  3. Network Ethernet Library (57122 times)
  4. USB Device Library (47430 times)
  5. Network WiFi Library (43082 times)
  6. FT800 Library (42403 times)
  7. GSM click (29835 times)
  8. mikroSDK (28078 times)
  9. PID Library (26885 times)
  10. microSD click (26198 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

TFmini Click

Rating:

0

Author: MIKROE

Last Updated: 2024-10-31

Package Version: 2.1.0.7

mikroSDK Library: 2.0.0.0

Category: Adapter

Downloaded: 121 times

Not followed.

License: MIT license  

TFmini Click is an adapter Click board™ used to interface a compatible ToF (Time of Flight) LiDAR sensor with the host MCU. This board features one four positions 1.25mm connector suitable for a TFmini LiDAR module (TFmini Plus and TFmini-S) specially made to measure an object's distance. Depending on the used LiDAR module, it is possible to achieve different measurement ranges and the use of a different serial interface, such as the UART or I2C. This Click board™ is suitable for various industrial environments like pedestrian detection, vehicle testing, and altitude.

No Abuse Reported

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

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

Do you want to report abuse regarding "TFmini Click".

  • Information
  • Comments (0)

mikroSDK Library Blog


TFmini Click

TFmini Click is an adapter Click board™ used to interface a compatible ToF (Time of Flight) LiDAR sensor with the host MCU. This board features one four positions 1.25mm connector suitable for a TFmini LiDAR module (TFmini Plus and TFmini-S) specially made to measure an object's distance. Depending on the used LiDAR module, it is possible to achieve different measurement ranges and the use of a different serial interface, such as the UART or I2C. This Click board™ is suitable for various industrial environments like pedestrian detection, vehicle testing, and altitude.

tfmini_click.png

Click Product page


Click library

  • Author : Stefan Filipovic
  • Date : Nov 2021.
  • Type : UART type

Software Support

We provide a library for the TFmini 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 TFmini Click driver.

Standard key functions :

  • tfmini_cfg_setup Config Object Initialization function.

    void tfmini_cfg_setup ( tfmini_cfg_t *cfg );
  • tfmini_init Initialization function.

    err_t tfmini_init ( tfmini_t *ctx, tfmini_cfg_t *cfg );
  • tfmini_default_cfg Click Default Configuration function.

    err_t tfmini_default_cfg ( tfmini_t *ctx );

Example key functions :

  • tfmini_get_firmware_version This function reads the sensor firmware version.

    err_t tfmini_get_firmware_version ( tfmini_t *ctx, uint32_t *fw_version );
  • tfmini_get_measurement This function reads the output data frame and obtains the distance, strength and temperature values from it.

    err_t tfmini_get_measurement ( tfmini_t *ctx, int16_t *distance, int16_t *strength, float *temperature );
  • tfmini_send_frame This function sends a command frame to the sensor.

    err_t tfmini_send_frame ( tfmini_t *ctx, tfmini_frame_t frame );

Example Description

This example demonstrates the use of TFmini Click board by reading the measurements from the attached TFmini-S or TFmini Plus sensors.

The demo application is composed of two sections :

Application Init

Initializes the driver and the Click board, and reads the firmware version of the attached sensor.


void application_init ( void )
{
    log_cfg_t log_cfg;        /**< Logger config object. */
    tfmini_cfg_t tfmini_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.
    tfmini_cfg_setup( &tfmini_cfg );
    TFMINI_MAP_MIKROBUS( tfmini_cfg, MIKROBUS_1 );
    tfmini_drv_interface_selection ( &tfmini_cfg, TFMINI_DRV_SEL_UART );
    if ( TFMINI_OK != tfmini_init( &tfmini, &tfmini_cfg ) ) 
    {
        log_error( &logger, " Communication init." );
        for ( ; ; );
    }

    if ( TFMINI_OK != tfmini_default_cfg ( &tfmini ) )
    {
        log_error( &logger, " Default configuration." );
        for ( ; ; );
    }

    uint32_t fw_version = 0;
    if ( TFMINI_OK == tfmini_get_firmware_version ( &tfmini, &fw_version ) )
    {
        log_printf( &logger, " FW Version: 0x%.6LX\r\n", fw_version );
    }
    Delay_ms ( 1000 );

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

Application Task

Reads the target distance, signal strength and the internal sensor temperature every 100ms approximately, and displays the results on the USB UART.

void application_task ( void )
{
    int16_t distance = 0, strength = 0;
    float temperature = 0;
    if ( TFMINI_OK == tfmini_get_measurement ( &tfmini, &distance, &strength, &temperature ) ) 
    {
        log_printf( &logger, " Target distance: %d cm\r\n", distance );
        log_printf( &logger, " Signal strength: %d\r\n", strength );
        log_printf( &logger, " Sensor temperature: %.2f C\r\n\n", temperature );
    }
}

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.TFmini

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. UART terminal is available in all MikroElektronika compilers.


ALSO FROM THIS AUTHOR

6DOF IMU 7 Click

0

6DOF IMU 7 Click is based on the ICM-20649, a high-performance, 6-axis MEMS MotionTracking™ IC from TDK Invensense. It is an advanced, integrated microelectromechanical gyroscope and accelerometer sensor (MEMS). This allows very high integration and very small dimensions, at an affordable cost.

[Learn More]

Color 10 Click

0

Color 10 Click is carrying VEML3328 sensor for RGB and IR light sensing as well as the RGB diode incorporated on the board which makes it good color detection device when its combined with a white LED. The VEML3328 sensor senses red, green, blue, clear and IR light by incorporating photodiodes, amplifiers, and analog / digital circuits into a single CMOS chip. With this sensor, the brightness and color temperature of a display backlight can be adjusted based on the ambient light source, and it can differentiate indoor from outdoor lighting environments.

[Learn More]

LR 6 Click

0

LR 6 Click is a compact add-on board designed for ultra-long-distance spread-spectrum communication. This board features the Ra-01S, a LoRa™ wireless radio frequency module from Ai-Thinker Technology, featuring the SX1268 radio chip. This module provides exceptional sensitivity of over -148dBm, a power output of +22dBm, and supports multiple modulation methods, including LoRa™, within the 433MHz frequency band. The board offers robust anti-interference capabilities and low power consumption, making it ideal for applications requiring reliable long-range communication.

[Learn More]