How does it work?
Color 3 Click is based on TCS3771, a color light-to-light digital convertor with proximity sensing from ams AG, providing fast and accurate spectral measurements. The TCS3771 contains a 4×4 photodiode array comprising red-/green-/blue-filtered and clear photodiodes (four of each type), internal amplifiers, ADCs, accumulators, clocks, buffers, comparators, a state machine, and a serial interface. Four integrated ADCs convert the amplified photodiode currents simultaneously to a digital value, providing up to 16 bits of resolution, transferring the result to the data registers, and maintaining data integrity. The TCS3771 has a high sensitivity making this board suitable for operation behind dark glass.
Proximity sensing uses an external light source, the SFH4441, an onboard IR LED from ams AG, to emit light towards the reflective surface, after which the TCS3771 measures the amount of reflected light from an object which is in the light path. A TCS3771‘s internal LED driver provides a software-configurable constant current sink of 12.5mA, 25mA, 50mA, or 100mA of current, alongside programmable proximity LED pulses from 1 to 255. The amount of light detected from a reflective surface is then used to determine an object’s proximity to the sensor.
This Click board™ communicates with MCU using the standard I2C 2-Wire interface to read data and configure settings, supporting a Fast Mode operation up to 400kHz. Besides, it also possesses an interrupt feature, routed to the INT pin of the mikroBUS™ socket, which serves as an alarm or monitoring function to determine whether the color light or proximity values exceed the upper threshold or go below the lower threshold. The user can also configure the persistency of the interrupt pin, which reduces the possibility of false triggers, such as noise or sudden spikes in color light conditions.
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,Optical,Proximity
Applications
Can be used for accurately measuring the subtlest changes in light, color, ambient light, and proximity detection
On-board modules
TCS3771 – color sensing and proximity detection sensor from ams AG
Key Features
RGBC color sensing and proximity detectioIntegrated 4×4 photodiode array, programmable thresholds, interrupt, low power consumption, flexibility, high resolution and sensitivity, and more
Interface
I2C
Feature
No 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 3 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 |
IR1 | IR1 | Populated | Light Source |
Color 3 Click electrical specifications
Description | Min | Typ | Max | Unit |
---|---|---|---|---|
Supply Voltage | – | 3.3 | – | V |
Spectral Range | 300 | – | 1100 | nm |
Peak Wavelength IR LED | – | 950 | – | nm |
ADC Resolution | – | 16 | – | bit |
Software Support
We provide a library for the Color 3 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 3 Click driver.
Key functions
-
Function is used to calculate HSL color.
-
Function is used to figure out dominant color.
-
Function is used to apply default settings.
Example Description
This application return the color of object.
void application_task ( void )
{
color_value = color3_get_color_value( &color3 );
is_color = color3_get_color( color_value );
switch( is_color )
{
case COLOR3_ORANGE_COLOR_FLAG:
{
log_printf( &logger, "--- Color: ORANGErn" );
break;
}
case COLOR3_RED_COLOR_FLAG:
{
log_printf( &logger, "--- Color: REDrn" );
break;
}
case COLOR3_PINK_COLOR_FLAG:
{
log_printf( &logger, "--- Color: PINKrn" );
break;
}
case COLOR3_PURPLE_COLOR_FLAG:
{
log_printf( &logger, "--- Color: PURPLErn" );
break;
}
case COLOR3_BLUE_COLOR_FLAG:
{
log_printf( &logger, "--- Color: BLUErn" );
break;
}
case COLOR3_CYAN_COLOR_FLAG:
{
log_printf( &logger, "--- Color: CYANrn" );
break;
}
case COLOR3_GREEN_COLOR_FLAG:
{
log_printf( &logger, "--- Color: GREENrn" );
break;
}
case COLOR3_YELLOW_COLOR_FLAG:
{
log_printf( &logger, "--- Color: YELLOWrn" );
break;
}
default:
{
break;
}
}
Delay_ms( 300 );
}
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.Color3
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.