Abstract
In vivo electrophysiology experiments require the collection of data from multiple subjects, often for extended periods. Studying multiple subjects for extended periods can be made more efficient through simultaneous recordings, but scaling up recordings to accommodate larger numbers of subjects simultaneously requires coordination and consideration of costs and flexibility. To facilitate this process, we have developed OpBox, an open source set of tools to acquire electroencephalography (EEG) and electromyography (EMG) flexibly from multiple rodent subjects simultaneously. OpBox combines open source hardware and software with off-the-shelf components to create a system that costs less than commercial solutions ($500 per subject), and can be easily deployed for multiple subjects. Coded in MATLAB, OpBox scripts can simultaneously and flexibly collect and display multiple analog and digital data streams, for instance real-time EEG and EMG, event triggers from a behavioral system, and rotary encoder data. OpBox also calculates and displays real-time spectral representations and event-related potentials (ERPs). To verify the performance of our system, we compare our amplifiers with two other commercial amplifiers, a Grass P55 AC preamplifier and an Intan RHD2000-series amplifier. The OpBox amplifier performs comparably to commercial amplifiers for signal-to-noise ratios (SNRs), noise floors, and common mode rejection. We also demonstrate that our acquisition system can reliably record multichannel data from multiple subjects, and has been successfully tested with 12 subjects running simultaneously on a single standard desktop computer. Together, OpBox increases the flexibility and lowers the cost for simultaneous acquisition of electrophysiology data from multiple subjects.
Significance Statement
Current commercial solutions for electrophysiology recordings in awake, behaving animals can be relatively expensive, inflexible, or challenging to interface with custom-built equipment. Here, we describe the development of OpBox, an open source set of hardware and software to perform simultaneous acquisition of electroencephalography (EEG) and electromyography (EMG) signals from multiple behaving subjects. Together with off-the-shelf data acquisition systems, OpBox increases flexibility and lowers the cost for the simultaneous acquisition of electrophysiology from multiple behaving subjects.
Introduction
The search for new understandings and treatments of neuropsychiatric disease depends in part on reproducible and translatable biomarkers (Drinkenburg et al., 2015; Jones et al., 2015). Electrical brain activity, as revealed by electroencephalography (EEG), can reveal brain states and dynamics (Berger, 1929) relevant to various clinical conditions (Engel and Romano, 1959; Tatum, 2001; Brown et al., 2010; Mashour and Hudetz, 2018; Chen and Koubeissi, 2019). Some of these conditions, such as delirium, can be clinically heterogeneous, making reproducible measurements of rigorous biomarkers particularly important (Trzepacz et al., 1992; van der Kooi et al., 2015; Kimchi et al., 2019). Reproducible in vivo electrophysiology experiments require the collection of data from multiple subjects, often for extended periods. While long-term recordings from multiple subjects can be made more efficient by performing them simultaneously, scaling up recordings requires careful coordination and consideration of costs and flexibility.
Open source devices can improve research reproducibility and flexibility, potentially at lower costs, including for electrophysiology experiments. By sharing not only the methodology of an experiment, but the equipment as well (such as through design files), variability caused by differences in tools can be minimized (White et al., 2019). Furthermore, open source communities allow for direct feedback on best practice and allow for more community input on development of new tools. Important steps in EEG studies in multiple subjects are amplification of low-power EEG signals and acquisition through coordinated digital systems. Several open source amplifier designs are available, including a simple, single-channel analog system (Land et al., 2001), and a more flexible, higher-channel count (≥16 channels) digital system (Wang et al., 2014; Frey, 2016; Siegle et al., 2017). Both of these systems were initially designed for recording from single experimental preparations, rather than from multiple subjects simultaneously. We have therefore identified design parameters more specifically suited for flexible, multisubject rodent EEG recordings, as would be desired for epilepsy, sleep, or delirium related translational studies (Trzepacz et al., 1992; Bragin et al., 1999; Oishi et al., 2016; Kadam et al., 2017), as well as other possible experiments. We identified goals of recording up to four channels per subject, at moderate sampling rates (500 Hz to 2 kHz), with filters appropriate for EEG recordings relevant to epilepsy and sleep (0.3–200 Hz). Most importantly, we desired to record from at least 10 subjects simultaneously with a target goal of less than $500 per simultaneous subject.
We have developed an open-source system for simultaneous EEG/electromyography (EMG) acquisition from multiple rodent subjects, following the above design objectives, named OpBox. OpBox is a modular and flexible hardware and software system that constrains costs through judicious coordination of custom, open source circuits and software with off-the-shelf components and software commonly found in neuroscience laboratories (Fig. 1). Here, we verify our electrophysiology recording system by benchmarking it against commercially available amplifiers. We also demonstrate acquisition and visualization of EEG and EMG data from 12 subjects simultaneously, including real-time spectral analysis and averaged event-related potentials (ERPs) from subjects performing behavioral tasks.
Materials and Methods
Amplifier design
The main hardware component of our physiology system is a multichannel amplifier designed to collect electrophysiologic data, including EEG and EMG (Fig. 2). The OpBox amplifier is a four channel extension of a prior open source amplifier (Land et al., 2001). All four channels are referenced to a single electrode input, with an additional ground connection. Our design uses fixed filters, set by electrical component values, for a range of 0.3–200 Hz. Although we have not elected to use adjustable filters, the filter bandwidth could potentially be made adjustable by substituting a trim potentiometer for RHpfA (Fig. 2A) to adjust the high pass cutoff, and a dual potentiometer for RLpfA and RLpfB (Fig. 2A) to adjust the low pass cutoff. However, this might risk distorting the gain values of the amplifier. We cannot comment on the reliability of untested modifications of our design. The amplifier is powered by four AA batteries (total ±3 V) to reduce power line noise.
We connect electrodes from subjects to each amplifier using a short, passive cable via a commutator (details below within Multisubject simultaneous acquisition). Screw terminal inputs on the amplifier allow one to interface flexibly with various electrodes or cables, so labs can choose to use existing electrodes, cables, and commutator solutions from commercial companies, or integrate with other open source solutions (Medlej et al., 2019). Outputs from the four channel amplifiers are provided using an RJ45 or Ethernet jack, which allows one to transmit data via standard Ethernet cables to another RJ45 breakout connected to the data acquisition system. The cost of the four-channel amplifier, including printed circuit board (PCB) and components, is ∼$150 per amp when buying parts for 10 builds.
There are potential downsides of buffering the EEG signals on the acquisition side and not the animal’s head. Delayed buffering potentially increases the susceptibility of signal acquisition to environmental electrical noise. This may be problematic with long cables. We therefore mitigated this through early 1000× amplification at the top of the recording chamber and tested our system with typical cable lengths for rodent operant chambers, which allowed for longer cables (30’ BNC cables) before digitization by the data acquisition devices. The performance we report therefore may not be reflective of longer cables before amplification. Additionally, our system was designed for low impedance electrodes typically used for EEG studies, however, higher impedance electrodes for intracellular recordings may also be more vulnerable to delayed buffering. Because shielding may also mitigate the effects of delayed buffering, we provide details on the shielding we employed. Recordings were performed with both anesthetized and freely moving rats, as detailed below, to evaluate whether recordings remained satisfactory even when rats were moving, which may also be more susceptible to noise with delayed buffering.
In addition to the four-channel amplifier, we have designed a three-channel amplifier with similar components but a different referencing montage. Two channels share a common reference, but the third channel has a separate reference to enable a more specific bipolar configuration. We have found this configuration to be useful for separating EMG from EEG signals in studies involving sleep or convulsive seizures. Outputs for the three-channel amplifier are provided by dedicated BNC connectors for each channel. In practice, we have not routinely needed to use a line filter or further shielding with these amplifiers, although these features can be considered for use in electrically noisy environments.
We have used through-hole electronic components in the design of our PCBs, rather than surface-mounted components, to simplify bench fabrication of the amplifier more easily by lab members with limited electronics and soldering experience. While this design choice means the device is too large to be mounted on a rodent subject’s head, the multichannel, battery-powered amplifier is small enough to sit directly on top of a recording or behavioral chamber. We also elected to use an analog amplifier feeding into an off-the-shelf analog-to-digital data acquisition system capable of handling data from multiple amplifiers, to simplify implementation and reduce costs.
We designed our circuits within Fritzing (http://fritzing.org), an open source electronic circuit layout program that incorporates breadboard, schematic, and PCB views, and is commonly used in the Arduino community. We initially prototyped our circuits using breadboards, but then organized the design for a PCB. We exported the PCB as Gerber files for printing. These PCBs can be made in the lab using a desktop printer with etching solution or sent digitally to commercial manufacturers (e.g., $27.70 when purchased from Sunstone). In the Extended Data 1, alongside our PCB design files, we also provide bills of materials for our boards.
Extended Data 1
PCB designs: amplifier PCB design files ready to be sent out for fabrication or modified to fit customized specifications. How to build + parts list: a document file containing detailed instructions for constructing the OpBox system, separated by component, with a spreadsheet of all parts used in the process of building the amplifier. Software scripts: MATLAB scripts necessary for running behavioral tasks and recording behavioral/physiological data. Includes example CSV spreadsheet files (InfoSubjects + InfoBoxes) and instructions for use. Download Extended Data 1, ZIP file.
Physiology data acquisition
Our amplifiers produce analog outputs that are communicated to off-the-shelf analog-to-digital data acquisition devices. We initially explored using microcontrollers for analog-to-digital acquisition (DAQ); however, at the time of design, Arduino microcontroller ADCs were limited to 10 bits, and timing accuracy can be inaccurate by >0.1% (D’Ausilio, 2012), which can be more problematic for electrophysiology than behavior. Since that time, microcontrollers have become a more viable option, with commercially available boards such as the Teensy being employed to acquire 12-bit, 512-Hz EEG data (Blino.io). We elected to use National Instruments data acquisition devices given their widespread use in other otherwise open source electrophysiology systems, including often as benchmark devices for timing calibration (Rolston et al., 2010; Suter et al., 2010; Englitz et al., 2013; Campagnola et al., 2014). Potentially lower-cost alternative data acquisition devices such as LabJack are available but have yet to be tested with OpBox. We have successfully used OpBox with several National Instruments Data Acquisition devices (PCIe-6323, PCI-6225, USB-6009, USB-6210, and USB-6211). Amplified data are carried from the amplifier to the DAQ devices via twisted-pair (Ethernet) or coaxial (BNC) cables over an ∼3-m distance.
We have developed data acquisition scripts to manage data streaming from the amplifiers. National Instruments currently supports several programming environments, including MATLAB via the Data Acquisition Toolbox or C/Python. At the time of initial development, National Instruments provided official support for a MATLAB interface library, but did not provide official support for Python, so we followed other open-source acquisition efforts and developed our system in MATLAB (RRID:SCR_001622). We expect that a similar approach to that described below can also be used in Python. NI-DAQmx drivers should be downloaded from the NI website and installed before using OpBox.
A key design constraint was the ability to start and stop recordings from different subjects asynchronously. In most data acquisition devices, a single high-precision hardware clock starts and stops all channel acquisition simultaneously. Recording from multiple subjects might therefore require processing and saving data from all channels at once, with post hoc or retrospective splitting of individual subject data. In OpBox, we have instead coded an overarching set of scripts that allow for easy multisubject acquisition. OpBox supports the use of single or multiple hardware clocks across subjects. Even when recordings are acquired using a single hardware clock, the data streams from each subject are processed and saved independently by OpBox. End users simply identify subjects or amplifiers for which to start or stop recordings. Internally, all data from the DAQ system, including both used and unused channels, are consistently reported to the software scripts. However, our software uses two configurable text-based comma-separated value (CSV) spreadsheets to track: (1) which subjects are assigned to which recording boxes/amplifiers; and (2) which channels on our data acquisition devices are associated with those specific boxes/amplifiers. Assigning channels this way allows for flexibility in channel assignments for different amplifier configurations and makes it easy to track data selectively from only the active subjects at any given time, to process and save data from different subjects separately. This feature increases flexibility to stagger start and stop times and decreases further processing and storage requirements, allowing for data to be more easily displayed, processed, and saved in real time.
Real-time data processing includes online Fourier transforms to display frequency content of the electrophysiological data and evoked potential monitoring. These data are updated according to the internal data communication rate set by the MATLAB Data Acquisition Toolbox, for which we use the default of 10 Hz (100 ms). A screenshot and detail of a single subject’s stream during multisubject acquisition can be seen in Figure 3. Data are saved in a simple binary format for offline analysis, which can include analog physiology data, digital behavioral data or event markers, and rotary encoder data, for example, from linear treadmills in head-fixed preparations.
Using our software design, a single data acquisition device can be shared by multiple amplifiers. Therefore, a DAQ device with many channels (for example, 80 channels in the PCI-6225) can support many subjects (for example, 20 subjects with four channels each). Under this architecture, the primary scaling limitation of the number of channels that can be recorded from per computer is the number of PCI/e slots or USB connections for data acquisition devices collecting electrophysiology and behavioral data through analog and digital input channels. Expanding the system is primarily a matter of building new amplifiers to make use of all available input channels. PCI/e-based National Instruments devices can also be synchronized at the hardware level using a Real-Time System Integration (RTSI) cable (e.g., uniting a PCIe-6323 and PCI-6225 for a total of 112 analog input channels and 72 digital input/output channels). Hardware clocks of different USB devices cannot easily be synchronized, however; therefore, when using USB devices, all channels from a given individual subject should be kept on the same data acquisition device.
Acquisition of additional data streams
OpBox software scripts can be configured to acquire additional data streams. For example, behavioral markers can be sent to digital input channels using transistor-transistor logic (TTL) signals or can be multiplexed and transmitted to analog input channels on the data acquisition device. The onsets of these behavioral events, such as rodent nosepokes, stimulus deliveries, or reward deliveries, can be used to demarcate sections of electrographic data for averaging automated, real-time ERPs. This is reliant on a low-latency behavioral system capable of sending out these TTLs, with one channel dedicated to each event of interest or through use of a multiplexed analog signal. Collecting behavioral data simultaneously with analog physiology data eliminates the need for post hoc attempts to synchronize timestamps. OpBox can also be used to simultaneously sample rotary encoder data, for example, from treadmills, using NI data acquisition devices that support rotary encoder data (e.g., USB-6211).
Lastly, OpBox also has the capability to display and save video data using any standard webcam supported by the MATLAB Image Acquisition Toolbox. Webcam video streams are synchronized with OpBox physiology by software. While software synchronization sets limitations on synchronization precision, it potentially allows users to employ less expensive cameras and may be sufficient if subsecond synchronization is required, rather than millisecond precision. In order to synchronize, every time data are updated from the NI DAQ to MATLAB (at the rate determined by the NotifyWhenDataAvailableExceeds property of the DAQ object, default 10 Hz), we register the time reported by the DAQ that the data were collected and also poll the MATLAB video input object at that moment to determine the number of the current frame just recorded (typically at 30 Hz). These data are saved independently for each subject and can be used for off-line video and physiology alignment, timestamp interpolation, and analysis.
Performance benchmarking
We tested our OpBox system on a Dell Optiplex 9020 with an Intel Core i7-4770 CPU running at 3.4 GHz, with 16 GB of RAM and a 500-GB SCSI SSD (Samsung 840 EVO), running 64-bit Windows 7 (system cost ∼$1200 at purchase) and MATLAB R2013a (win64). Our scripts were originally developed in MATLAB version 2013a but have been tested to work up to version 2019b. We benchmarked the OpBox amplifiers using a National Instruments DAQ (PCIe-6323). We compared at least two different OpBox amplifiers to two systems previously available for purchase: (1) a Grass P55 AC preamplifier set to 1000× gain, with highpass/lowpass cutoff values set to 0.3 and 300 Hz, respectively, and line filter off; and (2) an open source system, based on the Intan RHD2000-series amplifier chips for signal amplification and digitization, similar to OpenEphys (Siegle et al., 2017). While the Grass amplifier is no longer commercially available for new purchase, a similar amplifier is available from AM Systems (Model 3000 AC/DC differential amplifier). For acquisition of the signal from the Intan system we used the RHD2000 USB interface board and the OpenEphys Graphical User Interface (GUI). To be most comparable to our recordings, we used highpass/lowpass cutoff values of 0.3 and 200 Hz, respectively. All systems were sampled at 1 kHz, except where indicated below.
To measure the noise floor for each amp, 5-min recordings were taken with each amplifier on, and a connection made between the differential inputs with a wire, a 1-kΩ resistor, and a 10-kΩ resistor. Another recording with all inputs unconnected was made as well. To better simulate noise that may be picked up by a tethered animal subject, we connected two channels of a shielded cable via a 10-kΩ resistor inside the behavioral chamber and the other ends to the differential inputs on the amplifier. The shield for the wire was connected to ground. Root mean square (RMS) values of the amplifier outputs were calculated for 10 non-overlapping 30-s segments. Mean RMS and SEM of windows were calculated for each combination of test and amplifier type. One-way ANOVAs were performed for each test condition to test for an effect from amplifier type on RMS values.
To measure the common mode rejection ratio (CMRR) for each amplifier, a 1-V peak-to-peak 60-Hz sine wave was output from an Agilent 33250A function generator and the positive lead was split and connected to both differential inputs. The negative lead was left floating; 5-min segments of recordings were taken from each amplifier type. The ratio of RMS of the output signal to the RMS of the input signal (from an ideal signal generated using MATLAB) was calculated for 10 non-overlapping 30-s segments for each amplifier type to determine the mean and SEM of signal reduction in decibels.
As a test of amplifying a known signal, a 100-μV peak-to-peak, 10-Hz sine wave signal was delivered to each amplifier input using the function generator. As this was below the output voltage range of the signal generator, a 100-mV peak-to-peak signal was stepped down by a factor of 1/1000 using a precision voltage divider circuit. We took 5-min recordings and compared amplifier outputs by computing the power spectrum densities of these recordings. To calculate signal-to-noise ratio (SNR) for each amplifier in these test recordings, we used the MATLAB SNR function (snr) to calculate the SNR in 20 non-overlapping 15-s windows for each recording. Mean and SDs of SNR values were taken for each amplifier and compared using a one-way ANOVA, with post hoc tests Bonferroni corrected for multiple comparisons.
In order to test the performance of inexpensive commutators, we performed an additional 30-s test signal recording in which the output of the voltage divider was sent to the amplifier input via our commutator. The commutator was spun by hand at ∼0.2 Hz using a stopwatch as a guide. Since this benchmarking recording setup does not allow us to spin our cables indefinitely, we spun clockwise for two revolutions, counterclockwise two revolutions, and then clockwise for two revolutions again. The raw signal was plotted alongside the approximate rotational position as well as a spectrogram of the recording made using 2-s windows and 80% overlap.
Cross talk between different channels of the same OpBox amplifier and between different amplifiers on the same DAQ was measured by recording unused channels during test signal amplification. Again, by using our function generator and voltage divider circuit, a 1-mV peak-to-peak, 10-Hz triangle wave was sent to the first channel of an OpBox amplifier. We recorded from the channel receiving the input, another unused channel on the same amplifier, and an unused channel from a second amplifier connected to an adjacent DAQ input, all for 5 min. RMS values of all three channels were calculated, as well as the RMS value of an idealized output (a 5-min, 500-mV, 10-Hz triangle wave generated in MATLAB) for 10 non-overlapping 30-s segments. Mean and SEM of RMS values for each channel were calculated and compared with the idealized signal.
For tests measuring phase distortion, gain, step response, and impulse response, we increased the sample rate in our OpBox MATLAB script from 1 to 100 kHz. For step and impulse response tests using the Intan devices, the max sampling rate of 30 kHz was used; however, since no means of bypassing the amplifier was possible for the Intan device, it was not included in phase distortion and gain analyses. To measure phase distortion, a 1-V peak-to-peak signal was split and sent both directly to our DAQ and to an input on the amplifier via voltage divider. Tests were performed with sine waves at frequencies of 5, 10, 25, 50, and 100 Hz. The 10-s recordings were Hilbert transformed and phase discrepancy was calculated for each frequency as the instantaneous difference in phase at each sample. Mean and SEM of phase difference was reported for each amplifier at each frequency tested. Using the same recordings, we calculated effective gain at each frequency by calculating the ratio of RMS of amplifier outputs to RMS of the input signals (simulated by dividing the direct-to-DAQ signal by 1000).
For step signals, a 0.05-Hz 1-mV unipolar rectangular wave was sent to the amplifier input using the function generator and voltage divider. Rise time was calculated as the time difference between an amplifier output reaching 10% and 90% of the max amplitude after delivery of signal. Plots were included to show amplifier response to step onset until outputs had settled completely. For an impulse signal, we used the signal generator and voltage divider to send a 500-μV unipolar, 1-ms pulse to one channel of each amplifier. Plots of a single impulse response were visually compared between amplifier types.
Measurements of input impedance for each amplifier were calculated by sending sine waves from the function generator and voltage divider at frequencies of 1, 5, 10, 25, and 50 Hz. This was done using a fixed gain, tuned so that the input was as large as possible without saturating the amplifier. At each frequency tested, recordings were made with the upper arm of the voltage divider output passed to the amplifier via a wire, and again passed via a 10-MΩ resistor. Recordings of each type were split into 20 non-overlapping windows, for which RMS was calculated. Input impedance values were then calculated using the formula: Input Impedance = 10 MΩ × RMS10 MΩ/(RMS0Ω – RMS10MΩ) and are presented as medians and interquartile ranges.
To benchmark the synchronization of analog data and video streams, we flashed an infrared LED (Everlight IR333C/H0/L10) at both a webcam (Digital Innovations 4310100) and a phototransistor (TT Electronics/Optek Technology OP535B). Voltage across the phototransistor was measured by an NI DAQ (USB-6210). Data from both the webcam and the NI DAQ were recorded by OpBox within MATLAB R2018b using a Windows 10 desktop computer, and data streams were synchronized in software. The LED was flashed using an Arduino Mega, and was on for 1 s, and off for 2 s. We recorded 36 min of data. Offline, we identified LED onset times by thresholding each data stream at 1.5 times the median value. The difference between LED onset times in the two streams were compared, and descriptive statistics are reported in Results.
Animal care and use
We also tested the performance of our amplifiers for recording EEG and EMG in animal subjects. All animal procedures were performed in accordance with the Massachusetts General Hospital animal care committee’s regulations. Young (three-month) and aged (24-month) male Brown Norway (Rattus norvegicus) rats were acquired from the National Institute on Aging Aged Rodent Colonies (RRID:SCR_007317) and housed in standard caging on a 12/12 h light/dark cycle with ad libitum access to food and water until the start of behavioral training, for which food restriction was used as a motivator for obtaining a caloric fluid reward from correct task performance. All experiments were started at ∼Zeitgeber time (ZT)3. Behavioral tasks consisted of a Go/No-go auditory discrimination, where responses to Go tones (pure tones at 3.5 or 12 kHz, ∼55 dB, 1-s duration) yielded 100 μl of reward delivered via a spout (Ensure clear), and responses to No-go tones (counter-balanced 12 or 3.5 kHz), were unpunished. Behavioral protocols were run locally on an Arduino Mega, a microcontroller and embedded computer system dedicated to each behavioral chambers. Behavioral results are not described in this manuscript, which is focused on the physiology system, but further details are available on request and hardware and software are freely available on our website (http://www.kimchilab.org/opbox/). Animal behavior was monitored using an infrared webcam (Digital Innovations P/N: 4310100) and training sessions typically lasted 1–2 h, with training typically taking at least two weeks before implantation.
After training, rats were implanted with four extradural skull screw electrodes and 2 EMG pads (Plastics One) under general anesthesia [ketamine 100 mg/kg (for induction and supplements if needed) + diazepam 10 mg/kg (for induction only)] and local anesthetics (lidocaine). Opioid pain management (buprenorphine 0.05 mg/kg) and NSAID analgesia (ketoprofen 4 mg/kg) were administered peri-operatively. Relative to bregma, extradural skull screw electrodes were located: 2 mm anterior and ±2 mm lateral from sagittal midline (bilateral); 3 mm posterior and ±3 mm lateral from sagittal midline (bilateral). The anterior right electrode was used as ground. The anterior left electrode was used as a reference to record two channels: an ipsilateral recording and a contralateral recording from the left and right posterior screws, respectively. EMG pads were placed in between nuchal muscles after blunt dissection posterior to the occiput. A bipolar EMG recording was made using the third channel, taken as the differential between the two pads. The screws, leads, and exposed skull were covered with dental cement (AM Systems). Daily ketoprofen administration continued for 2 d following the procedure. To avoid damage from cagemates chewing on headstage connectors, animals were housed individually after surgery. Rats were allowed to recover for at least one week. After recovery, behavioral testing was resumed, with concurrent electrophysiology data acquisition.
Multisubject simultaneous acquisition
To demonstrate the capabilities of our system’s simultaneous, multisubject acquisition, we recorded EEG and EMG from 12 subjects simultaneously on a single computer. Subjects were placed in a custom-made acrylic box (Dan-Kar Plastics) inside of a laminated wooden box lined with acoustic foam (McMaster). Headstage connectors were attached using short cables (PlasticsOne P/N: 363–000 W/SPRING) to a commutator (Adafruit P/N: 736) at the ceiling of the chamber, which was connected to our three-channel OpBox amplifier. Amplifiers were connected via BNC cables to National Instruments breakout boards (NI P/N: 777145–02), which were connected to two data acquisition cards (NI PCIe-6323 and PCI-6225). A single instance of MATLAB on our desktop computer running Windows 7, installed with the NI-DAQmx drivers, handled data acquisition and visualization of incoming data streams, including raw EEG/EMG traces and real-time FFT power spectrum plots.
Physiologic data were synchronized with behavioral data streams at the hardware level by sending digital event markers from the Arduinos to the DAQ. Therefore, behavioral (or other digitally-encoded data) and physiological data could be supervised by different devices to maximize the number of ports available for each device type. Recording sessions lasted from 1 to 6 h depending on the experimental need. We united the data for further analysis offline though network and cloud services.
Other hardware devices
In the Extended Data 1, we provide more details on the few other hardware devices in our system. These remaining components, like many others in OpBox, are chosen flexibly in modular fashion. For instance, we have tested our system with two different sets of EEG electrodes (PlasticsOne and custom-made screw electrodes) with similar results. For situations in which additional shielding is desired, we have employed prebuilt aluminum enclosures for our amplifiers with minor modifications to ground them and expose connections. We also have 3D-printed enclosures for our National Instrument interfaces to protect them and break out channels of interest in a patchbay of Ethernet or BNC connectors.
Costs
The initial cost of OpBox is for 10 simultaneous subjects is ∼$5000 ($497 per subject) when buying parts for the initial 10 setups, including a desktop computer, MATLAB licenses, and National Instruments devices. A parts list spreadsheet with links to parts and cost is available as Extended Data 1. Commercial solutions, such as those offered by Pinnacle Technology and Biopac Systems can cost upwards of $35,000 or $42,000, respectively, for the initial 10 setups. Other open-source solutions like OpenEphys could be used, although not expressly designed for high subject, low channel count experiments and thus would still be more expensive (∼$14,000 for just the headstages and USB interface boards for an initial 10 simultaneous subjects).
Code accessibility
The code/software described in the paper is freely available online at https://github.com/KimchiLab/OpBoxPhys. The code is available as Extended Data 1.
Results
Amplifier benchmarks
We benchmarked and compared our amplifiers using a variety of standard conditions. Noise testing experiments are reported in Table 1 as the average and SEM of RMS values with different resistance loads. OpBox amplifiers had comparatively low noise on all tests performed. When resistors were directly connected to the amplifiers in this particular setup, OpBox amplifiers had higher RMS than the Grass amplifier and lower than the Intan amplifier. We elected to use a consistent methodology for all amplifiers in the shielded cable tests; however, it should be noted that Intan headstage amplifiers are unlikely to have a cable run of this length, and thus this test does not necessarily reflect typical use for these amplifiers as compared with the Grass or OpBox amplifiers.
We next tested CMRR to see how well OpBox amplifiers rejected common signals (1-V peak-to-peak, 60-Hz sine wave). CMRR tests show OpBox amplifiers have good performance rejecting common mode signals in this particular setup (n = 10: Grass = −61.54 ± 0.01 dB; OpBox A = −101.87 ± 1.49 dB; OpBox B = −111.69 ± 0.09 dB; Intan = −66.65 ± 1.10 dB). We note that the noise and CMRR values for the Intan recordings are higher than reported in their datasheet and further shielding would likely produce a result more comparable with their reported values; however, we kept conditions standard here between amplifiers as described.
OpBox amplifiers also reliably outputted clean, amplified signals from sine waves. As seen in Figure 4, power spectrums of test signal amplification show OpBox amplifiers were comparable to the SNR of other commercial amplifiers. Under these specific conditions, SNR values for amplifiers were as follows (mean ± SD): Grass = 26.72 ± 0.1732 dB; OpBoxA = 24.33 ± 5.54 dB, OpBoxB = 23.60 ± 4.11 dB, and Intan = 15.73 ± 2.38 (p < 0.01 for comparisons of Intan amplifier to each other amplifiers; p > 0.05 for comparisons between all other amplifiers). In cross talk tests, RMS analysis of the active channel (291.00 μVrms) showed a close value to an idealized triangle wave signal (288.79 μVrms). Unused channels had low RMS values both within the amplifier (1.84 μVrms) and between amplifiers (1.73 μVrms), suggesting minimal cross talk.
High sample rate tests, as seen in Figure 5, were performed to measure phase distortion, gain, step response, and pulse response. Analysis of phase distortion showed minor phase distortion effects from amplifiers that increase with frequency. Even at the highest frequency measured (100 Hz), distortion time remained steady (for n = 106 observations, standard error was ±0.001 rad for all Grass amp tests and ±0.005 rad for all OpBox amp tests) and never more than half a cycle behind the direct-to-DAQ recording for both Grass and OpBox amplifiers. OpBox amplifiers show steady gain with some roll-off at higher frequencies. For the step responses shown in the figure, rise times were 1.9 ms for the OpBox amp, 1.6 ms for the Grass amp, and 6.3 ms for the Intan amp. Impulse responses for each amplifier are included in Figure 5 as well.
Impedance tests showed good performance from OpBox amplifiers for all frequencies tested (Table 2). Grass amplifiers showed similar performance. The calculated values for the Intan amplifier were affected by increased variability, because of the large scaling factor in impedance calculations; i.e., variability of 1 GΩ in this test is resultant of <0.5% variability in ratios of recordings’ RMS values.
We benchmarked our synchronization protocol for analog data and video streams for a single camera by flashing an LED. LED onset times as captured by the video were delayed relative to onset times captured by a phototransistor going into the OpBox system by a mean of 66.1 ms (SD 13.2 ms). There was no significant drift between the first and last half of the 36-min recording (t test of delays from first vs second half of recording, p = 0.843).
Animal data acquisition
In Figure 6, we validated the simultaneous acquisition from 12 subjects. Recording from 12 subjects simultaneously (three analog channels, up to four digital channels per subject, each at 1 kHz) for over 6 h used 12% of total CPU power and 1.5-GB RAM. Battery life depended on the duration of use for each amplifier, but lasted more than a week when running continuously and more than a month when recording for 6 h/d.
We performed spectral analyses on the first hour of EEG recorded from each subject’s session and determined that all power spectrums showed physiologically relevant data in the form of band-specific power, which appeared to vary by subject age and behavioral state. We also analyzed ERPs from two subjects (one young and one aged) undergoing behavioral testing with delivery of tones, using digital triggers sent out by our behavioral system at the time of cue delivery, to validate the capability of our system to be sensitive to low-power events which are only discernible in time-locked averages.
Discussion
We have developed OpBox, an open source system for acquiring electrophysiology data in behavioral experiments. We have successfully employed this system to record EEG and EMG in behaving rats, and have also used the system to record in behaving mice. Our system has been specially crafted to suit our experimental needs but is modular and flexible so that it can be tailored for different experiments. Flexibility is offered through dynamic channel assignment tailored to each subject specifically, the ability to acquire multiple signal types simultaneously, the ability to stagger start and stop times, and the resulting ability to combine subjects from separate protocols on a shared computer by way of these features. The scalability and modular design of our system allows for incremental expansion without a significant additional burden on each subsequent setup. After setting up a single amplifier, a second amplifier can still use the same computer, acquisition card, protocols, and analyses. Since the capability of our software in handling multiple subjects is not a limiting factor, adding subjects in software takes a minor amount of user input. OpBox simplifies multisubject protocols through the ability to have independent subject start times, synchronized data streams, and modular combinations of behavioral devices and cameras. We achieve similar performance per channel compared with a commercial general-purpose single channel amplifier at a fraction of the cost per channel, although with the trade-off of fixed filters and gain. Importantly for smaller labs, the system costs approximately an order of magnitude less on a per-subject basis than less customized commercial systems, although those may have their own advantages.
By using open source designs, collaboration and replicability can be achieved more easily and with less of a financial burden. The primary closed source but off-the-shelf components of our system are MATLAB and National Instruments DAQs. MATLAB is already used widely in many neuroscience laboratories. National Instruments devices are flexible, have a multitude of channels, and use well-maintained drivers (Parker et al., 2013). We decided that ease of implementation in these two domains were worth the use of proprietary designs. However, open source alternatives exist, for example, Python, a programming language which is increasingly used in laboratories as an alternative to MATLAB, and OpenDAQ, an open source USB-based data acquisition device. Through careful consideration of the synchronization capabilities of our off-the-shelf components, we can use of all available channels of the data acquisition devices to maintain reliable timing, including across PCI devices.
We anticipate that different labs will have different needs, and most labs that explore OpBox will use a subset of the open source modules, the amplifier and MATLAB scripts, we have designed. The modular nature of our system allows for users to only adopt certain parts, either specific hardware or software components without a loss in their functionality. This design philosophy allows for other equipment or data streams to be integrated with the OpBox system, as opposed to systems in which inputs and outputs are more tightly restricted. Consistent with the way in which we have benefitted from open source resources, we have made all of our hardware designs freely available on our website (https://github.com/KimchiLab/OpBoxPhys) under a Creative Commons Attribution-ShareAlike 4.0 International License (http://CreativeCommons.org/licenses/by-sa/4.0/), and software freely available under an MIT license (https://opensource.org/licenses/MIT).
This system has been fully implemented in our lab for more than four years and in the lab of a collaborator for more than half of that time. Our three-channel and four-channel amplifiers have proven sufficient for the recording montages desired in different experiments such as the behavioral experiments described here, experiments concerning EEG under anesthesia, recordings of sleep, and chronic EEG recordings of epileptic animals. We hope this system will also assist others in a wide range of applications perhaps beyond those described here, and that open source tools may help address ongoing concerns of replication and translation in neuroscience (Gleeson et al., 2017; White et al., 2019).
Acknowledgments
Acknowledgements: We thank Shaun Patel, Husam Katnani, Pariya Salami, and Adam Khalifa for their feedback on this work.
Footnotes
The authors declare no competing financial interests.
This work was supported by National Institutes of Health (NIH) Grants R03AG050878 and K08MH116135 (E.Y.K.), NIH Grant EY027888, William M. Wood Foundation, Bank of America Trustee (J.P.), and NIH Grants U01NS098968, 5K24NS088568, and 5R01NS062092 (S.S.C.).
This is an open-access article distributed under the terms of the Creative Commons Attribution 4.0 International license, which permits unrestricted use, distribution and reproduction in any medium provided that the original work is properly attributed.