May 01, 2017

TCS230 RGB color sensor with Arduino

   Hello everyone, how is it going? Today post and video is all about the TCS230, a light-to-frequency converter. In order to demonstrate its hability to sense color in RGB (Red, Green, Blue) I have made an Arduino sketch to convert its readings to a WS2812b, Neopixel RGB LED.

Source: Arduino&Cia

   According to TCS230 datasheet its output frequency is up to 600Khz (square wave), with the possibility to reduce it to 20% (120Khz) and 2% (12Khz). It features two inputs (S2 and S3) to binary select which color will be read at the moment (either Red, Green or blue). Its supply voltage is up to 5V (same as Arduino during my tests).
   You can see  below both the schematic diagram of the test (drawn in Fritzing) and the code I used for my Arduino UNO (which is also available here). Notice that the sketch can control a Neopixel (WS2812b) and also send RGB color to the serial monitor of Arduino IDE.

Click the image to enlarge

   The target with this post was to show you that it is possible to identify RGB color "on the cheap", based on a simple color sensor and some Arduino code. The precision of the TCS230 is not great, but it cuts for what we need; its performance could be improved by better controlling room lighting and the quality of those white LEDs as well. 
   Here are the links so that you can buy all components necessary to do this experiment yourself: