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!