Colour Sorting Machine using ESP8266 and ThingSpeak

TCS3200 Colour Sensor

TCS3200 is a colour sensor that can detect a wide variety of colours based on their wavelength. It uses a TAOS TCS3200 RGB sensor chip to detect colour frequency. This sensor also contains four white LEDs that light up the object in front of it. The TCS3200 chip has an 8 x 8 array of photodiodes (a total of 64 photodiodes). From these 64 photodiodes, 16 photodiodes have Red filters over them, 16 photodiodes have Green filters, 16 photodiodes have Blue filters, and the remaining 16 photodiodes are clear with No filters.

In this module, 16 photodiodes of the same colour are connected in parallel. The control pins S2 and S3 are used to select the array of photodiodes. For example, we can read the red colour photodiodes by setting the S2 and S3 to the low logic level. The complete table is given below:

S2

S3

Photodiode Type

0

0

Red

0

1

Blue

1

0

Clear

1

1

Green

 

The remaining two control pins i.e. S0 and S1 are used for scaling the output frequency. The output frequency can be scaled to three different preset values of 2%, 20%, or 100%. The pin logic for setting the output frequency is given in the below table:

S0

S1

Output Frequency

0

0

Power Down

0

1

2%

1

0

20%

1

1

100%

Specifications of TCS3200 RGB Colour Sensor:

Before proceeding further, let’s cover up the specification of this module. This module has a working voltage of 3V to 5V which means it can be directly interfaced with any microcontroller, and that is why it’s a perfect choice for our NodeMCU, which uses a 3.3V logic level. Other than power and ground, it has an enable pin E0, by pulling it low or high, we can disable or enable the chip. The OUT pin is used to provide the output frequency, the S0 and S1 select lines select the output frequency scaling. The S2 and S3 select lines select the photodiode type. After measuring a colour wavelength, it outputs the result as frequency, so we can directly measure the frequency and determine the colour, which reduces the intervention of an ADC. And finally, this sensor can accurately measure a test object within a distance of 1cm.

Materials Required for Colour Shorting Machine

  • NodeMCU ESP8266 (1)
  • TCS3200 Colour Sensor (1)
  • Servo Motor (2)
  • Jumper Wires
  • Cardboard
  • USB cable for power

 

Circuit Diagram for our Colour Sorting Machine

The circuit diagram for IoT Based Colour Sorting Machine is very simple and doesn’t require complex connections. The Circuit Diagram is given below:

The colour sensor is powered with 3.3V and the servo motors are powered with 5V. PWM pins of both the motors are connected to D2 and D3 pins of NodeMCU. The connections for the colour sensor are given in the below table:

Colour Sensor Pin

NodeMCU Pin

Vcc

3.3V

GND

GND

S0

D4

S1

D5

S2

D6

S3

D7

OUT

D8

OE

GND