TOP Contributors

  1. MIKROE (2751 codes)
  2. Alcides Ramos (372 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 (139058 times)
  2. FAT32 Library (71588 times)
  3. Network Ethernet Library (56988 times)
  4. USB Device Library (47330 times)
  5. Network WiFi Library (43006 times)
  6. FT800 Library (42297 times)
  7. GSM click (29764 times)
  8. mikroSDK (27874 times)
  9. PID Library (26858 times)
  10. microSD click (26129 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 15 Click

Rating:

0

Author: MIKROE

Last Updated: 2024-10-31

Package Version: 2.1.0.9

mikroSDK Library: 2.0.0.0

Category: Optical

Downloaded: 136 times

Not followed.

License: MIT license  

Color 15 Click is a compact add-on board representing an accurate color sensing solution. This board features the CLS-16D24-44-DF8/TR8, a low power, high sensitivity, color light sensor from Everlight Electronics. This Click boardâ„¢, with an I2C configurable color sensor, senses red, green, blue, white (RGBW), and infrared light and converts them to digital values. The RGBW sensor is designed to reject IR in light sources allowing the device to operate in environments from sunlight to dark rooms. The integrating ADC rejects 50Hz and 60Hz flickers caused by artificial light sources.

No Abuse Reported

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

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

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

  • Information
  • Comments (0)

mikroSDK Library Blog


Color 15 Click

Color 15 Click is a compact add-on board representing an accurate color sensing solution. This board features the CLS-16D24-44-DF8/TR8, a low power, high sensitivity, color light sensor from Everlight Electronics. This Click board™, with an I2C configurable color sensor, senses red, green, blue, white (RGBW), and infrared light and converts them to digital values. The RGBW sensor is designed to reject IR in light sources allowing the device to operate in environments from sunlight to dark rooms. The integrating ADC rejects 50Hz and 60Hz flickers caused by artificial light sources.

color15_click.png

Click Product page


Click library

  • Author : Stefan Filipovic
  • Date : Apr 2022.
  • Type : I2C type

Software Support

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

Standard key functions :

  • color15_cfg_setup Config Object Initialization function.

    void color15_cfg_setup ( color15_cfg_t *cfg );
  • color15_init Initialization function.

    err_t color15_init ( color15_t *ctx, color15_cfg_t *cfg );
  • color15_default_cfg Click Default Configuration function.

    err_t color15_default_cfg ( color15_t *ctx );

Example key functions :

  • color15_get_data This function reads data from 5 channels (Red, Green, Blue, White, IR).

    err_t color15_get_data ( color15_t *ctx, color15_channels_t *channels );
  • color15_rgbw_to_hsl This function converts RGBW (red, green, blue, white) to HSL (hue, saturation, lightness) color value.

    void color15_rgbw_to_hsl ( color15_t *ctx, color15_channels_t *rgbw, color15_hsl_t *hsl );
  • color15_get_color This function returns the color name flag from the input HSL color.

    uint8_t color15_get_color ( color15_hsl_t *hsl );

Example Description

This example demonstrates the use of Color 15 Click board by reading data from 5 channels and converting them to HSL color and displaying those data as well as the detected color name on the USB UART.

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. */
    color15_cfg_t color15_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.
    color15_cfg_setup( &color15_cfg );
    COLOR15_MAP_MIKROBUS( color15_cfg, MIKROBUS_1 );
    if ( I2C_MASTER_ERROR == color15_init( &color15, &color15_cfg ) ) 
    {
        log_error( &logger, " Communication init." );
        for ( ; ; );
    }

    if ( COLOR15_ERROR == color15_default_cfg ( &color15 ) )
    {
        log_error( &logger, " Default configuration." );
        for ( ; ; );
    }

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

Application Task

Waits for the data ready interrupt, then reads the values of all channels and converts them to HSL color and displays those data as well as the detected color name on the USB UART every 500ms approximately.

void application_task ( void )
{
    // Wait for the data ready interrupt indication
    while ( color15_get_int_pin ( &color15 ) );

    color15_channels_t channels;
    if ( ( COLOR15_OK == color15_clear_interrupt ( &color15 ) ) &&
         ( COLOR15_OK == color15_get_data ( &color15, &channels ) ) )
    {
        color15_hsl_t hsl;
        color15_rgbw_to_hsl ( &color15, &channels, &hsl );
        log_printf ( &logger, "\r\n Hue: %.1f deg\r\n", hsl.hue );
        log_printf ( &logger, " Saturation: %.1f %%\r\n", hsl.saturation );
        log_printf ( &logger, " Lightness: %.1f %%\r\n", hsl.lightness );
        switch ( color15_get_color ( &hsl ) )
        {
            case COLOR15_RED_COLOR:
            {
                log_printf( &logger, " Color: RED\r\n" );
                break;
            }
            case COLOR15_YELLOW_COLOR:
            {
                log_printf( &logger, " Color: YELLOW\r\n" );
                break;
            }
            case COLOR15_GREEN_COLOR:
            {
                log_printf( &logger, " Color: GREEN\r\n" );
                break;
            }
            case COLOR15_CYAN_COLOR:
            {
                log_printf( &logger, " Color: CYAN\r\n" );
                break;
            }
            case COLOR15_BLUE_COLOR:
            {
                log_printf( &logger, " Color: BLUE\r\n" );
                break;
            }
            case COLOR15_MAGENTA_COLOR:
            {
                log_printf( &logger, " Color: MAGENTA\r\n" );
                break;
            }
            case COLOR15_WHITE_COLOR:
            {
                log_printf( &logger, " Color: WHITE\r\n" );
                break;
            }
            case COLOR15_BLACK_COLOR:
            {
                log_printf( &logger, " Color: BLACK\r\n" );
                break;
            }
            default:
            {
                log_printf( &logger, " Color: UNKNOWN\r\n" );
                break;
            }
        }
    }
}

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

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

7-SEG RGB Click

0

7-SEG RGB Click carries a full color single 7 segment digit display. The Click is designed to run on either 3.3V or 5V power supply. It communicates with the target microcontroller over the CS, and PWM pin on the mikroBUS™ line.

[Learn More]

WiFly click - Example

5

WiFly click is the simplest way to add WiFi to your devices. This click features the well-known RN131 802.11 b/g Wi-Fi module from Microchip. The click communicates with the MCU over UART and runs on a 3.3V power supply. It has an onboard ceramic chip antenna and a connector for an external antenna.

[Learn More]

Proximity 18 Click

0

Proximity 18 Click is a compact add-on board that contains a close-range proximity sensing solution. This board features the VCNL3036X01, a high-resolution digital proximity sensor from Vishay Semiconductors. Besides the proximity sensor, the VCNL3036X01 also integrates a mux and a driver for three external LEDs, which are located near the chip on the board, photodiodes, amplifiers, and analog to digital converting circuits into a single chip by CMOS process. It allows absolute distance measurement, whatever the target color and reflectance, providing an accurate range of up to 50cm.

[Learn More]