| 30,000 | 1 dynamic range |
| 30,000 | 1 dynamic range |
100 lx to 100,000 lx
1 lx to 100,000 lx
-40C to 85C
25.4 x 25.4 x 10 mm (1 x 1 x 0.4 inch)
Applications
| The M5 Stack Color Sensor RGB Unit (TCS3472) is suitable for a wide range of IoT applications, including |
Smart home automation
Industrial automation and quality control
Robotics and machine learning projects
Medical and healthcare devices
Consumer electronics and wearables
By providing a compact, easy-to-use, and high-accuracy color sensor module, the M5 Stack Color Sensor RGB Unit (TCS3472) enables developers to create innovative and reliable IoT solutions.
M5 Stack Color Sensor RGB Unit (TCS3472) DocumentationOverviewThe M5 Stack Color Sensor RGB Unit (TCS3472) is a compact, low-power color sensor module designed for Internet of Things (IoT) applications. It is based on the TCS3472 sensor chip, which provides high-accuracy color and brightness detection. This module is ideal for color recognition, object detection, and ambient light sensing in various IoT projects.Key FeaturesHigh-accuracy color and brightness detection
16-bit color data output (R, G, B, and clear channel)
Adjustable gain and integration time
Low power consumption (< 5mA)
I2C communication interface
Compatible with M5 Stack development boardsPinoutThe M5 Stack Color Sensor RGB Unit (TCS3472) has a standard 6-pin Grove connector for easy connection to M5 Stack development boards. The pinout is as follows:VCC: Power supply (3.3V or 5V)
GND: Ground
SCL: I2C clock line
SDA: I2C data line
INT: Interrupt output (optional)
ADDR: I2C address selection (optional)Code Examples### Example 1: Basic Color Reading (Arduino)This example demonstrates how to read color data from the TCS3472 sensor using an M5 Stack Core development board and the Arduino IDE.
```cpp
#include <Wire.h>#define TCS3472_I2C_ADDRESS 0x29void setup() {
Wire.begin();
Serial.begin(115200);
}void loop() {
uint16_t r, g, b, c;// Read color data from TCS3472
Wire.beginTransmission(TCS3472_I2C_ADDRESS);
Wire.write(0x00); // Command register
Wire.write(0x01); // Enable ADC
Wire.endTransmission();
Wire.requestFrom(TCS3472_I2C_ADDRESS, 8);
r = Wire.read() << 8 | Wire.read();
g = Wire.read() << 8 | Wire.read();
b = Wire.read() << 8 | Wire.read();
c = Wire.read() << 8 | Wire.read();// Print color data to serial console
Serial.print("R: ");
Serial.print(r);
Serial.print(" G: ");
Serial.print(g);
Serial.print(" B: ");
Serial.print(b);
Serial.print(" C: ");
Serial.println(c);delay(500);
}
```
### Example 2: Color-Based Object Detection (MicroPython)This example demonstrates how to use the TCS3472 sensor to detect objects based on their color using an M5 Stack Core development board and MicroPython.
```python
import machine
import utimei2c = machine.I2C(scl=machine.Pin(22), sda=machine.Pin(21))
tcs3472 = machine.I2Cslave(i2c, addr=0x29)while True:
# Read color data from TCS3472
tcs3472.write(b'x00x01') # Enable ADC
utime.sleep_ms(10)
data = tcs3472.read(8)
r = data[0] << 8 | data[1]
g = data[2] << 8 | data[3]
b = data[4] << 8 | data[5]
c = data[6] << 8 | data[7]# Calculate color ratio
ratio = (r + g + b) / c# Detect object based on color ratio
if ratio > 2.5:
print("Object detected (white)")
elif ratio < 1.5:
print("Object detected (dark)")
else:
print("No object detected")utime.sleep_ms(500)
```
Note: These examples are for illustration purposes only and may require modification to suit your specific use case. Ensure proper calibration and tuning of the TCS3472 sensor for accurate color detection.