How does it work?
Color 4 Click is based on the VEML6040, an advanced RGB/ambient light sensor from Vishay Semiconductors, that provides fast and accurate spectral measurements. It is based on the Filtron™ technology achieving the closest ambient light spectral sensitivity to real-human eye responses. The VEML6040 senses red, green, blue, and white light and processes those signals using a CMOS signal conditioning circuit. This digital RGBW information can be used in feedback control systems, among other things, to monitor and actively control a light source.
This Click board™ detects light intensity under multiple lighting conditions and through different attenuation materials, including dark glass. The VEML6040 provides a selectable measurement range from 515.4lx up to 16.496lx with the highest sensitivity of 0.007865lx/step. Its peak sensitivities for red, green, and blue are 645nm, 575nm, and 460nm, respectively. Moreover, it provides excellent temperature compensation, keeping the output stable under changing temperatures.
Color 4 Click communicates with MCU using the standard I2C 2-Wire interface to read data and configure settings, supporting Standard Mode operation with a clock frequency of 100kHz and Fast Mode up to 400kHz. The VEML6040 contains one configuration register (00h) used for operation control and parameter setup. Its measurement results are stored in four separate registers, each for red, green, blue, and white, with addresses from 08h to 0Bh, respectively. All registers are 16-bit wide.
This Click board™ can be operated only with a 3.3V logic voltage level. The board must perform appropriate logic voltage level conversion before using MCUs with different logic levels. However, the Click board™ comes equipped with a library containing functions and an example code that can be used as a reference for further development.
Specifications
Type
Color Sensing
Applications
Can be used for industrial, mechanical, and consumer applications
On-board modules
VEML6040 – advanced RGB/ambient light sensor from Vishay Semiconductors
Key Features
Integrated RGBW and signal conditioning, Filtron™ technology provides real-human eye responses, supports low transmittance (dark) lens, high resolution, selectable detection range, high sensitivity, I2C interface, and more
Interface
I2C
Feature
ClickID
Compatibility
mikroBUS™
Click board size
S (28.6 x 25.4 mm)
Input Voltage
3.3V
Pinout diagram
This table shows how the pinout on Color 4 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 |
Color 4 Click electrical specifications
Description | Min | Typ | Max | Unit |
---|---|---|---|---|
Supply Voltage | – | 3.3 | – | V |
Spectral Response | 515.4 | – | 16.496 | lx |
Sensitivity | – | 0.007865 | – | lx/step |
Peak Wavelength (R/G/B) | – | 645/575/460 | – | nm |
Resolution | – | 16 | – | bit |
Software Support
We provide a library for the Color 4 Click as well as a demo application (example), developed using Mikroe compilers. The demo can run on all the main Mikroe development boards.
Package can be downloaded/installed directly from NECTO Studio Package Manager (recommended), downloaded from our LibStock™ or found on Mikroe github account.
Library Description
This library contains API for Color 4 Click driver.
Key functions
-
color4_set_config
Color 4 set configuration function. -
color4_get_color_data
Color 4 get color data function. -
color4_get_ambient_light
Color 4 get ambient light level function.
Example Description
This library contains API for the Color 4 Click driver. This driver provides the functions for the sensor configuration and for reading RGBW and ambient light data from device. This example displays RGBW data, Ambient light level, CCT data and the light color names.
void application_task ( void )
{
if ( COLOR4_OK == color4_get_color_data( &color4, COLOR4_RED, &red_data ) )
{
log_printf( &logger, " Red: %urn", red_data );
}
if ( COLOR4_OK == color4_get_color_data( &color4, COLOR4_GREEN, &green_data ) )
{
log_printf( &logger, " Green: %urn", green_data );
}
if ( COLOR4_OK == color4_get_color_data( &color4, COLOR4_BLUE, &blue_data ) )
{
log_printf( &logger, " Blue: %urn", blue_data );
}
if ( COLOR4_OK == color4_get_color_data( &color4, COLOR4_WHITE, &white_data ) )
{
log_printf( &logger, " White: %urn", white_data );
}
log_printf( &logger, " - - - - - - - - - - - rn" );
if ( COLOR4_OK == color4_get_ambient_light( &color4, &ambient_light ) )
{
log_printf( &logger, " ALS lux level: %.2frn", ambient_light );
}
if ( COLOR4_OK == color4_get_cct( &color4, &cct ) )
{
log_printf( &logger, " CCT: %.2frn", cct );
}
log_printf( &logger, " - - - - - - - - - - - rn" );
display_color();
log_printf( &logger, " ----------------------rn" );
Delay_ms( 1000 );
}
The full application code, and ready to use projects can be installed directly from NECTO Studio Package Manager (recommended), downloaded from our LibStock™ or found on Mikroe github account.
Other Mikroe Libraries used in the example:
- MikroSDK.Board
- MikroSDK.Log
- Click.Color4
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 Mikroe compilers.
mikroSDK
This Click board™ is supported by a mikroSDK – Mikroe Software Development Kit. To ensure proper operation of mikroSDK compliant Click board™ demo applications, mikroSDK should be downloaded from LibStock and installed for the compiler you are using.
For more information about mikroSDK, visit the official page.