color18  2.1.0.0
Main Page

Color 18 click

Color 18 Click is a compact add-on board for accurate ambient light detection and flicker monitoring. This board features the TCS3530, a true color ambient light sensor from ams OSRAM. The TCS3530 features true color XYZ sensing, flicker detection up to 7kHz, and eight concurrent sensing channels with independent gain configurations. It also includes a UV/IR blocking filter for precise light measurements and a unique Click Snap feature, allowing the main sensor area to become movable by breaking the PCB for flexible implementation.

click Product page


Click library

  • Author : Stefan Filipovic
  • Date : Jun 2024.
  • Type : I2C type

Software Support

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

Standard key functions :

Example key functions :

Example Description

This example demonstrates the use of Color 18 click by reading and displaying the values from all 8 modulator channels.

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;
color18_cfg_t color18_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
color18_cfg_setup( &color18_cfg );
COLOR18_MAP_MIKROBUS( color18_cfg, MIKROBUS_1 );
if ( I2C_MASTER_ERROR == color18_init( &color18, &color18_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
if ( COLOR18_ERROR == color18_default_cfg ( &color18 ) )
{
log_error( &logger, " Default configuration." );
for ( ; ; );
}
log_info( &logger, " Application Task " );
}

Application Task

Waits for a data ready interrupt then reads data from all 8 modulator channels and displays the results on the USB UART every 200ms approximately.

void application_task ( void )
{
color18_data_t color_data;
// Wait for a data ready interrupt
while ( color18_get_int_pin ( &color18 ) );
if ( COLOR18_OK == color18_read_data ( &color18, &color_data ) )
{
log_printf ( &logger, "X: %u\r\n", color_data.x );
log_printf ( &logger, "Y: %u\r\n", color_data.y );
log_printf ( &logger, "Z: %u\r\n", color_data.z );
log_printf ( &logger, "IR: %u\r\n", color_data.ir );
log_printf ( &logger, "HgL: %u\r\n", color_data.hgl );
log_printf ( &logger, "HgH: %u\r\n", color_data.hgh );
log_printf ( &logger, "Clear: %u\r\n", color_data.clear );
log_printf ( &logger, "Flicker: %u\r\n\n", color_data.flicker );
}
}

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

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.


color18_read_data
err_t color18_read_data(color18_t *ctx, color18_data_t *data_out)
Color 18 read data function.
color18_data_t::ir
uint16_t ir
Definition: color18.h:326
color18_data_t::flicker
uint16_t flicker
Definition: color18.h:330
color18_default_cfg
err_t color18_default_cfg(color18_t *ctx)
Color 18 default configuration function.
application_task
void application_task(void)
Definition: main.c:65
color18_clear_fifo
err_t color18_clear_fifo(color18_t *ctx)
Color 18 clear fifo function.
COLOR18_ERROR
@ COLOR18_ERROR
Definition: color18.h:378
color18_data_t::clear
uint16_t clear
Definition: color18.h:329
color18_cfg_setup
void color18_cfg_setup(color18_cfg_t *cfg)
Color 18 configuration object setup function.
color18_init
err_t color18_init(color18_t *ctx, color18_cfg_t *cfg)
Color 18 initialization function.
COLOR18_OK
@ COLOR18_OK
Definition: color18.h:377
color18_data_t::z
uint16_t z
Definition: color18.h:325
color18_data_t::x
uint16_t x
Definition: color18.h:323
color18_data_t
Color 18 Click data object.
Definition: color18.h:322
COLOR18_MAP_MIKROBUS
#define COLOR18_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition: color18.h:308
color18_t
Color 18 Click context object.
Definition: color18.h:339
application_init
void application_init(void)
Definition: main.c:29
color18_data_t::hgh
uint16_t hgh
Definition: color18.h:328
color18_get_int_pin
uint8_t color18_get_int_pin(color18_t *ctx)
Color 18 get int pin state function.
color18_data_t::hgl
uint16_t hgl
Definition: color18.h:327
color18_data_t::y
uint16_t y
Definition: color18.h:324
color18_cfg_t
Color 18 Click configuration object.
Definition: color18.h:359