Tech Marinade
Uncovering Hidden Innovation in DIY Electronics
Introduction to Color Sensors – ADJD-S311 (Part 2)
by Ryan Sailor ▪ 10.18.2013 Learn

The ADJD-S311 is a chip you can use to easily add color sensing to any project.

In part 1 we reviewed the ADJD-S311 color sensor and set up our breadboard to light an RGB LED with the color detected by the sensor. In this article, we will program our Arduino/Teensy to calibrate the ADJD-S311 and run our program. I will make the assumption that the reader (you) already understands how to program their device of choice.

The Arduino code has two steps: first the sensor is calibrated against a known white surface or object, next the program runs in a loop, converting the sensor readings to values to output to the RGB LED.  Calibration is an important step if you do not want to manually change the sensor’s internal values each time you use the color sensor.  We can easily leave this task to the Arduino, which if coded properly can calibrate the sensor for use in less than a second.  Fortunately, the calibration process is simple and does not require many lines of code.  Let’s get started!

Continue Reading

Share Button
Introduction to Color Sensors – ADJD-S311 (Part 1)
by Ryan Sailor ▪ 9.20.2013 Learn

Color sensors are a great way to connect your project to its environment. Maybe you want to make some mood lighting that complements the color on the television. Or you need a sensor to detect color variations in a product. You could even configure a color sensor to estimate your pulse (through the science of pulse oximetry)!

You might just want to connect a color sensor to an RGB LED and call it a day. A couple months ago, I did exactly that. Certainly this is not the most inspiring use of a color sensor, but it is a great warm-up to more complicated constructions. In this post I share, step by step, how to set up and communicate with the AJDJ-S311 color sensor.


I used an AJDJ-S311 pre-mounted onto a breakout board by the good people at Sparkfun. Unless you want to bother with solder paste, masks, and reflow, I advise getting the breakout board! I want to make this How To very accessible to all levels of tinkerers. That said, I will not include an Arduino tutorial, so “Arduino level” programming knowledge is required. If you need a refresher, check out this tutorial . Once you know how to program “blink.ino”, you are ready to go. Let’s get started.

Continue Reading

Share Button
  • «
  • 1
  • »