CircuitPython module for the TCS34725 color sensor. Ported from the micropython-adafruit-tcs34725 module by Radomir Dopieralski

See examples/ for an example of the usage.

  • Author(s): Tony DiCola, Carter Nelson

Implementation Notes


Software and Dependencies:

class adafruit_tcs34725.TCS34725(i2c, address=41)[source]

Driver for the TCS34725 color sensor.

  • i2c (I2C) – The I2C bus the device is connected to
  • address (int) – The I2C device address. Defaults to 0x29

Quickstart: Importing and using the device

Here is an example of using the TCS34725. First you will need to import the libraries to use the sensor

import board
import adafruit_tcs34725

Once this is done you can define your board.I2C object and define your sensor object

i2c = board.I2C()  # uses board.SCL and board.SDA
sensor = adafruit_tcs34725.TCS34725(i2c)

Now you have access to the color_temperature, lux attributes

temp = sensor.color_temperature
lux = sensor.lux

The active state of the sensor. Boolean value that will enable/activate the sensor with a value of True and disable with a value of False.


Read the RGB color detected by the sensor. Returns an int with 8 bits per channel. Examples: Red = 16711680 (0xff0000), Green = 65280 (0x00ff00), Blue = 255 (0x0000ff), SlateGray = 7372944 (0x708090)


Read the raw RGBC color detected by the sensor. Returns a 4-tuple of 16-bit red, green, blue, clear component byte values (0-65535).


Read the RGB color detected by the sensor. Returns a 3-tuple of red, green, blue component values as bytes (0-255).


The color temperature in degrees Kelvin.


The persistence cycles of the sensor.


The gain of the sensor. Should be a value of 1, 4, 16, or 60.


The Glass Attenuation (FA) factor used to compensate for lower light levels at the device due to the possible presence of glass. The GA is the inverse of the glass transmissivity (T), so \(GA = 1/T\). A transmissivity of 50% gives GA = 1 / 0.50 = 2. If no glass is present, use GA = 1. See Application Note: DN40-Rev 1.0 – Lux and CCT Calculations using ams Color Sensors for more details.


The integration time of the sensor in milliseconds.


True if the interrupt is set. Can be set to False (and only False) to clear the interrupt.


The lux value computed from the color channels.


The minimum threshold value (AIHT register) of the sensor as a 16-bit unsigned value.


The minimum threshold value (AILT register) of the sensor as a 16-bit unsigned value.