QB105 Color Sensor
1.Product Introduction
The Color Sensor is an optical sensing to recognize the surface color of an object. Support red, green, blue (RGB) three basic colors, support bright light induction, can output the corresponding specific value, restore the actual color. The onboard comes with two bright LEDs, which allows the sensor to use normally in the case of low ambient light, realizing the function of “filling light filling”.
Application reference: Color calibration device, color printer, plotter, etc.
2.Parameter Specification
Parameter |
Value/Representation |
---|---|
Operating voltage |
3.3~5V |
Detection distance |
3-10mm |
Output protocol |
I2C |
Operating temperature |
-30°C~+70°C |
Size |
3.2cm*2.4cm |
3.Wiring Diagram
Hint
Expansion board is attached to esp32 controller board.
Color Sensor |
ESP32 |
---|---|
SCL |
SCL |
SDA |
SDA |
VCC |
5V |
GND |
GND |
4.Sample Code
1#include <ACB_ColorSensor.h>//Import a library of color sensors
2
3#define R "red" //Define the name of the string
4#define G "green"
5#define B "blue"
6
7
8ACB_ColorSensor colorSensor; //Create a sensor object
9
10int red_value; //Store color sensor red light values
11int green_value;//Store color sensor green light values
12int blue_value;//Store color sensor blue light values
13
14void setup() {
15 colorSensor._Init(); //Color sensor initialization
16 Serial.begin(115200);
17}
18
19void loop() {
20 red_value = colorSensor.read(R);
21 green_value = colorSensor.read(G);
22 blue_value = colorSensor.read(B);
23 //Print color value
24 Serial.print("R:");
25 Serial.println(red_value);
26 Serial.print("G:");
27 Serial.println(green_value);
28 Serial.print("B:");
29 Serial.println(blue_value);
30}
5.Test Result
After you successfully connect the line according to the wiring diagram and successfully upload the correct program, please turn on the LED light switch of the color sensor, and then put it on different colors. The serial port monitor will output the data of red, green and blue three primary colors.
6.Related Resources
7.Get One Now
B2B Business: info@acebott.com
Individual buyer: shop on aliexpress