Related Experiment Video
Updated: Feb 8, 2026

Open-Source Real-Time Closed-Loop Electrical Threshold Tracking for Translational Pain Research
Published on: April 21, 2023
Open source modules for tracking animal behavior and closed-loop stimulation based on Open Ephys and Bonsai
Alessio Paolo Buccino1, Mikkel Elle Lepperød, Svenn-Arne Dragly
1Centre for Integrative Neuroplasticity (CINPLA), University of Oslo, Oslo, Norway. Department of Informatics, University of Oslo, Oslo, Norway.
Objective:
A major goal in systems neuroscience is to determine the causal relationship between neural activity and behavior. To this end, methods that combine monitoring neural activity, behavioral tracking, and targeted manipulation of neurons in closed-loop are powerful tools. However, commercial systems that allow these types of experiments are usually expensive and rely on non-standardized data formats and proprietary software which may hinder user-modifications for specific needs. In order to promote reproducibility and data-sharing in science, transparent software and standardized data formats are an advantage. Here, we present an open source, low-cost, adaptable, and easy to set-up system for combined behavioral tracking, electrophysiology, and closed-loop stimulation.
Approach:
Based on the Open Ephys system (www.open-ephys.org) we developed multiple modules to include real-time tracking and behavior-based closed-loop stimulation. We describe the equipment and provide a step-by-step guide to set up the system. Combining the open source software Bonsai (bonsai-rx.org) for analyzing camera images in real time with the newly developed modules in Open Ephys, we acquire position information, visualize tracking, and perform tracking-based closed-loop stimulation experiments. To analyze the acquired data we provide an open source file reading package in Python.
Main Results:
The system robustly visualizes real-time tracking and reliably recovers tracking information recorded from a range of sampling frequencies (30-1000 Hz). We combined electrophysiology with the newly-developed tracking modules in Open Ephys to record place cell and grid cell activity in the hippocampus and in the medial entorhinal cortex, respectively. Moreover, we present a case in which we used the system for closed-loop optogenetic stimulation of entorhinal grid cells.
Significance:
Expanding the Open Ephys system to include animal tracking and behavior-based closed-loop stimulation extends the availability of high-quality, low-cost experimental setup within standardized data formats serving the neuroscience community.
Related Concept Videos
Open and closed-loop control systems
An open-loop control system operates without feedback from the output. It consists of two primary elements: the controller and the controlled process. The controller receives an input signal...
What is Behavior?
Animal Mitochondrial Genetics
Feedback Loops
Close Relationships and Culture
Friendships and Close Friendships

