Demonstration of an IR proximity sensor (model TCRT5000). The blue bulb is the IR LED, and the black bulb is a phototransistor that detects IR light bouncing off objects close enough to the component. The phototransistor's output is connected to the Arduino analog input pin, with a pull-up resistor. The Arduino sketch determines, based on this input's value, whether to turn on the red (far/no object) or green (close) LED. Notice that different textures and colors reflect IR light differently.