Synthetic regulation of gene expression provides a powerful approach to reprogram molecular and cellular processes and test the function of specific genes and gene products. In the last decade, optogenetic systems that allow light-dependent gene regulation have become valuable tools, providing tight spatiotemporal control of protein levels. Here we discuss and build on recent optogenetic approaches for regulating gene expression in mammalian cells using cryptochrome 2 (CRY2), a photoreceptor protein from Arabidopsis. We provide detailed protocols for using light to manipulate activity of a CRY2-based engineered photoactivatable Cre DNA recombinase, and to induce or disrupt transcription factor function. In addition, we provide instructions and software for building an inexpensive Rasberry-Pi-based programable LED device for optogenetic experiments, delivering pulsed light with customized control of illumination duration, frequency, and intensity.