Automation of experimental setups is a promising direction in behavioral research because it can facilitate the acquisition of data while increasing its repeatability and reliability. For example, research in spatial cognition can benefit from automated control by systematic manipulation of sensory cues and more efficient execution of training procedures. However, commercial solutions are often costly, restricted to specific platforms, and mainly focused on the automation of data acquisition, stimulus presentation, and reward delivery. Animal welfare considerations as well as experimental demands may require automating the access of an animal or animals to the experimental arena. Here, we provide and test a low-cost, versatile Raspberry Pi-based solution for such use cases. We provide four application scenarios of varying complexities, based on our research of spatial orientation and navigation in weakly electric fish, with step-by-step protocols for the control of gates in the experimental setups. This easy-to-implement, platform-independent approach can be adapted to various experimental needs, including closed-loop as well as field experiments. As such, it can contribute to the optimization and standardization of experiments in a variety of species, thereby enhancing the comparability of data.