Here’s a proximity-sensing LEDs project by Will_W_76. He writes a complete step-by-step instructions here:
So how does this all work? What makes it proximity-sensing? Remember in the explanation above that the photo-transistor acts like a switch. So when the photo-transistor is off, no current is flowing across it to our blue LED and the LED is off as well. Now look at the other side of our circuit. That’s where the IR LED is connected, and it is connected such that it is always on and emitting 880nm infrared waves. Remember that I also mentioned the photo-transistor is set to respond best to wavelengths of 880nm? That’s how the proximity-sensing works! When an object (such as your hand) goes over this little “cluster”, IR light of 880nm is emitted from the IR LED. This light reflects off of your hand and back to the circuit. When the photo-transistor picks it up, it turns on allowing current to flow through from the source to our blue LED lighting it up!