Light detection by GPIO raspberry pi
I would suggest you pull the gpio pin up to 3.3v using a sizeable resistor ,and then pulling down that same pin by connecting it to the collector

here is a Quick solution , please calculate the values depending on the components you are using.







simulate this circuit &ndash; Schematic created using CircuitLab

hope it helps.