I have a DC motor with an encoder attached. In the encoder's PCB there's a component I can't recognise labeled IR1. At first I thought it was an IR LED just by it's name and it being transparent. But why would I need an IR LED in an encoder? And, if it's not an LED, what is this component?
IR LED for sure. Here is a similar part. TT Electronics OP140A.
This does look like a IR led. I'm guessing the optical encoder is inside the black housing. Also this clearly has 2 pins meaning it can't be an encoder.
It looks like an optical encoder, in which case it needs a light source and at least two detectors. I suspect a pair of photodiodes or phototransistors inside the wheel, with the IR LED (which I'm almost certain it is) set up so that without interruption it shines on them evenly and equally.
IR because they tend to be cheaper and more efficient, if all you want to do is couple signal and neither visibility nor super-duper fine resolution is an issue.