Wiki: Graivty: TCS3430 XYZ Tristimulus Color Sensor - DFRobot


Devices with True Tone technology like Apple iPad Pro, iPhone, and Macs usually feature sensors that measure the ambient light colour and brightness. The device then uses this information to automatically adjust its display, so it can correct white points and illumination based on your environmental lighting in order to render the right kinds of white under any conditions. And XYZ Tristimulus Color Sensor plays an important role in this technology.
TCS3430 features advanced digital ambient light sensing(ALS) and CIE 1931 tristimulus color sensing(XYZ). CIE1931 XYZ Tristimulus model is a kind of standard based on three different human cone cell types. The CIE XYZ color space encompasses all color sensations that are visible to a person with average eyesight. The spectral response of TCS3430 is almost the same as that of human eyes, which can realize the high-precision measurement of illumination and color temperature. What you see is what you measured! The TCS3430 Tristimulus Color Sensor is ideally suited for the use in smartphone applications to improve color measurement and intensity of ambient light conditions. Also, it can be used in scenarios requiring a true-color viewing experience like online shopping(product color matching, reducing the return rate caused by color difference of images and real product).

You can learn more about CIE 1931-XYZ system here:





Board Overview

Board Overview

Num Label Description
1 + Power+
2 - Power-
3 SCL I2C Clock line
4 SDA I2C Data line
5 LED LED Switch



   * @brief  Set the ALS gain 
   * @param  aGain  the value of gain
  void setALSGain(uint8_t aGain);

   * @brief  Set the internal integration time of the  four-channel ADCs
   * @param  aTIme  integration time
  void setIntegrationTime(uint8_t aTime);

   * @brief  get channel 0 value
   * @return  the z data
  uint16_t getZData();

   * @brief  get channel 1 value
   * @return  the y data
  uint16_t getYData();

   * @brief  get channel 2 value
   * @return  the IR1 data 
  uint16_t getIR1Data();

   * @brief  get channel 3 value
   * @return  the x data
  uint16_t getXData();

   * @brief  get channel 3 value
   * @return  the IR2 data
  uint16_t getIR2Data();

Connection Diagram

Connection Diagram

Sample Code 1-Read Data

Read and print the values of XYZ, IR1 and IR2.

 * @file getXYZIRData.ino
 * @brief Detection of XYZ tristimulus and infrared data
 * @copyright  Copyright (c) 2010 DFRobot Co.Ltd (
 * @licence     The MIT License (MIT)
 * @author [yangfeng]<>
 * @version  V1.0
 * @date  2021-01-26
 * @get from
 * @url
#include <DFRobot_TCS3430.h>

DFRobot_TCS3430 TCS3430;
void setup() {

    Serial.println("Please check that the IIC device is properly connected");

void loop() {
  uint16_t XData = TCS3430.getXData();
  uint16_t YData = TCS3430.getYData();
  uint16_t ZData = TCS3430.getZData();
  uint16_t IR1Data = TCS3430.getIR1Data();
  uint16_t IR2Data = TCS3430.getIR2Data();
  String str = "X : " + String(XData) + "    Y : " + String(YData) + "    Z : " +  String(ZData) + "    IR1 : "+String(IR1Data) + "    IR2 : "+String(IR2Data);

Expected Results

Result 1


For any questions, advice or cool ideas to share, please visit the DFRobot Forum.

More Documents

DFshopping_car1.png Get TCS3430 Tristimulus Color Sensor Breakout Board from DFRobot Store or DFRobot Distributor.

Turn to the Top