Skip to content

Color Sensor Wireling Tutorial

TinyCircuits Color Sensor Wireling product photo

This tutorial will teach you the basic methods of reading the color temperature, RGB, lux, and clearness values of the area in proximity to the color sensor.

Use this sensor for colorful projects and lighting necessities!

TCS34725 Background
  • The high sensitivity, wide dynamic range, and IR blocking filter make the TCS34725 an ideal color sensor solution for use under varying lighting conditions and through attenuating materials.
  • Common applications include: Verification and sorting, fluid and gas analysis, ambient light sensing or RGB LED for backlight control, light color temperature measurement, etc.
  • Fun fact: It is common practice to have your home lighting measure around 500 lumens
  • This sensor can read a lot of interesting things based on color, light, and so on, but they're not exactly common knowledge things. Here's some background on the readings we'll demonstrate in this tutorial:
    • Color Temperature: The color temperature of an atmosphere is very important to fields like photography and horticulture. Measured in Kelvin for the absolute temperature, the heat of a color is a metric based on colors from a reddish orange, to a white, to a light blue. This range of hues measures the color temperature from cool to hot. There is a helpful table on Wikipedia that shows the color to temperature reading correlation. Since blue is hotter, and the reddish-orange is cooler and that's opposite of what one may initially think, it may help to think about the temperature difference in a blue or orange flame.
    • Lux: The official Merriam Webster definition is: "a unit of illumination equal to the direct illumination on a surface that is everywhere one meter from a uniform point source of one candle intensity or equal to one lumen per square meter." So basically, lux is the amount of light in an area in the proximity of the sensor. Check out the Wikipedia for another helpful table to better understand lux readings put out by the sensor.
    • R, G, B: The redness(R), greenness(G), and the blueness(B) of colors influencing the sensor.
    • Clr: The measured value of clear light. This figure from the datasheet may help explain the relationship between the RGB colors and the Clear value:
Diagram from TCS3472 datasheet showing relationship between RGB and Clear wavelengths.
Technical Details

AMS TCS3472 Color Sensor Specs

  • 16-bit color resolution 
  • I²C Communication Protocol
  • Ambient Light Detection
  • Color Temperature Detection
  • 2.5µA typ. during Sleep Mode
  • 65µA typ. during Wait State


  • Populated for aid in color sensing
  • Can be toggled on/off in Arduino Sketch

TinyDuino Power Requirements

  • Voltage: 3.0V - 5.5V 
  • Current: 2.5uA (Low Power Sleep Mode)

Pins Used

  • A5/SCL - I²C Serial Clock line
  • A4/SDA - I²C Serial Data line


  • 10mm x 10mm (.394 inches x .394 inches)
  • Max Height (from the lower bottom of Wireling to upper top Wireling Connector): 4.30mm (0.17 inches)
  • Weight: 1 gram (.04 ounces)


To interface with any TinyCircuits Arduino board, you will need the Arduino IDE and a Micro USB Cable

There are multiple processor/adapter combinations that can be used with Wirelings. Use the following table to find the combination that works for you.

Processor Adapter
*TinyDuino and USB TinyShield Wireling Adapter TinyShield
*TinyZero Wireling Adapter TinyShield
*TinyScreen+ Wireling Adapter TinyShield
WirelingZero N/A
*RobotZero N/A
Arduino Wireling Arduino Shield
Raspberry Pi Wireling Pi Hat

* These processors have a 32-pin connector and can have multiple Wireling Adapter TinyShields stacked to increase the number of Wireling ports up to a maximum of 32 total Wireling ports.

In order to interface with Wirelings, you'll need the appropriate number of Wireling Cables and the Wireling.h Library (You can download this from GitHub as linked, or from the Library Manager in the Arduino IDE).

You will also need the Color Sensor Wireling and the included example Arduino sketch.

Wireling Code
Port 0

Hardware Assembly

Depending on the development system you choose, you will need to put together a TinyDuino stack using the 32-pin tan connectors, or you will just need to plug in your Wireling to Port 0 using a Wireling Cable. (You can change this port in the included Arduino Sketch using the Wireling.selectPort() function)

NOTE: Be mindful when inserting Wireling Cables - the connector pins inside the 5-pin connectors on Wirelings can be bent when cables are inserted at an angle.

Hardware Assembled

Upload Program

This program prints all the above mentioned sensor values from the TCS3472 sensor to the Serial Monitor. The RGBC values will print out values between 0-65535, the Color Temperature will be within a range of 0-8890 degrees Kelvin, and the Lux value will be between 0-34196.

 * Color Sensor TCS34725 Wireling Tutorial:
 * This program will print the TCS34725 RGB, lux, and clearness values to 
 * the Serial Monitor
 * Note: I²C Address for Wireling board is different than the Adafruit 
 * component, this address change is reflected in the library that
 * should be included with this sketch 
 * Hardware by: TinyCircuits
 * Code by: Laveréna Wienclaw for TinyCircuits
 * Initiated: 11/29/2017 
 * Updated: 12/18/2019

#include <Wire.h>         // For I2C communication with sensor
#include "Adafruit_TCS34725.h"  // The library used for the Color Sensor
#include <Wireling.h>     // For interfacing with Wirelings

/* Initialise with default values (int time = 2.4ms, gain = 1x) */
// Adafruit_TCS34725 tcs = Adafruit_TCS34725();

// Make compatible with all TinyCircuits processors
#if defined(ARDUINO_ARCH_AVR)
  #define SerialMonitorInterface Serial
#elif defined(ARDUINO_ARCH_SAMD)
  #define SerialMonitorInterface SerialUSB

/* Initialise with specific int time and gain values */
Adafruit_TCS34725 tcs = Adafruit_TCS34725(TCS34725_INTEGRATIONTIME_700MS, TCS34725_GAIN_1X);

// Variables to hold the values the sensor reads
uint16_t r, g, b, c, colorTemp, lux;

void setup(void) {

  //The port is the number on the Adapter board where the sensor is attached

  if (tcs.begin()) {
    SerialMonitorInterface.println("Found sensor");
  } else {
    SerialMonitorInterface.println("No TCS34725 found ... check your connections");
    while (1);

  // Turn Wireling LEDs on 

void loop(void) {
  tcs.getRawData(&r, &g, &b, &c);
  colorTemp = tcs.calculateColorTemperature(r, g, b);
  lux = tcs.calculateLux(r, g, b);

  SerialMonitorInterface.print("Color Temp: "); SerialMonitorInterface.print(colorTemp); SerialMonitorInterface.print(" K, ");
  SerialMonitorInterface.print("Lux: "); SerialMonitorInterface.print(lux, DEC); SerialMonitorInterface.print(", ");
  SerialMonitorInterface.print("R: "); SerialMonitorInterface.print(r, DEC); SerialMonitorInterface.print(", ");
  SerialMonitorInterface.print("G: "); SerialMonitorInterface.print(g, DEC); SerialMonitorInterface.print(", ");
  SerialMonitorInterface.print("B: "); SerialMonitorInterface.print(b); SerialMonitorInterface.print(", ");
  SerialMonitorInterface.print("Clr: "); SerialMonitorInterface.print(c, DEC);
  SerialMonitorInterface.println(" ");


// Turn Wireling LEDs on
void LEDon() {

// Turn Wireling LEDs off
void LEDoff() {

The output in the Serial Monitor will look something like this:

Output when directed toward a red surface in a well-lit room


Contact Us

If you have any questions or feedback, feel free to email us or make a post on our forum. Show us what you make by tagging @TinyCircuits on Instagram, Twitter, or Facebook so we can feature it.

Thanks for making with us!