TOP Contributors

  1. MIKROE (2779 codes)
  2. Alcides Ramos (376 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 (139568 times)
  2. FAT32 Library (72041 times)
  3. Network Ethernet Library (57256 times)
  4. USB Device Library (47631 times)
  5. Network WiFi Library (43220 times)
  6. FT800 Library (42566 times)
  7. GSM click (29932 times)
  8. mikroSDK (28292 times)
  9. PID Library (26934 times)
  10. microSD click (26309 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

Ultrasonic 5 Click

Rating:

0

Author: MIKROE

Last Updated: 2024-10-31

Package Version: 2.1.0.6

mikroSDK Library: 2.0.0.0

Category: Miscellaneous

Downloaded: 131 times

Not followed.

License: MIT license  

Ultrasonic 5 Click is a compact add-on board that contains circuits for processing the ultrasonic sensor's output. This board features the TUSS4470, a transformer-drive ultrasonic sensor IC with a logarithmic amplifier from Texas Instruments. In addition to the high selectability of the power supply of the IC itself, this board also allows you to choose between 40kHz and 1MHz operating frequency, with a signal zero crossing comparator as an option. The ultrasonic sensor, the UTR-1440K from PUI Audio, also comes in the same package with this Click board™.

No Abuse Reported

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

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

Do you want to report abuse regarding "Ultrasonic 5 Click".

  • Information
  • Comments (0)

mikroSDK Library Blog


Ultrasonic 5 Click

Ultrasonic 5 Click is a compact add-on board that contains circuits for processing the ultrasonic sensor's output. This board features the TUSS4470, a transformer-drive ultrasonic sensor IC with a logarithmic amplifier from Texas Instruments. In addition to the high selectability of the power supply of the IC itself, this board also allows you to choose between 40kHz and 1MHz operating frequency, with a signal zero crossing comparator as an option. The ultrasonic sensor, the UTR-1440K from PUI Audio, also comes in the same package with this Click board™.

ultrasonic5_click.png

Click Product page


Click library

  • Author : Stefan Filipovic
  • Date : Jun 2023.
  • Type : SPI type

Software Support

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

Standard key functions :

  • ultrasonic5_cfg_setup Config Object Initialization function.

    void ultrasonic5_cfg_setup ( ultrasonic5_cfg_t *cfg );
  • ultrasonic5_init Initialization function.

    err_t ultrasonic5_init ( ultrasonic5_t *ctx, ultrasonic5_cfg_t *cfg );
  • ultrasonic5_default_cfg Click Default Configuration function.

    err_t ultrasonic5_default_cfg ( ultrasonic5_t *ctx );

Example key functions :

  • ultrasonic5_clear_io1_pin This function clears the IO1 pin to low logic state.

    void ultrasonic5_clear_io1_pin ( ultrasonic5_t *ctx );
  • ultrasonic5_pwm_start This function starts the PWM module output.

    err_t ultrasonic5_pwm_start ( ultrasonic5_t *ctx );
  • ultrasonic5_read_an_pin_voltage This function reads results of AD conversion of the AN pin and converts them to proportional voltage level.

    err_t ultrasonic5_read_an_pin_voltage ( ultrasonic5_t *ctx, float *data_out );

Example Description

This example demonstrates the use of Ultrasonic 5 Click board by reading the measurements from the connected ultrasonic sensor and displaying it on a Serial Plot.

The demo application is composed of two sections :

Application Init

Initializes the driver and performs the Click default configuration.


void application_init ( void )
{
    log_cfg_t log_cfg;  /**< Logger config object. */
    ultrasonic5_cfg_t ultrasonic5_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.
    ultrasonic5_cfg_setup( &ultrasonic5_cfg );
    ULTRASONIC5_MAP_MIKROBUS( ultrasonic5_cfg, MIKROBUS_1 );
    if ( ULTRASONIC5_OK != ultrasonic5_init( &ultrasonic5, &ultrasonic5_cfg ) )
    {
        log_error( &logger, " Communication init." );
        for ( ; ; );
    }

    if ( ULTRASONIC5_OK != ultrasonic5_default_cfg ( &ultrasonic5 ) )
    {
        log_error( &logger, " Default configuration." );
        for ( ; ; );
    }

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

Application Task

Performs a burst generation which starts the measurement and then reads the next 200 ADC samples and displays the results on the USB UART (SerialPlot).

void application_task ( void )
{
    float voltage = 0;
    // Burst generation / Start measurement
    ultrasonic5_set_duty_cycle ( &ultrasonic5, ULTRASONIC5_DEF_DYTY );
    ultrasonic5_pwm_start( &ultrasonic5 );
    ultrasonic5_clear_io1_pin ( &ultrasonic5 );
    Delay_500us ( );
    ultrasonic5_set_io1_pin ( &ultrasonic5 );
    ultrasonic5_pwm_stop( &ultrasonic5 );
    // Read and log the next 200 ADC samples which we will plot on a Serial Plotter
    for ( uint16_t cnt = 0; cnt < 200; cnt++ )
    {
        if ( ULTRASONIC5_OK == ultrasonic5_read_an_pin_voltage ( &ultrasonic5, &voltage ) ) 
        {
            log_printf( &logger, "%.3f\r\n", voltage );
        }
    }
}

Note

In order to get valid measuremets a proper ultrasonic sensor must be connected to OUTA and OUTB. We have used an UTR-1440K-TT-R sensor for the test. We recommend using the SerialPlot tool for data visualizing. Refer to the datasheet "Application Curves" section in order to check and compare the results from the plotter.

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

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

Brushless 21 Click

0

Brushless 21 Click is a compact add-on board suitable for controlling brushless DC (BLDC) motors with any MCU. This board features the AMT49400, an advanced 3-phase, sensorless BLDC motor driver with integrated power MOSFETs from Allegro Microsystems. The AMT49400 is rated for an operating voltage range from 4V to 16V. Motor rotation speed is controlled by applying a duty cycle command to the PWM input, while a simple I2C interface is provided for setting motor-rated voltage, rated current, rated speed, resistance, and startup profiles.

[Learn More]

DIGI POT 14 Click

0

DIGI POT 14 Click is a compact add-on board that contains a digitally controlled potentiometer. This board features the TPL0102, a dual-channel digital potentiometer with non-volatile memory from Texas Instruments. It is a 100K resistance end-to-end potentiometer with a 256-position resolution, where the wiper position can be stored in EEPROM. It can operate from both 3.3V and 5V power supplies and provides a typical 92ppm/ºC end-to-end nominal resistance temperature coefficient and only 4ppm/ºC ratiometric.

[Learn More]

VCP Monitor 3 Click

0

VCP Monitor 3 Click is a high precision Voltage, Current and Power measurement Click board™ with an input capable of taking up to 15V. It features the LTC2947, from Analog Devices, a high precision power and energy monitor with an internal sense resistor supporting up to ±30A.

[Learn More]