Color Sensor

Similiar to ambient light sensors, color sensors are responsive to light, however they are typically manufactured to only capture red, green, and blue light though some models are responsive to all visible light. MetaEnvironment boards come equipped with a TCS34725 color sensor, accessed through the ColorTcs34725 interface.

import com.mbientlab.metawear.module.ColorSensorTcs34725;

final ColorSensorTcs34725 colorSensor = board.getModule(ColorSensorTcs34725.class);


The color sensor has 2 configurable parameters that affect the data range, resultion, and sensitivity.

Parameter Description
Gain Analog signal scale
Integration Time Amount of time spent to aggregate adc values

There is also a white illuminator LED next to the sensor that can be used to provide additional light if the surrounding area is too dark.

import com.mbientlab.metawear.module.ColorSensorTcs34725.Gain;

// set gain to 4x, integration time to 4.8ms,
// keep illuminator led off

ADC Values

The red, green, blue, and clear ADC values measured by the TCS3472 device are represented by the ColorAdc class and is classified as a forced data producer.

import com.mbientlab.metawear.module.ColorTcs34725;
import com.mbientlab.metawear.module.ColorTcs34725.ColorAdc;

final ColorTcs34725 colorSensor= mwBoard.get(ColorTcs34725.class);
colorDetector.adc().addRouteAsync(new RouteBuilder() {
    public void configure(RouteComponent source) { Subscriber() {
            public void apply(Data data, Object ... env) {
                Log.i("MainActivity", "color adc = " + data.value(ColorAdc.class).toString());
}).continueWith(new Continuation<Route, Void>() {
    public Void then(Task<Route> task) throws Exception {
        return null;