Colour Detection

COLOUR DETECTION MODULE: TCS320 TCS3200

Technology Robotix Society
AUTONOMOUS ROBOTICS
3 min readJul 2, 2019

--

Introduction

A colour detection module senses the colour of the object in front of it. The module has four LEDs. Light from these diodes gets reflected by the object to reach the colour sensor TCS230. It provides information about the colour by splitting it into the three primary components red, green and blue. The sensor has the ability of high-resolution conversion of light to frequency.

Pin Configuration

The configuration of the sensor on the sensor module is as follows

The pins S0 and S1 are used to scale output frequency. The pins S2 and S3 are used for colour detection. For eg., if we want to detect blue colour, we set S2 and S3 to logic HIGH and LOW respectively.

Working

The LEDs of the module emit white light which on reflection from the coloured objects gives the light of a specified frequency. This light is incident on the array of photodiodes. The colour sensor has an 8x8 array of photodiodes. The output of the photodiodes i.e. current is thus controlled by the frequency of the incident light. The current-to-frequency controller of the sensor generates a square wave corresponding to the current from the photodiodes. Sixteen photodiodes have blue filters, 16 photodiodes have green filters, 16 photodiodes have red filters, and 16 photodiodes are clear with no filters. The four types (colours) of photodiodes are interdigitated to minimize the effect of non-uniformity of incident irradiance. All 16 photodiodes of the same colour are connected in parallel and which type of photodiode the device uses during operation is pin-selectable. The sensor is enabled until the enable pin has a logical low voltage.

Interfacing with uC

Since we know the working and pin configuration, it can be understood that the colour of the object can be detected by using the filters i.e. photodiodes on the sensor corresponding to red, green and blue in a loop to get the RGB value. The enable pin is kept high when the sensor is not in use. The supply voltage should vary between 2.7V and 5.5 V. For interfacing the sensor with ARDUINO UNO, the output of the sensor is measured using pulseIn()function.

Pseudocode

Initialize the frequency variables and define pin numbers

You may use the map function to get values from 0 to 255 which is used to identify the colour in standard RGB format. If the R-value is higher, we can infer that colour has more red in it. The RGB values of colour to be detected should be matched with the output value to know if the required colour is being detected. The values may not match exactly due to physical conditions and hence you need to provide a range of values for the output to vary. You can use any colour picker application to know the correct RGB codes of the desired colour.

For further details, visit our page www.robotix.in

--

--

Technology Robotix Society
AUTONOMOUS ROBOTICS

The hub of all Robotics related activities at IIT Kharagpur and fast becoming the nerve center of Robotics in India.