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 (139250 times)
  2. FAT32 Library (71746 times)
  3. Network Ethernet Library (57120 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 (28074 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

PROXIMITY 7 Click

Rating:

0

Author: MIKROE

Last Updated: 2024-10-31

Package Version: 2.1.0.17

mikroSDK Library: 2.0.0.0

Category: Proximity

Downloaded: 204 times

Not followed.

License: MIT license  

Proximity 7 Click is an advanced proximity and ambient light sensing Click board™. It features the ADPS9930, a digital sensor IC equipped with two photodiodes (PD) and an IR LED, driven by a proprietary LED driver circuit. It allows an accurate proximity detection for a maximum distance of 100mm.

No Abuse Reported

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

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

Do you want to report abuse regarding "PROXIMITY 7 Click".

  • mikroSDK Library 1.0.0.0
  • Comments (0)

mikroSDK Library Blog


PROXIMITY 7 Click

< Proximity 7 Click is an advanced proximity and ambient light sensing Click board™. It features the ADPS9930, a digital sensor IC equipped with two photodiodes (PD) and an IR LED, driven by a proprietary LED driver circuit. It allows an accurate proximity detection for a maximum distance of 100mm. >

proximity7_click.png

Click Product page


Click library

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

Software Support

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

Standard key functions :

  • Config Object Initialization function.

    void proximity7_cfg_setup ( proximity7_cfg_t *cfg );

  • Initialization function.

    PROXIMITY7_RETVAL proximity7_init ( proximity7_t ctx, proximity7_cfg_t cfg );

  • Click Default Configuration function.

    void proximity7_default_cfg ( proximity7_t *ctx );

Example key functions :

  • Get proximity data.

    uint16_t proximity7_get_proximity_data( proximity7_t *ctx )

  • Get lux level.

    float proximity7_get_lux_level( proximity7_t *ctx )

  • Set proximity offset

    uint8_t proximity7_set_proximity_offset( proximity7_t *ctx, uint8_t proximity_offset_magnitude )

Examples Description

This application give us lux level and proximiti data.

The demo application is composed of two sections :

Application Init

Initializes I2C driver and writes basic settings to device registers


void application_init ( void )
{
    log_cfg_t log_cfg;
    proximity7_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.

    proximity7_cfg_setup( &cfg );
    PROXIMITY7_MAP_MIKROBUS( cfg, MIKROBUS_1 );
    proximity7_init( &proximity7, &cfg );

    Delay_ms ( 100 );

    log_printf( &logger, "> > > app init done < < <\r\n" );

}

Application Task

Logs lux level and proximity data


void application_task ( void )
{
    uint8_t write_buffer[ 2 ];
    uint8_t read_buffer[ 1 ] ;
    float lux_level;
    uint16_t proximity;
    uint8_t als_valid;
    uint8_t proximity_valid;

    proximity7_generic_read( &proximity7, PROXIMITY7_STATUS | PROXIMITY7_REPEATED_BYTE, &read_buffer[ 0 ], 1 );

    als_valid = read_buffer[ 0 ] & PROXIMITY7_ALS_VALID_MASK;
    proximity_valid = read_buffer[ 0 ] & PROXIMITY7_PROXIMITY_VALID_MASK;

    if ( ( als_valid != 0 ) && ( proximity_valid != 0 ) )
    {
        log_printf( &logger, " " );

        lux_level = proximity7_get_lux_level( &proximity7 );
        log_printf( &logger, "> > > Lux level   : %f lx\r\n", lux_level );

        proximity = proximity7_get_proximity_data( &proximity7 );
        log_printf( &logger, "> > > Proximity   : %d\r\n", proximity );

        write_buffer[ 0 ] = PROXIMITY7_SPECIAL_FUNCTION | PROXIMITY7_PROXIMITY_AND_ALS_INT_PIN_CLEAR;
        proximity7_generic_write( &proximity7, PROXIMITY7_SPECIAL_FUNCTION | PROXIMITY7_PROXIMITY_AND_ALS_INT_PIN_CLEAR, &write_buffer[ 0 ], 1 );
    }

    Delay_ms ( 300 );
}  

Note

  • When setting LED drive strength please note that if "proximity drive level - PDL" bit in "configuration register" is set to 1, LED drive current values are reduced by 9.
  • When setting wait time note that if "wait long - WLONG" bit is set to 1, time is 12x longer. Therefore if WLONG == 1 set time between 33ms and 8386.56ms.
  • When setting ALS gain note that if "ALS gain level - AGL" bit is set to 1, ALS gains are scaled by 0.16, otherwise, they are scaled by 1.

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

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.



PROXIMITY 7 Click

< Proximity 7 Click is an advanced proximity and ambient light sensing Click board™. It features the ADPS9930, a digital sensor IC equipped with two photodiodes (PD) and an IR LED, driven by a proprietary LED driver circuit. It allows an accurate proximity detection for a maximum distance of 100mm. >

Click image

[Click Product page]( < https://www.mikroe.com/proximity-7-click > )


Click library

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

Software Support

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

Standard key functions :

  • Config Object Initialization function.

    void proximity7_cfg_setup ( proximity7_cfg_t *cfg );

  • Initialization function.

    PROXIMITY7_RETVAL proximity7_init ( proximity7_t ctx, proximity7_cfg_t cfg );

Example key functions :

  • Get proximity data.

    uint16_t proximity7_get_proximity_data( proximity7_t *ctx )

  • Get lux level.

    float proximity7_get_lux_level( proximity7_t *ctx )

  • Set proximity offset

    uint8_t proximity7_set_proximity_offset( proximity7_t *ctx, uint8_t proximity_offset_magnitude )

Examples Description

This application give us lux level and proximiti data.

The demo application is composed of two sections :

Application Init

Initializes I2C driver and writes basic settings to device registers


void application_init ( void )
{
    log_cfg_t log_cfg;
    proximity7_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.

    proximity7_cfg_setup( &cfg );
    PROXIMITY7_MAP_MIKROBUS( cfg, MIKROBUS_1 );
    proximity7_init( &proximity7, &cfg );

    write_buffer[0] = 0x00;
    proximity7_generic_write( &proximity7, PROXIMITY7_ENABLE | PROXIMITY7_REPEATED_BYTE, &write_buffer[0], 1 );

    Delay_ms ( 100 );

    proximity7_set_als_integration_time( &proximity7, 400.0 );
    proximity7_set_proximity_integration_time( &proximity7, 2.73 );
    proximity7_set_wait_time( &proximity7, 2.73 );
    proximity7_set_proximity_pulse_count( &proximity7,8 );

    write_buffer[0] = PROXIMITY7_LED_DRIVE_100mA |
                      PROXIMITY7_PROXIMITY_DIODE_CH1 |
                      PROXIMITY7_PROXIMITY_GAIN_1x |
                      PROXIMITY7_ALS_GAIN_8x;
    proximity7_generic_write( &proximity7, PROXIMITY7_GAIN_CONTROL | PROXIMITY7_REPEATED_BYTE, &write_buffer[0], 1 );

    write_buffer[0] = PROXIMITY7_WAIT_ENA |
                      PROXIMITY7_PROXIMITY_ENA |
                      PROXIMITY7_ALS_ENA |
                      PROXIMITY7_POWER_ON;
   proximity7_generic_write( &proximity7, PROXIMITY7_ENABLE | PROXIMITY7_REPEATED_BYTE, &write_buffer[0], 1 );
    Delay_ms ( 100 );

    log_printf( &logger, "> > > app init done < < <\r\n" );

}

Application Task

Logs lux level and proximity data


void application_task ( void )
{
    proximity7_generic_read( &proximity7, PROXIMITY7_STATUS | PROXIMITY7_REPEATED_BYTE, &read_buffer[0], 1 );

    als_valid = read_buffer[0] & PROXIMITY7_ALS_VALID_MASK;
    proximity_valid = read_buffer[0] & PROXIMITY7_PROXIMITY_VALID_MASK;

    if (als_valid != 0 && proximity_valid != 0)
    {
        log_printf( &logger, " " );

        lux_level = proximity7_get_lux_level( &proximity7 );
        log_printf( &logger, "> > > Lux level   : %f lx\r\n", lux_level );

        proximity = proximity7_get_proximity_data( &proximity7 );
        log_printf( &logger, "> > > Proximity   : %d\r\n", proximity );

        write_buffer[0] = PROXIMITY7_SPECIAL_FUNCTION | PROXIMITY7_PROXIMITY_AND_ALS_INT_PIN_CLEAR;
        proximity7_generic_write( &proximity7, PROXIMITY7_SPECIAL_FUNCTION | PROXIMITY7_PROXIMITY_AND_ALS_INT_PIN_CLEAR, &write_buffer[0], 1 );
    }

    Delay_ms ( 300 );
}  

Note

  • When setting LED drive strength please note that if "proximity drive level - PDL" bit in "configuration register" is set to 1, LED drive current values are reduced by 9.
  • When setting wait time note that if "wait long - WLONG" bit is set to 1, time is 12x longer. Therefore if WLONG == 1 set time between 33ms and 8386.56ms.
  • When setting ALS gain note that if "ALS gain level - AGL" bit is set to 1, ALS gains are scaled by 0.16, otherwise, they are scaled by 1.

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

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

Bluetooth2 Click

0

Bluetooth 2 Click features WT41u, a long range class 1, Bluetooth® 2.1 + EDR module. WT41u is a highly integrated and sophisticated Bluetooth® module, containing all the necessary elements from Bluetooth® radio and a fully implemented protocol stack. Therefore WT41u provides an ideal solution for developers who want to integrate Bluetooth® wireless technology into their design with limited knowledge of Bluetooth® and RF technologies. WT41u optimized for long range applications is available with an integrated chip antenna. By default, the WT41u module is equipped with powerful and easy-to-use iWRAP firmware which enables users to access Bluetooth® functionality with simple ASCII commands delivered to the module over serial interface - it's just like a Bluetooth® modem.

[Learn More]

Radar Click

0

Radar Click is a compact add-on board that alerts you to the presence of an intruder via interpreting the infrared radiation that emanates from their body. This board features the MM5D91-00, a presence detection sensor module that integrates 60GHz mmWave technology that counts the number of people entering or exiting an entrance from Jorjin Technologies Inc. It includes the ARM Cortex-M4F based processor system, 1Tx, 3Rx antenna, and integrated regulator, alongside azimuth and elevation field of view of ±45° and ±40°. Its detection goes up to 10m for macro and 5m for micro motion with environmental-factors immunity such as temperature, wind, sunlight, and dust. This Click board™ is suitable for various presence sensing applications, from office and home to commercial buildings and more.

[Learn More]

RFID 2 click

5

RFID 2 Click is a compact add-on board that contains a stand-alone RFID reader with a built-in antenna easy-to-use for embedded applications. This board features the ID-12LA-SA, an advanced low-cost RFID reader module usable with 38 different tags from ID Innovations.

[Learn More]