Abstract
The development of optogenetics introduced a method for dynamic control of neuronal function. This advancement has catalyzed substantial progress in the field of neuroscience by providing a method to precisely activate or inhibit cells with light, allowing researchers to probe the role of neural circuits in behavior and interactions between circuits in different regions of the brain. We have developed an inexpensive device to deliver light for closed-loop optogenetic stimulation of neurons at different phases of the theta local field potential (LFP). LFP data is acquired with an INTAN RHD2000 recording system. An analog LFP output from the INTAN board is filtered in the theta frequency and an Arduino UNO detects troughs and peaks and sends a TTL pulse to a laser which precisely controls light delivery at the desired theta phases. We use this system to deliver light stimulation at the peak or trough of theta, but users can edit the code for delivery at other phases. We have made the code open source, and it can be downloaded from https://github.com/restrepd/drgClosedLoop .