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
- Arduino
- ESP32/ESP8266
- Microbit
- ACECode
- Explorer Series
QE001 IOT Smart Home Starter Kit for ESP32 (Easy-Plug)
QE002 IOT Smart Farm Starter Kit for ESP32 (Easy-Plug)
QE004 IOT Smart Home Basic Starter Kit for ESP32
QE005-QE006 IOT Smart Home Basic Starter Kit for micro:bit
QE007 IOT Smart Home Starter Kit for ESP32
QE010 IOT Smart Farm Starter Kit for ESP32
QD001 Smart Car Starter Kit for ESP32 - STEM Education Series
- Inventor Series
- ESP32/ESP8266
- Arduino
- Microbit
- Sensor
QB002/QB071 DHT11 Sensor
QB003 Temperature Sensor
QB005/QB068 Photoresistor Sensor
QB039/QB079 Sound Sensor
QB040/QB073 Moisture Sensor
QB041/QB066 PIR Motion Sensor
QB042/QB093 Ultrasonic Sensor
QB043/QB069 Raindrop Sensor
QB050 Photoelectric Sensor
QB055/QB084 MQ-4 Gas Sensor
QB011/QB083 Flame Sensor
QB012/QB091 Touch Sensor
QB013/QB070 Vibration Sensor
QB060/QB080 Trace Sensor
QB063/QB092 Water Sensor
QB096 Infrared Obstacle Avoidance Sensor
QB103 Barometric Pressure Sensor
QB104 UV Sensor
QB105 Color Sensor - Module
QB004 Potentiometer Module
QB006/QB074 Laser Module
QB007/QB081 LED Module
QB008/QB076 Relay Module
QB038/QB067 Button Module
QB045/QB075 130 DC Motor Module
QB046/QB087 RFID RC522 I2C Module
QB047 DS1307 Clock Module
QB048 Vibrating Motor Module
QB051/QB090 4-Digit Tube Display Module
QB054 Servo SG90 9G Module 180 Degree
QZ004 RGB LED Strip
QB059 LCD 1602 I2C Module
QB010/QB077 P-Buzzer Module
QB014/QB082 RGB Module
QB062/QB078 Humidifier Module
QB064/QB065 OLED Module
QB001/QB073+QB053 Infrared Remote Control Module
QB098 4×4 Touch Keyboard Module
QB015 Joystick Module
QB061/QB089 MP3 Module
QB095 Traffic Light Module
QB100 4-Button Module
QB101 DC Motor Driver Module
QB102 Charging Module
© Copyright ACEBOTT All Rights Reserved.