Color 7 Click Board
Color 7 Click Board
The Color 7 Click Board™ is a very accurate colour sensing Click Board™ which features the TCS3472 colour light to digital converter with IR filter, from AMS. It contains a 3x4 matrix of photosensitive elements, which can sense red, green, blue and clear light components. Additional IR resistive coating reduces the influence of the IR component of the light spectrum. Four low noise 16-bit ADCs ensure the high dynamic range, making this sensor suitable to be used behind dark glass.
The sensor offers a fast I2C interface for communication with the host MCU. The ability to measure light without the influence of the IR makes this device a good choice for Ambient Light Sensing (ALS).
Software Support
We provide a demo application for the Color 7 Click Board™ 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
The library initializes and defines the I2C bus driver and drivers that offer a choice for writing data in the register. The library includes functions for configuring the chip for measurement, reading one color ratio and light color value. The color value is calculated by converting the RGBC value to HSL value. The user also has the function color7_getColor()
which checks the color of the light.
Key Functions
void color7_writeByte(uint8_t reg, uint8_t _data)
- Functions for write one byte in registerfloat color7_getColorValue()
- Functions for reading the color value in HSL.uint8_t color7_getColor(float color_value)
- Functions for detecting colors.float color7_readColorRatio(uint8_t color)
- Functions for reading the color ratio.
Example Description
The application is composed of three sections:
- System Initialization - Initializes the I2C module.
- Application Initialization - Initializes the driver init and the configuration chip for measurement.
- Application Task - (code snippet) - Reads the light color and checks which color of the light is detected by the sensor. If the light color is detected, the detected color message is logged on the USB-UART.
void applicationTask() { colorValue = color7_getColorValue(); isColor = color7_getColor(colorValue); switch(isColor) { case 1: { mikrobus_logWrite("--- Color: ORANGE ", _LOG_LINE); break; } case 2: { mikrobus_logWrite("--- Color: RED ", _LOG_LINE); break; } case 3: { mikrobus_logWrite("--- Color: PINK ", _LOG_LINE); break; } case 4: { mikrobus_logWrite("--- Color: PURPLE ", _LOG_LINE); break; } case 5: { mikrobus_logWrite("--- Color: BLUE ", _LOG_LINE); break; } case 6: { mikrobus_logWrite("--- Color: CYAN ", _LOG_LINE); break; } case 7: { mikrobus_logWrite("--- Color: GREEN ", _LOG_LINE); break; } case 8: { mikrobus_logWrite("--- Color: YELLOW ", _LOG_LINE); break; } default: { break; } } Delay_100ms(); }
The full application code, and ready to use projects can be found on our Libstock page.
Other MikroElektronika libraries used in the example:
- I2C
- UART
Additional Notes and Information
Depending on the development board you are using, you may need a 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
The Color 7 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.
Color 7 Click Board
Frequently Asked Questions
Have a Question?
Be the first to ask a question about this.