How does it work?
Color 15 Click as its foundation uses the CLS-16D24-44-DF8/TR8, a digital I2C compatible interface color light sensor from Everlight Electronics. It supports parallel output for Red, Green, Blue, White and Infrared light (R, G, B, W, IR) and converts them to a 16-bit digital value (0-65535). This sensor is characterized by high resolution designed to reject IR in light sources allowing the device to operate in environments from sunlight to dark rooms, with a maximum detection lux of 204.679lux. Besides, an integrated ADC rejects 50Hz and 60Hz flickers caused by artificial light sources. It also has stable performance over a wide temperature range of -40°C to 65°C, suitable for measuring the present color light.
The CLS-16D24-44-DF8/TR8 does not require a specific Power-Up sequence but requires a voltage of 1.8V for its interface and logic part to work correctly. Therefore, a small regulating LDO is used, the MAX8511, providing a 1.8V out of both 5V and 3.3V mikroBUS™ power rails.
Color 15 Click communicates with MCU using the standard I2C 2-Wire interface with a maximum clock frequency of 400kHz, fully adjustable through software registers. Since the sensor for operation requires a power supply of 3.3V, this Click board™ also features the PCA9306 and SN74LVC1T45 voltage-level translators. The I2C interface bus lines are routed to the voltage-level translators allowing this Click board™ to work with both 3.3V and 5V MCUs properly. Also, it uses an interrupt pin, the INT pin of the mikroBUS™ socket, used when an interrupt occurs to alert the system when the color result crosses upper or lower threshold settings.
This Click board™ can operate with both 3.3V and 5V logic voltage levels selected via the VCC SEL jumper. This way, it is allowed for both 3.3V and 5V capable MCUs to use the communication lines properly. However, the Click board™ comes equipped with a library that contains easy-to-use functions and an example code that can be used, as a reference, for further development.
Specifications
Type
Color Sensing,Optical
Applications
Can be used for automatic residential and commercial lighting management, contrast enhancement, detection of ambient for backlight control, and more
On-board modules
CLS-16D24-44-DF8/TR8 – color light sensor from Everlight Electronics
Key Features
Low power consumption, parallel output for red, green, blue, white and infrared, high resolution and sensitivity, works well under different light source conditions, programmable interrupt, and more
Interface
I2C
Feature
No ClickID
Compatibility
mikroBUS™
Click board size
S (28.6 x 25.4 mm)
Input Voltage
3.3V or 5V
Pinout diagram
This table shows how the pinout on Color 15 Click corresponds to the pinout on the mikroBUS™ socket (the latter shown in the two middle columns).
Onboard settings and indicators
Label | Name | Default | Description |
---|---|---|---|
LD1 | PWR | – | Power LED Indicator |
JP1 | VCC SEL | Left | Logic Level Voltage Selection 3V3/5V: Left position 3V3, Right position 5V |
Color 15 Click electrical specifications
Description | Min | Typ | Max | Unit |
---|---|---|---|---|
Supply Voltage | 3.3 | – | 5 | V |
Peak Wavelength (R/G/B) | 610/550/470 | nm | ||
Resolution | 10 | – | 16 | bits |
Operating Temperature Range | -40 | +25 | 65 | °C |
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.
Key functions
-
color15_get_data
This function reads data from 5 channels (Red, Green, Blue, White, IR). -
color15_rgbw_to_hsl
This function converts RGBW (red, green, blue, white) to HSL (hue, saturation, lightness) color value. -
color15_get_color
This function returns the color name flag from the input HSL color.
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.
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, "rn Hue: %.1f degrn", hsl.hue );
log_printf ( &logger, " Saturation: %.1f %%rn", hsl.saturation );
log_printf ( &logger, " Lightness: %.1f %%rn", hsl.lightness );
switch ( color15_get_color ( &hsl ) )
{
case COLOR15_RED_COLOR:
{
log_printf( &logger, " Color: REDrn" );
break;
}
case COLOR15_YELLOW_COLOR:
{
log_printf( &logger, " Color: YELLOWrn" );
break;
}
case COLOR15_GREEN_COLOR:
{
log_printf( &logger, " Color: GREENrn" );
break;
}
case COLOR15_CYAN_COLOR:
{
log_printf( &logger, " Color: CYANrn" );
break;
}
case COLOR15_BLUE_COLOR:
{
log_printf( &logger, " Color: BLUErn" );
break;
}
case COLOR15_MAGENTA_COLOR:
{
log_printf( &logger, " Color: MAGENTArn" );
break;
}
case COLOR15_WHITE_COLOR:
{
log_printf( &logger, " Color: WHITErn" );
break;
}
case COLOR15_BLACK_COLOR:
{
log_printf( &logger, " Color: BLACKrn" );
break;
}
default:
{
log_printf( &logger, " Color: UNKNOWNrn" );
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.
mikroSDK
This Click board™ is supported with mikroSDK – MikroElektronika Software Development Kit. To ensure proper operation of mikroSDK compliant Click board™ demo applications, mikroSDK should be downloaded from the LibStock and installed for the compiler you are using.
For more information about mikroSDK, visit the official page.