Using the TCS3771 family of devices with OpenLPC on lpc1114
TCS3771 and alike are a range of I2C RGB sensors allowing one to read not only light intensity but also it’s color. With a bit of care and consideration, the light intensity can be calculated with quite a precision. They provides red, green, blue, and clear (RGBC) light sensing and proximity detection (when coupled with an external IR LED). They detect light intensity under a variety of lighting conditions and through a variety of attenuation materials.
The device contains a 4 × 4 photodiode array, integrating amplifiers, ADCs, accumulators, clocks, buffers, comparators, a state machine, and an I2C interface. The 4 × 4 photodiode array is composed of red-filtered, green-filtered, blue-filtered, and clear photodiodes – four of each type. Four integrating ADCs simultaneously convert the amplified photodiode currents to a digital value providing up to 16 bits of resolution. Upon completion of the conversion cycle, the conversion result is transferred to the data registers. The transfers are double-buffered to ensure that the integrity of the data is maintained. Communication to the device is accomplished through a fast (up to 400kHz), two-wire I2C serial bus for easy connection to a microcontroller or embedded controller.
This article hooks up a TCS3771 to LPC1114 and provides some explanation and code to read the RGB and C values from the device.