Custom Home Built Color Sensor

Rick Osgood put together a great writeup on how to use the Adafruit TSL2561 digital luminosity / lux / light sensor to create a color light sensor.

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 Lrg

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.

In stock and shipping now!


Have an amazing project to share? The Electronics Show and Tell is every Wednesday at 7:30pm ET! To join, head over to YouTube and check out the show’s live chat and our Discord!

Join us every Wednesday night at 8pm ET for Ask an Engineer!

Join over 38,000+ makers on Adafruit’s Discord channels and be part of the community! http://adafru.it/discord

CircuitPython – The easiest way to program microcontrollers – CircuitPython.org


New Products – Adafruit Industries – Makers, hackers, artists, designers and engineers! — New Products 11/15/2024 Featuring Adafruit bq25185 USB / DC / Solar Charger with 3.3V Buck Board! (Video)

Python for Microcontrollers – Adafruit Daily — Python on Microcontrollers Newsletter: A New Arduino MicroPython Package Manager, How-Tos and Much More! #CircuitPython #Python #micropython @ThePSF @Raspberry_Pi

EYE on NPI – Adafruit Daily — EYE on NPI Maxim’s Himalaya uSLIC Step-Down Power Module #EyeOnNPI @maximintegrated @digikey

Adafruit IoT Monthly — The 2024 Recap Issue!

Maker Business – Adafruit Daily — Apple to build another chip at TSMC Arizona

Electronics – Adafruit Daily — SMT Tip – Stop moving around!

Get the only spam-free daily newsletter about wearables, running a "maker business", electronic tips and more! Subscribe at AdafruitDaily.com !


No Comments

No comments yet.

Sorry, the comment form is closed at this time.