SKU:RB-02S161 IIC 颜色传感器
来自ALSROBOT WiKi
目录 |
产品概述
IIC颜色传感器使用TCS34725颜色传感器进行颜色识别。TCS34725是一款高性价比的RGB全彩颜色识别传感器,传感器通过光学感应来识别物体的表面颜色。支持红、绿、蓝(RGB)三基色,支持明光感应,可以输出对应的具体数值,帮助您还原颜色本真。
为了提高精度,防止周边环境干扰,我们在传感器上添加了一个镜头罩,有效减少外界杂光干扰传感器,让颜色管理更加准确。板载自带2个高亮LED,可以让传感器在低环境光的情况下依然能够正常使用,实现“补光”的功能。模块采用I2C通信,拥有4P防插反接口,更加便利。
产品参数
基本参数
1.品名:IIC颜色传感器 2.货号:RB-02S161 3.品牌:奥松机器人 4.产地:哈尔滨 5.尺寸:25*40 6.固定孔:M3*2
电气参数
1.接口类型:4P防插反接口 2.信号类型:IIC通讯 3.指示灯: 4.工作电压:5V 5.工作电流:100mA 6.引脚定义: +:电源正极 -:电源负极 SDA:IIC数据端口 SCL:IIC时钟端口 7.扩展接口: LED:两个板载LED控制端口,悬空或高电平点亮,低电平熄灭 INT:中断引脚 8.连接线:4P 传感器连接线 9.检测范围:红、绿、蓝及白光检测 10.工作温度:-40~85℃ 产品尺寸图:
使用方法
example1_Arduino
- 主要硬件
- Arduino UNO 控制器
- 传感器扩展板 V5.0
- IIC 颜色传感器
- USB 数据线
- 硬件连接
- 示例程序
/* Example code for the ALS_TCS34725 breakout library */ /* Connect SCL to analog 5 Connect SDA to analog 4 Connect VDD to 5V DC Connect GROUND to common ground */ #include <Wire.h> #include "ALS_TCS34725.h" ALS_TCS34725 tcs = ALS_TCS34725(TCS34725_INTEGRATIONTIME_700MS, TCS34725_GAIN_1X); void setup(void) { Serial.begin(9600); if (tcs.begin()) { Serial.println("Found sensor"); } else { Serial.println("No TCS34725 found"); while (1); } } void loop(void) { uint16_t r, g, b, c, colorTemp, lux; tcs.getRawData(&r, &g, &b, &c); colorTemp = tcs.calculateColorTemperature(r, g, b); lux = tcs.calculateLux(r, g, b); Serial.print("Color Temp: "); Serial.print(colorTemp, DEC); Serial.print(" K - "); Serial.print("Lux: "); Serial.print(lux, DEC); Serial.print(" - "); Serial.print("R: "); Serial.print(r, DEC); Serial.print(" "); Serial.print("G: "); Serial.print(g, DEC); Serial.print(" "); Serial.print("B: "); Serial.print(b, DEC); Serial.print(" "); Serial.print("C: "); Serial.print(c, DEC); Serial.print(" "); Serial.println(" "); }
- 程序效果
打开 Arduino IDE 自带的串口监视器,将颜色传感器放于不同颜色的表面,可以看到串口监视器中打印不同的数值
example2_Arduino
- 主要硬件
- 硬件连接
- 示例程序
- 程序效果
example_Raspberry Pi
相关资料
- IIC 颜色传感器传感器 datasheet & 示例程序
下载链接:
- 相关资料
[ datasheet]