The circuit in the figure represents a typical application of a phototransistor exciting a relay when it receives light. Two transistors are used, and the sensitivity is controlled in the 470K trimpot. The relay used is from 12V to 50 mA (G1RC2, for example) and the maximum controlled load is 10 amps. Power can be supplied with batteries if the relay is energized for short periods of time. If it is constant and prolonged, a power supply must be used. The phototransistor is the TI L78 or any equivalent available on the market.