A simple breakout PCB for the GP1A57HR photo interrupter (also known as a photogate, photodiode, or phototransistor). This PCB has three connections for PWR, GND, and Signal.
When the gate is clear, SIG will be high (>4.9V). When the gate is blocked by a finger, writing utensil, food pellet, or anything else - SIG will go low (<0.4V).
Assembled picture is for reference only, board comes bare; photo interrupter and the 220Ω (330Ω, works as well) current limiting resistor are listed below.