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 (139244 times)
  2. FAT32 Library (71743 times)
  3. Network Ethernet Library (57115 times)
  4. USB Device Library (47428 times)
  5. Network WiFi Library (43082 times)
  6. FT800 Library (42403 times)
  7. GSM click (29835 times)
  8. mikroSDK (28073 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

IR SENSE Click

Rating:

0

Author: MIKROE

Last Updated: 2024-10-31

Package Version: 2.1.0.16

mikroSDK Library: 2.0.0.0

Category: Temperature & humidity

Downloaded: 260 times

Not followed.

License: MIT license  

This application return the temperature of object.

No Abuse Reported

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

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

Do you want to report abuse regarding "IR SENSE Click".

  • mikroSDK Library 1.0.0.0
  • Comments (0)

mikroSDK Library Blog


IR SENSE Click

IR Sense Click carries the AK9750 quantum-type IR sensor. The Click is designed to run on a 3.3V power supply. It communicates with the target microcontroller over I2C interface, with additional functionality provided by the INT pin on the mikroBUS™ line >

irsense_click.png

Click Product page


Click library

  • Author : MikroE Team
  • Date : Dec 2019.
  • Type : I2C type

Software Support

We provide a library for the IrSense 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 form compilers IDE(recommended way), or downloaded from our LibStock, or found on mikroE github account.

Library Description

This library contains API for IrSense Click driver.

Standard key functions :

  • Config Object Initialization function.

    void irsense_cfg_setup ( irsense_cfg_t *cfg );

  • Initialization function.

    IRSENSE_RETVAL irsense_init ( irsense_t ctx, irsense_cfg_t cfg );

Example key functions :

  • Function write the 8-bit data to the target 8-bit register address of AK9750 sensor on IR Sense Click board.

    void irsense_write_byte ( irsense_t *ctx, uint8_t reg_address, uint8_t write_data );

  • Function read the 8-bit data from the target 8-bit register address of AK9750 sensor on IR Sense Click board.

    uint8_t irsense_read_byte ( irsense_t *ctx, uint8_t reg_address );

  • Function read the 16-bit data from the two target 8-bit register address of AK9750 sensor on IR Sense Click board.

    uint16_t irsense_read_data ( irsense_t *ctx, uint8_t reg_address_low );

Examples Description

This application return the temperature of object.

The demo application is composed of two sections :

Application Init

Initialization driver enables - I2C, enable sensor, set soft reset, set Continuous Mode 0, also write log.


void application_init ( void )
{
    log_cfg_t log_cfg;
    irsense_cfg_t cfg;

    /** 
     * 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.

    irsense_cfg_setup( &cfg );
    IRSENSE_MAP_MIKROBUS( cfg, MIKROBUS_1 );
    irsense_init( &irsense, &cfg );

    log_printf( &logger, "     I2C Driver Init       \r\n"  );
    Delay_ms ( 100 );
    log_printf( &logger, "---------------------------\r\n"  );

    irsense_power_on( &irsense );
    log_printf( &logger, "         Power On          \r\n"  );
    Delay_ms ( 1000 );
    log_printf( &logger, "---------------------------\r\n"  );

    irsense_soft_reset( &irsense );
    log_printf( &logger, "        Soft Reset         \r\n"  );
    Delay_ms ( 1000 );
    log_printf( &logger, "---------------------------\r\n"  );

    irsense_set_mode( &irsense, IRSENSE_ECNTL1_MODE_CONTINUOUS_0 );
    irsense_set_cutoff_frequency( &irsense, IRSENSE_ECNTL1_CUTOFF_FREQUENCY_0_6_Hz );
    log_printf( &logger, "  Set Continuous Mode 0    \r\n"  );
    log_printf( &logger, "Set cutoff frequency 0.6 Hz\r\n"  );
    Delay_ms ( 100 );
    log_printf( &logger, "---------------------------\r\n"  );

    irsense_set_interrupts_reg( &irsense, IRSENSE_EINTEN_IR13_HIGH_INT_DISABLE,
                                         IRSENSE_EINTEN_IR13_LOW_INT_DISABLE,
                                         IRSENSE_EINTEN_IR24_HIGH_INT_DISABLE,
                                         IRSENSE_EINTEN_IR24_LOW_INT_DISABLE,
                                         IRSENSE_EINTEN_DRI_INT_ENABLE );

    log_printf( &logger, " Interrupt Source Setting  \r\n"  );
    log_printf( &logger, "Enable Data Ready Interrupt\r\n"  );
    Delay_ms ( 100 );
    log_printf( &logger, "---------------------------\r\n"  );
    log_printf( &logger, "      IR Sense  Click      \r\n"  );
    log_printf( &logger, "---------------------------\r\n"  );
    log_printf( &logger, "      Observable Area      \r\n"  );
    deg_cel[ 0 ] = 32;
    deg_cel[ 1 ] = 176;
    deg_cel[ 2 ] = 67;
    deg_cel[ 3 ] = 0;
}

Application Task

This is an example which demonstrates the use of IR Sense Click board. Detects the temperature of objects and detects the motion in observable area of the AK9750 sensor. Results are being sent to the Usart Terminal where you can track their changes. All data logs write on usb uart changes for every 1 sec.


void application_task ( void )
{
   if ( irsense_check_available( &irsense ) )
    {
        irsense_get_ir_sense( &irsense, &bottom_area, &left_area, &right_area, &top_area );

        log_printf( &logger, "- - - - - - - - -\r\n" );
        log_printf( &logger, " Bottom : %d \r\n", bottom_area );

        log_printf( &logger, " Left   : %d \r\n", left_area );

        log_printf( &logger, " Top    : %d \r\n", top_area );

        log_printf( &logger, " Right  : %d \r\n", right_area );
        log_printf( &logger, "- - - - - - - - -\r\n" );

        temperature = irsense_get_temperature( &irsense );
        log_printf( &logger, " Temperature: %f \r\n", temperature );
        log_printf( &logger, "---------------------------\r\n" );

        irsense_refresh( &irsense );
        Delay_ms ( 1000 );
    }
}  

The full application code, and ready to use projects can be installed directly form compilers IDE(recommneded) or found on LibStock page or mikroE GitHub accaunt.

Other mikroE Libraries used in the example:

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.IrSense

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

nvSRAM Click

0

nvSRAM Click is a compact add-on board that contains the most reliable nonvolatile memory. This board features the CY14B101J, a 1-Mbit nvSRAM organized as 128K words of 8 bits each with a nonvolatile element in each memory cell from Cypress Semiconductor. The embedded nonvolatile elements incorporate the QuantumTrap technology and provide highly reliable nonvolatile storage of data.

[Learn More]

HOD CAP Click

0

HOD CAP Click is a compact add-on board that adds a smart sensing solution to your application. This board features the AS8579, a capacitive sensor from ams OSRAM. The sensor features I/Q signal demodulation, parasitic influences from cable, and PCB protection. It has ten sense outputs, five of which come with sensing line filter circuits. This Click board™ makes the perfect solution for the development of autonomous driving applications such as hands-on steering wheel detection and detection of any human presence inside a vehicle or outside of the vehicle, e.g., for automatic trunk opener and more.

[Learn More]

ADC 21 Click

0

ADC 21 Click is a compact add-on board that converts an analog voltage into a digital representation. This board features the ADC1283, a low-power, eight-channel pure CMOS 12-bit analog-to-digital converter from STMicroelectronics. The ADC1283 is specified for conversion from 50ksps to 200ksps. Its architecture is based on a successive approximation register with an internal track-and-hold cell. It features eight single-ended multiplexed inputs, where the output serial data is straight binary and SPI-compatible.

[Learn More]