TOP Contributors

  1. MIKROE (2781 codes)
  2. Alcides Ramos (377 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 (139584 times)
  2. FAT32 Library (72044 times)
  3. Network Ethernet Library (57264 times)
  4. USB Device Library (47633 times)
  5. Network WiFi Library (43231 times)
  6. FT800 Library (42569 times)
  7. GSM click (29932 times)
  8. mikroSDK (28313 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

Color 13 Click

Rating:

0

Author: MIKROE

Last Updated: 2024-10-31

Package Version: 2.1.0.15

mikroSDK Library: 2.0.0.0

Category: Optical

Downloaded: 236 times

Not followed.

License: MIT license  

Color 13 Click is a compact add-on board that measures the subtlest changes in light. This board features the APDS-9999, I2C compatible RGB, proximity detector, and vertical-cavity surface-emitting laser (VCSEL) in one optical module from Broadcom Limited.

No Abuse Reported

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

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

Do you want to report abuse regarding "Color 13 Click".

  • Information
  • Comments (0)

mikroSDK Library Blog


Color 13 Click

Color 13 Click is a compact add-on board that measures the subtlest changes in light. This board features the APDS-9999, I2C compatible RGB, proximity detector, and vertical-cavity surface-emitting laser (VCSEL) in one optical module from Broadcom Limited.

color_13_click.png

Click Product page


Click library

  • Author : Luka Filipovic
  • Date : Jun 2021.
  • Type : I2C type

Software Support

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

Standard key functions :

  • color13_cfg_setup Config Object Initialization function.

    void color13_cfg_setup ( color13_cfg_t *cfg );
  • color13_init Initialization function.

    err_t color13_init ( color13_t *ctx, color13_cfg_t *cfg );

Example key functions :

  • color13_get_rgb_ir Read color data from device.

    err_t color13_get_rgb_ir ( color13_t *ctx, color13_color_t *color_data );
  • color13_get_als Read lux data from device.

    err_t color13_get_als ( color13_t *ctx, float *als_data );
  • color13_get_proximity Read proximity data from device.

    err_t color13_get_proximity ( color13_t *ctx, uint16_t *ps_data );

Example Description

This application showcases ability of Click board to read RGB and IR data from device. Also it can be configured to read proximity data and ALS data in lux units.

The demo application is composed of two sections :

Application Init

Initialization of host communication modules (UART, I2C) and additonal pin. Read and check device ID, selects example and configures device for it.


void application_init ( void ) 
{
    log_cfg_t log_cfg;  /**< Logger config object. */
    color13_cfg_t color13_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.
    color13_cfg_setup( &color13_cfg );
    COLOR13_MAP_MIKROBUS( color13_cfg, MIKROBUS_1 );
    err_t init_flag = color13_init( &color13, &color13_cfg );
    if ( I2C_MASTER_ERROR == init_flag ) 
    {
        log_error( &logger, " Application Init Error. " );
        log_info( &logger, " Please, run program again... " );

        for ( ; ; );
    }

    uint8_t temp_data = 0;
    init_flag = color13_generic_read( &color13, COLOR13_REG_PART_ID, &temp_data, 1 );
    log_printf( &logger, " > ID: 0x%.2X\r\n", ( uint16_t )temp_data );

    if ( ( COLOR13_OK != init_flag ) && ( COLOR13_ID != temp_data ) )
    {
        log_error( &logger, " ID" );
        log_info( &logger, " Please, run program again... " );

        for ( ; ; );
    }

    //Select example
    example_type = COLOR13_EXAMPLE_RGB;
    color13_generic_write( &color13, COLOR13_REG_MAIN_CTRL, &example_type, 1 );

    if ( COLOR13_EXAMPLE_PS_LS == example_type )
    {
        //Configure proximity data to 11 bit
        color13_generic_read( &color13, COLOR13_REG_PS_MEASRATE, &temp_data, 1 );
        temp_data |= 0x18;
        color13_generic_write( &color13, COLOR13_REG_PS_MEASRATE, &temp_data, 1 );
    }

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

Application Task

Depending of selected example in task proximity and als data will be read from device, or it will show ADC value for red, green, blue and ir data from device.


void application_task ( void ) 
{
    switch ( example_type )
    {
        case COLOR13_EXAMPLE_PS_LS:
        {
            color13_proximity_als_example( );
            break;
        }
        case COLOR13_EXAMPLE_RGB:
        {
            color13_rgb_example( );
            break;
        }
        default:
        {
            log_error( &logger, " Select example!" );
            break;
        }
    }
    Delay_ms ( 500 );
}

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

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

e Fuse 3 Click

0

eFuse 3 Click is a compact add-on board that contains an electronic eFuse. This board features the NIS6150, a resettable fuse that can significantly enhance the reliability of a USB application from both catastrophic and shutdown failures from ON Semiconductor. It is designed to buffer the load device from the excessive input voltage, which can damage sensitive circuits and protect the input side from reverse currents. It includes an over-voltage clamp circuit that limits the output voltage during transients but doesn’t shut the unit down, allowing the load circuit to continue its operation.

[Learn More]

BarGraph 5 Click

0

BarGraph 5 Click is a compact add-on board designed for visual data representation through LED bargraph displays. This board features three HLMP-2685 red LED bargraph displays from Broadcom Limited, controlled by the TLC5947, a 12-bit PWM LED driver from Texas Instruments. These rectangular red light bars are housed in single-in-line packages, delivering a luminous intensity of 83.4mcd with a peak wavelength of 626nm.

[Learn More]

M-BUS RF 3 Click

0

M-BUS RF 3 Click is a compact add-on board designed for utility metering and various telemetry applications. This board features the Metis-II (2607021183000), an 868MHz radio module from Würth Elektronik. It integrates an MSP430 microcontroller and a CC1125 RF chip-set to ensure efficient data transmission. Key features include a frequency range of 868.3MHz to 869.525MHz, support for the Wireless M-BUS EN13757-4:2013 and Open Metering System (OMS) standards, and communication capabilities up to 1000 meters in line-of-sight conditions. The board also offers energy-saving functionalities such as Wake-On-Radio, an output power of +14dBm output, and AES-128 encryption for secure communication.

[Learn More]