HP C9017 Photosensor wire colors [closed]

I have at my disposal a photosensor (Optical encoder) with "C9017-80055", it has three cables: Black, Green, and yellow. I want to know the circuit (GND, VCC, output) to connect it with Raspberry pi, there is a problem if I connect it with raspberry pi without a resistor?.

Please find this related question about the same Photosensor Photosensor but I'm in trouble to understand.

Thank you.

simulate this circuit – Schematic created using CircuitLab

Figure 1. The component contains an infrared LED and a phototransistor. The case outline is in grey.

We can see from your photos that the green wire is attached to a trace that goes to both sides of the opto device. This is almost certainly a common ground.

I want to know the circuit (GND, VCC, output) to connect it with Raspberry Pi, ...

We've got the green. Now you need to figure out the blue and yellow.

... there is a problem if I connect it with raspberry pi without a resistor?

There certainly is. If you do that to an LED you will have no current limit. Infrared diodes have a forward voltage of 1.4 V or so. To limit the current to 10 mA (a reasonable choice) you need $$R = \frac {V_{CC} - V_f}I = \frac {3.3 - 1.4}{0.01}$$ which you can work out. That resistor will do to protect the transistor while you test it too.

Connect green to your Pi ground. Try connecting the yellow to the +3.3 V supply via the resistor. Then look into the slots using your phone camera to detect the infrared to see if either side lights. If it does then yellow is your LED. If not try powering up the black in the same way.

• i have black green and yellow you mean i connecting the black to the +3.3 V or yellow ?
– ma9
Commented Feb 5, 2021 at 21:59
• Sorry I may have mixed up colours from the other question. Try one first then the other. Commented Feb 5, 2021 at 22:05