HP C8941 Photosensor operating voltage and circuit
simulate this circuit &ndash; Schematic created using CircuitLab
Figure 1. The device. Image based on @RohatKılıç's answer linked in the question.

The LED will be infrared so it will require 10 to 20 mA typically. Vf will be about 1.4 V.
The transistor will be well capable of pulling down the input to a Raspberry Pi. Either enable the input pull-up resistor or use an external one. 10 kΩ would do the job.