The great precision of color measuring is achieved with features such as the IR blocking filter which reduces the influence of the IR light to non-IR sensing elements, a dedicated IR photosensor, 50/60 Hz noise rejection algorithm, three independent up to 18-bit A/D converters, and very high color sensitivity with the programmable integrator and gain amplifier.In addition to high accuracy and sensitivity, this color sensor also offers a programmable interrupt pin, which can be used to trigger an interrupt on the host MCU. This allows a more efficient controller firmware to be written. Features, such as the high dynamic range, programmable gain and integration time, a very high sensitivity, a flexible interrupt engine, and more, make it a very convenient solution for LED lighting color management, TFT display color correction, display color correction on mobile devices, and other similar applications that require an accurate color sensing.
How does it work?
Color 9 click utilizes the APDS-9250, an integrated color sensor IC, made by Broadcom. This highly advanced four-channel color sensing device incorporates an IR blocking filter, that is used to block a portion of light in the IR spectrum, which can interfere with the readings of three independent photo-diodes, used to sense red, green and blue components of the light. However, it features an additional IR photo-sensing element, which is used to detect the intensity in the IR range. The IR measurement value can be used as a compensation parameter for the accurate color calculation.
The color intensity sensing is roughly matched to the sensitivity of the human eye, so the sensor is the most sensitive in the range between 500nm and 600nm. The datasheet of the APDS-9250 offers an intensity over the wavelength diagram, so an accurate color calculation can be made in respect to the variable sensitivity of the sensor over the light wavelength.
There are four independent A/D converters which are used to digitize the color intensity in 18-bit resolution. The color and IR conversion results are available at the output registers in MSB/LSB format. Color 9 click communicates with the host MCU over the I2C interface, with its pin routed to the appropriate SCL and SDA pins of the mikroBUS™.
The powerful interrupt engine allows more optimized firmware for the controller (MCU) to be written. The interrupt engine allows 16-bit values for the upper and lower threshold levels to be defined, as well as the persistence interval during which the event has occurred, before the interrupt is triggered, and more. Also, the user has the possibility to select which channel is included in the interrupt event detection.The APDS-9250 requires a very low number of external components. It requires only pull-up resistors for the I2C bus lines and the INT pin, which is an open-drain interrupt line.
To allow for the best performance and most accurate measurements, the surface of the board and especially the sensor IC itself, should always stay clean and without scratches, as dirt and moisture can alter the light penetration through the filters. In addition, the manufacturer recommends that the angle of incidence stays less than 10° since the sensor IC has an aperture angle (beam width) of nearly 90°. If the angle of incidence is greater than advised, the filter shifting might occur, introducing distortion and affecting the measurement results. The spectral filters of this sensor are specialized for working with the broadband source of light, and measurement of the narrowband light sources should not be performed by this sensor.
The Click board™ is designed to work with 3.3V only. When using it with MCUs that use 5V levels for their communication, a proper level translation circuit should be used.
Specifications
Type |
Optical |
Applications |
This Click board™ is an ideal solution for LED lighting color management, ambient light sensing for display backlight control, TFT display color control, and other similar applications that require an accurate color and ambient light sensing |
On-board modules |
APDS-9250, an integrated color sensor IC, made by Broadcom. |
Key Features |
High dynamic range, high sensitivity, IRCUT filter reduces influence of the IR spectrum, a dedicated IR photo-diode, powerful interrupt engine, sensitive to IR spectrum, programmable gain and integration time, low number of external components required |
Interface |
I2C |
Compatibility |
mikroBUS |
Click board size |
M (42.9 x 25.4 mm) |
Input Voltage |
3.3V |
Pinout diagram
This table shows how the pinout on Color 9 click corresponds to the pinout on the mikroBUS™ socket (the latter shown in the two middle columns).
Notes |
Pin |
|
Pin |
Notes |
---|
|
NC |
1 |
AN |
PWM |
16 |
NC |
|
|
NC |
2 |
RST |
INT |
15 |
INT |
Interrupt |
|
NC |
3 |
CS |
RX |
14 |
NC |
|
|
NC |
4 |
SCK |
TX |
13 |
NC |
|
|
NC |
5 |
MISO |
SCL |
12 |
SCL |
I2C Clock |
|
NC |
6 |
MOSI |
SDA |
11 |
SDA |
I2C Data |
Power Supply |
3.3V |
7 |
3.3V |
5V |
10 |
NC |
|
Ground |
GND |
8 |
GND |
GND |
9 |
GND |
Ground |
Onboard settings and indicators
Label |
Name |
Default |
Description |
---|
LD1 |
PWR |
- |
Power LED Indicator |
Color 9 click electrical specifications
Description |
Min |
Typ |
Max |
Unit |
---|
ADC Resolution |
13 |
- |
18 |
bit |
ADC Integration Time |
2.97 |
3.125 |
3.28 |
ms |
Dark Count |
0 |
- |
3 |
Counts |
Software Support
We provide a library for the Color 9 click on our LibStock page, as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.
Library Description
Library contains generic functions that will allow a user to easily get started with the click board.
Key functions:
uint32_t color9_getGreen()
- Return the value of the green color mesurement.
uint32_t color9_getBlue()
- Return the value of the blue color mesurement.
uint32_t color9_getRed()
- Return the value of the red color mesurement.
Examples description
The application is composed of three sections :
- System Initialization - Initialize GPIO, I2C and LOG structures.
- Application Initialization - Initialize the driver and test if the sensor is present. If the ID read from the sensor is correct execute the initialization procedure./li>
- Application Task - Wait for the color data to be available then read the data and send it to the serial port.
void applicationTask()
{
char txt[20];
uint8_t convComplete;
uint32_t measurementData;
convComplete = color9_gStatusreg();
if( convComplete & 0x08 )
{
convComplete = 0;
mikrobus_logWrite("Ir: ",_LOG_TEXT);
measurementData=color9_getIr();
LongToStr(measurementData,txt);
Ltrim(txt);
mikrobus_logWrite(txt,_LOG_LINE);
mikrobus_logWrite("Green: ",_LOG_TEXT);
measurementData=color9_getGreen();
LongToStr(measurementData,txt);
Ltrim(txt);
mikrobus_logWrite(txt,_LOG_LINE);
mikrobus_logWrite("Blue: ",_LOG_TEXT);
measurementData=color9_getBlue();
LongToStr(measurementData,txt);
Ltrim(txt);
mikrobus_logWrite(txt,_LOG_LINE);
mikrobus_logWrite("Red: ",_LOG_TEXT);
measurementData=color9_getRed();
LongToStr(measurementData,txt);
Ltrim(txt);
mikrobus_logWrite(txt,_LOG_LINE);
mikrobus_logWrite("--",_LOG_LINE);
}
}
The full application code, and ready to use projects can be found on our LibStock page.
Other mikroE Libraries used in the example:
- UART Library
- I2C Library
- Conversions Library
- C_String Library
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.
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.
Resources
Downloads