The basic idea to this color sensor is that you can represent almost any color if you know how much red, green, and blue is in the color. The way this sensor will work, is I will have three LEDs. A red, a green, and a blue LED. There will also be a light sensor. The entire thing will need to be surrounded by some kind of dark shield to prevent external light from getting in. The sensor will be pressed against a colored object and first, the red light will turn on. The sensor will take a reading. Then the green light, and then the blue light. This way I can get readings of how much red, green, and blue light is reflected back to the sensor. With this information I should be able to roughly determine the color of the object.
The article is really detailed, including the code, and explanation of how it all works. It is always great to see 3D printed enclosures on projects like this.
TSL2561 digital luminosity / lux / light sensor. The TSL2561 luminosity sensor is an advanced digital light sensor, ideal for use in a wide range of light situations. Compared to low cost CdS cells, this sensor is more precise, allowing for exact lux calculations and can be configured for different gain/timing ranges to detect light ranges from up to 0.1 – 40,000+ Lux on the fly. The best part of this sensor is that it contains both infrared and full spectrum diodes! That means you can separately measure infrared, full-spectrum or human-visible light. Most sensors can only detect one or the other, which does not accurately represent what human eyes see (since we cannot perceive the IR light that is detected by most photo diodes)
The sensor has a digital (i2c) interface. You can select one of three addresses so you can have up to three sensors on one board – each with a different i2c address. The built in ADC means you can use this with any microcontroller, even if it doesn’t have analog inputs. The current draw is extremely low, so its great for low power data-logging systems. about 0.5mA when actively sensing, and less than 15 uA when in powerdown mode.
Of course, we wouldn’t leave you with a datasheet and a “good luck!” – we wrote a detailed tutorial showing how to wire up the sensor, use it with an Arduino and example code that gets readings and calculates lux.
Adafruit publishes a wide range of writing and video content, including interviews and reporting on the maker market and the wider technology world. Our standards page is intended as a guide to best practices that Adafruit uses, as well as an outline of the ethical standards Adafruit aspires to. While Adafruit is not an independent journalistic institution, Adafruit strives to be a fair, informative, and positive voice within the community – check it out here: adafruit.com/editorialstandards
Stop breadboarding and soldering – start making immediately! Adafruit’s Circuit Playground is jam-packed with LEDs, sensors, buttons, alligator clip pads and more. Build projects with Circuit Playground in a few minutes with the drag-and-drop MakeCode programming site, learn computer science using the CS Discoveries class on code.org, jump into CircuitPython to learn Python and hardware together, TinyGO, or even use the Arduino IDE. Circuit Playground Express is the newest and best Circuit Playground board, with support for CircuitPython, MakeCode, and Arduino. It has a powerful processor, 10 NeoPixels, mini speaker, InfraRed receive and transmit, two buttons, a switch, 14 alligator clip pads, and lots of sensors: capacitive touch, IR proximity, temperature, light, motion and sound. A whole wide world of electronics and coding is waiting for you, and it fits in the palm of your hand.
Have an amazing project to share? The Electronics Show and Tell is every Wednesday at 7pm ET! To join, head over to YouTube and check out the show’s live chat – we’ll post the link there.