The TCRT5000 consists of an infrared LED and a phototransistor (that is sensitive to light). This sensor has a coating on it to filter out light that is not within the infrared spectrum to help reduce the chance of environmental interference. It has a on board LM393 and adjustable potentiometer.
You can use the TCRT5000 to detect the color of something on a black to white scale. This is a principle a line following robot can utilize. The different shades change the level of reflected infrared light.
This board have four pins – VCC, GND, D0 and A0.
We supply a working voltage between 3.3v and 5v through the VCC and Ground pins. We receive our sensor data though either of the two remaining pins.
The analogue pin A0 provides a continuous reading in the form of varying voltage, the higher the voltage the more infrared light is being received.
The digital pin on the other hand is either high (on) or low (off). When the board is powered and not enough infrared light is received the digital pin will be high, and when the trigger level set by the potentiometer is passed the digital pin is then set to low.