TOP Contributors

  1. MIKROE (2693 codes)
  2. Alcides Ramos (362 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (112 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 (137949 times)
  2. FAT32 Library (70759 times)
  3. Network Ethernet Library (56444 times)
  4. USB Device Library (46827 times)
  5. Network WiFi Library (42587 times)
  6. FT800 Library (41785 times)
  7. GSM click (29468 times)
  8. mikroSDK (27020 times)
  9. PID Library (26661 times)
  10. microSD click (25797 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 2 click

Rating:

6

Author: MIKROE

Last Updated: 2019-01-04

Package Version: 1.0.0.0

mikroSDK Library: 1.0.0.0

Category: Miscellaneous

Downloaded: 4557 times

Not followed.

License: MIT license  

The Ultrasonic 2 click is an ultrasonic range detection Click board, capable of detecting both near-field and far-field objects. It is equipped with the PGA460, a highly-integrated system-on-chip (SoC), based on SONAR principle.

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "Ultrasonic 2 click" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "Ultrasonic 2 click" changes.

Do you want to report abuse regarding "Ultrasonic 2 click".

  • Information
  • Comments (0)
DOWNLOAD LINK RELATED COMPILER CONTAINS
mikroBasic PRO for ARM
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for AVR
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for dsPIC30/33 & PIC24
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for FT90x
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for PIC
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for PIC32
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for ARM
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for AVR
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for dsPIC30/33 & PIC24
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for FT90x
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for PIC
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for PIC32
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for ARM
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for AVR
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for dsPIC30/33 & PIC24
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for FT90x
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for PIC
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for PIC32
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc

mikroSDK Library Blog

Ultrasonic 2 click

Ultrasonic 2 click

Native view of the Ultrasonic 2 click board.

View full image
Ultrasonic 2 click

Ultrasonic 2 click

Front and back view of the Ultrasonic 2 click board.

View full image

Library Description

The library initializes and defines the UART bus driver and drivers that offer a choice for writing data on UART. The library includes the function for initialization device, TVG, communication, and Thresholds, configuration chip and enabling device. The user also has the function for set Ambient temperature which depends on the speed of sound, the function for reading ultrasonic measurement and device diagnostics.

Key functions:

  • void ultrasonic2_enable(uint8_t state) - Function for enable chip
  • void ultrasonic2_getUltrasonicMeasurement(uint8_t numObj, float *distOUT, uint16_t *widthOUT, uint8_t *ampOUT) - Function for getting ultrasonic measurement
  • void ultrasonic2_getDiagnostics(float *freqOUT, float *periodOUT, float *tempOUT, float *noiceOUT) - Function for reading diagnostics

Examples description

The application is composed of the three sections :

  • System Initialization - Initializes UART module and sets CS and AN pins as OUTPUT
  • Application Initialization - Driver initialization for powering the Click board, chip configuration and reading the sensor diagnosis.
  • Application Task - (code snippet) - Starts measuring and measures the distance of an object every 500 ms.
void applicationTask()
{
    ultrasonic2_startUltrasonicMeasurement(_ULTRASONIC2_DETECT_OBJECT_1);

    for (cnt = 0; cnt < _ULTRASONIC2_DETECT_OBJECT_1; cnt++)
    {
        ultrasonic2_getUltrasonicMeasurement(cnt, &distance, &width, &peak);
        Delay_ms(10);

        distance = distance * 100;
        if(distance < 300)
        {
            FloatToStr(distance, demoText);
            demoText[ 6 ] = 0;
            mikrobus_logWrite(" Distance (cm): ",_LOG_TEXT);
            mikrobus_logWrite(demoText,_LOG_LINE);
        }
    }
    Delay_ms( 500 );
}
  • An additional function is used to store responses.
void UART_RX_ISR()iv IVT_INT_USART3 ics ICS_AUTO
{
    if( RXNE_USART3_SR_bit )
    {
        char tmp = USART3_DR;
        ultrasonic2_getc(tmp);
    }
}
  • Notes: Bear in mind that any change in device initialization drastically changes the workload of the device and its measurement pattern. This library has been made according to Texas Instruments PGA460 chip library.

Other mikroE Libraries used in the example:

  • UART

Additional notes and information

Depending on the development board you are using, you may need USB UART clickUSB 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

BLE TINY click

0

BLE TINY Click is a compact add-on board that provides BLE connectivity for any embedded application. This board features the DA14531, SmartBond TINY module based on the world’s smallest and lowest power Bluetooth 5.1 System-on-Chip (SoC) from Dialog Semiconductor.

[Learn More]

CAN Bus click

0

CAN Bus Click is a compact add-on board that provides a link between the CAN protocol controller and the physical wires of the bus lines in a control area network (CAN). This board features the MAX13054, an industry-standard, high-speed CAN transceiver with extended ±80V fault protection from Maxim Integrated.

[Learn More]

Manometer click

2

Manometer click is an add-on board with a piezoresistive silicon pressure sensor. The onboard Honeywell HSCMAND060PA3A3 module has an industry-leading, extremely high accuracy of ±0.25%FSS BFSL. An absolute pressure range from 0 to 60 PSI makes it suitable for a variety applications.

[Learn More]