Impact Factor 3.648 | CiteScore 3.99
More on impact ›


Front. Neurosci., 07 November 2019 |

A Custom Microcontrolled and Wireless-Operated Chamber for Auditory Fear Conditioning

  • 1Programa de Pós Graduação em Engenharia Elétrica, Departamento de Engenharia Eletrônica (DELT), Escola de Engenharia, Universidade Federal de Minas Gerais, Belo Horizonte, Brazil
  • 2Programa de Pós Graduação em Neurociências, Núcleo de Neurociências, Departamento de Fisiologia e Biofísica, Instituto de Ciências Biológicas, Universidade Federal de Minas Gerais, Belo Horizonte, Brazil

Animal behavioral paradigms, such as classical conditioning and operant conditioning, are an important tool to study the neural basis of cognition and behavior. These paradigms involve manipulating sensory stimuli in a way that learning processes are induced under controlled experimental conditions. However, the majority of the commercially available equipment did not offer flexibility to manipulate stimuli. Therefore, the development of most versatile devices would allow the study of more complex cognitive functions. The purpose of this work is to present a low-cost, customized and wireless-operated chamber for animal behavior conditioning, based on the joint operation of two microcontroller modules: Arduino Due and ESP8266-12E. Our results showed that the auditory stimulation system allows setting the carrier frequency in the range of 1 Hz up to more than 100 kHz and the sound stimulus can be modulated in amplitude, also over a wide range of frequencies. Likewise, foot-shock could be precisely manipulated regarding its amplitude (from ∼200 μA to ∼1500 μA) and frequency (up to 20 pulses per second). Finally, adult rats exposed to a protocol of cued fear conditioning in our device showed consistent behavioral response and electrophysiological evoked responses in the midbrain auditory pathway. Furthermore, the device developed in the current study represents an open source alternative to develop customized protocols to study fear memory under conditions of varied sensory stimuli.


Animal behavioral paradigms have long played an important role in understanding the underlying neurobiological mechanisms of learning and memory processes; ubiquitously considered one of the greatest challenges in Neuroscience (Squire, 2009). In Classical or Pavlovian Conditioning, animal innate or reflex responses become evocable by stimuli that are usually neutral (such as sound or visual stimuli), if previously paired with an emotionally relevant stimuli, characterizing the basis of an associative learning process (Kim and Jung, 2006). Using a more appropriate terminology, the conditioned responses are established under an appropriate contingency of unconditioned stimulus (US) presentations paired with the conditioned stimulus (CS) occurrences (Baron, 1959; Holland, 1977). Proper controls undergo the exact same procedure aside from the fact that CS or US can be presented alone or CS is not paired in time with the US (Rescorla, 1967). Although the laboratory equipments designed to perform such associative learning protocols are supposedly fairly simple, the price can be prohibitive for small budget projects and they are usually quite inflexible in terms of controlling and programing the stimuli. The latter may constitute a drawback for the design of customized behavioral paradigms which may use pure tones to investigate the coding of sensory information (Liu et al., 2006; Tsytsarev et al., 2009) or even amplitude modulated stimuli tones in order to isolate neural circuitry involved in the sensory processing by means of steady state evoked responses (Lockmann et al., 2017; Pinto et al., 2017). In addition, the study of more complex cognitive and behavioral processes becomes impracticable, since they require more sophisticated and robust means of controlling contextual parameters and interacting with the animals (Cushman et al., 2013).

Fortunately, custom development of laboratory tools is becoming more feasible with the advances in technology (Sinard and Gershkovich, 2012; Pineño, 2014; Siegle et al., 2017; Buccino et al., 2018; White et al., 2019). Mainly, low-cost commercially available microcontroller modules have recently achieved a high level of integration and processing power, encouraging their acquisition and use in research laboratories. Arduino, for example, is an attractive hardware and software open-source solution (D’Ausilio, 2012) to program several different families of microcontrollers for a number of different consumer needs (Teikari et al., 2012; Pineño, 2014).

Considering this scenario, the purpose of our work is to present a customized, low-cost, microcontrolled and wireless-operated device for animal behavior conditioning. We propose a scalable architecture, based on Arduino Due board and ESP8266-12E module, which allows adding different sensory stimuli and behavioral feedback aside from what we chose to depict in this work (i.e., programmable sound stimulation waves and electric shock). Likewise, other elements, such as sensors, actuators and touchscreens, can be easily integrated to the apparatus by connecting them to innumerous general-purpose input/output (GPIO) pins available, or through digital communication protocols, like I2C, UART or SPI. This allows the design of a low-cost widely equipped apparatus and eases the development of customized behavioral paradigms.


System Overview

The main electronic components of the custom conditioning chamber are the ESP8266-12E module1 and the Arduino Due board2. The first one is an internet-of-things device from Espressif company, available since 2014. It has a Tensilica L106 32-bit microcontroller and an 80 MHz CPU clock. It operates at 3.3 V and supports WiFi (IEEE 802.11 g/b/n), I2C, SPI and UART communication protocols. Eleven GPIO pins and 32 kB RAM are available in the module. The ESP8266 is used here mainly as a programmable and flexible user interface, presented on a web page format, to allows users to write and read parameters to the device without the need of physically implementing buttons, knobs and displays.

The Arduino Due is a 32-bit microcontroller board based on the Atmel SAM3 × 8E ARM Cortex-M3 CPU. It has a 84 MHz CPU clock, 54 digital input/output pins, 12 analog inputs, 2 DAC (digital to analog) and can communicate through SPI, I2C, UART and USB.

Both modules are programed with an Arduino sketch (Web_Page.ino for the ESP8266-12E and Stimuli.ino for the Arduino Due) with specific assignments and they cooperate to produce all the apparatus functionality3. The modules communicate with each other via a 16-bit serial peripheral interface (SPI) and through digital signaling via two GPIO pins. In the scope of this work, systems for auditory and electrical stimulation (footshock) were implemented, stimuli that can be used as CS and US, respectively, in behavioral paradigms (Figure 1).


Figure 1. System overview. ESP8266-12E module and Arduino Due board cooperates in order to generate custom modulating tones and aversive stimulation, based on footshocks applied through electrified bars, programed via user interface.

The auditory stimulating system consists of a 12-bit digital-to-analog converter (DAC; available at Arduino Due board), a commercial audio amplifier and a speaker. The footshock system, in turn, is formed by a high DC-voltage (310 VDC) supply circuit in series with a current limiting resistor, significantly higher than the animal’s resistance, in series with a variable resistor in order to deliver a short pulse of constant current through the bars on the chamber. The footshock system was designed to limit stimulus intensity between ∼200 μA and ∼1500 μA and can be manually set by a potentiometer and an ammeter. Embedded electronics were designed to have only one bar under the animal, at a specific time, serving as current sink. The rate that bars are “scanned” and the duration of each shock pulse are programmable. The user interface for operating the apparatus was developed in a web interface, implemented in HTML within the Web_Page.ino sketch, making it not only very flexible and comprehensive in terms of controlling system parameters. Parameters such as sound and shock onset (seconds), shock pulses intervals between bars (milliseconds to seconds), sound intensity (%), sound carrier frequency (Hz) and modulating frequency (Hz) can be remotely programed to perform the experiments. In addition, each added trial can be saved by simply insert the parameters into a sequence and loaded it in later experimental sessions (Figure 2). Thus, behavioral paradigms can be easily configured using iPads, smartphones, notebooks or any device with a Wi-Fi connection.


Figure 2. The conditioning chamber can be remotely controlled by a HTML interface. Parameters: Sound and shock onset (seconds), pulse-shock interval (milliseconds to seconds), sound intensity (%), sound carrier frequency and modulating frequency. Each added trial can be saved and loaded. Wi-Fi connection: Conditioning Cage, IP address:, Password: 0112358132, password to send the parameters: 12345. Start/Abort: Start and stop experiment.

Hardware Design

The custom conditioning chamber dimensions are 330 × 200 × 300 mm3 (length, width and height, respectively), built with 5 mm-thick transparent acrylic boards4. An acrylic board covers the chamber, preventing the animals from escaping the context (Figures 3A–C). The chamber floor is built with 16 stainless steel cylindrical bars, 250 mm-long and 5 mm in diameter each. They are arranged in parallel, spaced 20 mm from each other and placed through small bilateral holes with 0.6 cm in diameter. The number of bars can be increased up to 32 and spaced 7.5 mm from each other.


Figure 3. Hardware Design. (A, Top) Conditioning chamber front view. (Bottom) Two-layer printed circuit board with power circuit. Attached to the chamber via 16 mounting holes, this board allows creating electric potential between the conductive bars. (B,C) Up view and back view of the conditioning chamber respectively. Detail for black box built on the 3d printer where all electronic components are organized. (D) Two-layer printed circuit board with control circuit. It has ESP8266-12E footprint, Arduino Due shield and it outputs a low power audio waveform and digital signals with temporal patterns for electric stimulus control. (E) Electric potential on each bar is controlled through a switch (npn transistor operating in saturation mode). A set of optocouplers are used in order to isolate power circuit from control circuit. Output voltage is 0 VDC or 310 VDC. Output current ranges from ∼200 to ∼1500 μA.

In order to deliver the shock through the bars, a 127 VAC: 220 VAC transformer (0.03 kVA) raises and isolates the AC voltage from the electric grid. A diode rectifier bridge (2KBP06M; 600 V/2A) and electrolytic capacitor (10 μF/350 V) at the rectifier output produce a constant voltage of approximately 310 VDC. The high voltage end passes through a current limiting resistor, set to a maximum of 1-2 mA, and then through a variable resistor in order to “fine tune” the output current. The current remains fairly stable since both resistors are within an order of magnitude higher than the conductance changes expected from the animal stepping on the bars and closing the circuit. Finally, a series of simple common-emitter circuits, using bipolar transistors (BC547B) as switches are used to drive optocouplers (PC817) in order to deliver a current pulse to each individual bar, therefore guaranteeing that whatever combination of bars the animal is stepping on will still deliver the foot shock5. The bars are sequentially “scanned” at a programmable interval and the pulse duration can also be set by the user. The Arduino Due board outputs a set of digital signals that control each bar potential (Figure 3D). Altogether, this constitutes an aversive stimulating system for US presentations (Figure 3E).

A 12-bit digital-to-analog converter at Arduino Due is used to generate analog waveform. The algorithm behind signal generation is the following: (1) a set of 8 points (2 bytes each) form the template of a sinusoidal waveform – or any period of a programmable signal - that will be repeated at the carrier frequency. Thus, the sampling frequency (fa) of the D/A output will be 8 times that of the carrier frequency (fc). (2) The amplitude of each 8 sample block will be proportionally given by each byte of a sequence of bytes representing the modulation frequency (fm). That is, the sequence of bytes is composed by a minimum of fa/(fm. 8) bytes repeated up to the duration set by the user6. In this way, we were able to generate quite a variety of stimulation waveforms at a very low computational cost (within the range of allowing ultrasound stimulation) and using few parameters and/or memory (Figures 4A–D).


Figure 4. Waveforms can be generated from digital-to-analog converter at Arduino Due. (A) A 12-bit digital-to-analog converter (DAC) is used to generate custom audio waveforms. (B) Tones with adjustable frequency can be produced with 8 voltage steps within each tone cycle. Although these voltage steps introduce undesirable high frequency components on audio signal, these components can be attenuated at power amplifier circuitry, since its frequency response is similar to a low-pass filter. (C) Upper waveform shows a single cycle generated at the DAC output, where the 8 voltage steps are visible. Lower waveform shows the same cycle measured at power amplifier output, which low-pass filter the audio signal and outputs a smooth waveform, practically a pure tone. (D) Amplitude modulation can be applied to the audio waveform, with adjustable modulating frequency. (E) The amplitude of the programed tone It can be set to various levels. (F) Time-frequency power of the carrier frequency in a range of 2–20 kHz (steps by 2 kHz) were calculated by the short-time Fourier transform-STFT demonstrating a constant amplitude over time. (G) Time-frequency power of the modulating frequency envelope in a range of 50–200 Hz (steps by 50 Hz) were calculated by the short-time Fourier transform-STFT demonstrating a constant amplitude over time.

Firmware Design

Arduino software applications were implemented for operating and controlling the custom chamber: Web_Page.ino, uploaded to ESP8266-12E module, and Stimuli.ino, uploaded to Arduino Due board.

Programed with Web_Page.ino sketch, ESP8266-12E module takes care of basically two things: (1) it provides the user interface, through which the experimental protocols can be programed (this interface is a web page, available from an independent access point WiFi network managed by the ESP8266-12E), and; (2) it uses 2 GPIO pins to determine when the Arduino Due should turn the conditioned (CS) and unconditioned (US) stimuli on or off, according to the parameters specified via web interface (Figure 2)7.

Programed with Stimuli.ino sketch (Figure 3D), Arduino Due board takes care of generating CS and US with specific temporal patterns, as specified by user. This routine manages triggers and CPU interruptions in order to generate, at the Arduino DAC output, an analog waveform with carrier and modulating frequencies, as well as a specific amplitude. In addition, GPIO pins are used to control each bar potential to produce custom aversive footshock patterns6.

System Validation

The validation of the customized apparatus was made in two steps. At first, bench tests were carried out in order to verify the correct functionality of the circuits, safety specifications and firmware for CS and US presentation before using the system in a living organism. In the second stage, experimental animals were submitted to a classical fear conditioning (CFC) task using Auditory Steady State Stimulation while recording local field potentials in the Inferior Colliculus (IC), the principal midbrain nucleus of the auditory pathway. The IC recordings show stable oscillations at the same frequency of the stimulus amplitude modulating component (i.e., when stimuli are turned-on), reflecting entertainment of neurons responding to sound. This particular steady-state evoked potential (SSEP) neural response is called an ASSR (Kuwada et al., 1986; Picton et al., 2003).

Bench Tests

In order to assess the flexibility in programing the sound stimulus, as well as the precision of its configurable parameters (mainly carrier frequency and modulating frequency), different sound stimuli reproduced by the audio system were recorded by means of a microphone and placed inside the customized chamber. The sampling frequency employed was 96 kHz and the raw data were qualitatively analyzed with custom-made and built-in MATLAB codes (MATLAB R2016a). The time-frequency power of the carrier and modulating frequency were calculated by the standard built-in spectrogram function (short-time Fourier transform-STFT; non-overlapping, 2,048-point Hamming window). In the case of the modulating frequency, the audio signals were preprocessed so that only the envelope of the signal (thus, the modulating signal) was considered. This was accomplished by means of the built-in Matlab Hilbert transform function.

In order to determine the flexibility and precision of the aversive electrical stimulus, a 20 kΩ resistor was connected between two bars of the chamber, simulating the resistance of a rodent that could eventually be touching them (Figure 5A). Similar values of resistance for rats were reported in previous work (Walters and Tullis, 1966). The voltage drop across this resistor was measured with an oscilloscope (GDS-2202A GW INSTEK) for four different programed shock values (400, 600, 800, and 1000 μA) during 1 s time course (Figure 5B), so that the electric current could be easily determined using Ohm’s Law.


Figure 5. The footshock exhibited precisely configurable patterns. (A) The footshock intensity was measured by an oscilloscope (I = V/R) through a resistor that simulates the animal skin resistance. (B) The current measurements were made over time in four different programed shock intensities (μA). (C) The mean footshock intensities remaining constant and showed no significant changes. (D) The same measurement was performed with three different resistors at a programed current value to simulate the skin resistance variations. (E) The current measurements were made in one programed value (400 μA) over time. (F) The values with a 25% deviation around the 20 kΩ caused no significant changes in the programed shock intensities (maximum ∼4.74%, ∼18 μA, to 25 kΩ).

Additionally, another bench test evaluated how much the footshock intensity changes with respect to variability in animal body conductance (which can occur due to humidity and different body masses between animals). For this, a 400 μA footshock was programed and its intensity was measured in three different cases: R = 15 kΩ, R = 20 kΩ and R = 25 kΩ (Figures 5D,E).

Proof of Concept: Classical Fear Conditioning (CFC) and Local Field Potential (LFP) Recordings

Male Rattus norvegicus (Wistar) weighing 270–310 g were supplied by the Instituto de Ciências Biológicas 2 (BICBIO 2) vivarium, housed under controlled environmental conditions (22 ± 2°C), with a 12:12 h light-dark cycle and free access to food and water. All experiments were approved by the Institutional Animal Care and Use Committee at the Universidade Federal de Minas Gerais (CEUA-UFMG; protocol no. 112/2014.), and were conducted in accordance with Conselho Nacional de Controle de Experimentação Animal (CONCEA) guidelines defined by Arouca Act 11.794 under Brazilian federal law. CEUA directives comply with National Institutes of Health (NIH) guidelines for the care and use of animals in research.


Animals were anesthetized intraperitoneally with ketamine/xylazine solution (15 mg/kg and 80 mg/kg, respectively), the head surface was shaved and then the animal was positioned in a stereotaxic frame (Stoelting, Wood Dale, IL, United States). After asepsis with alcohol (70%, topical) and povidineiodine solution (7.5%, topical) a local anesthesia with lidocaine clorohydrate-epinephrine [1% (wt/vol), 7 mg/kg] was applied and an incision in the scalp was made to expose the skull.

Monopolar electrodes for recording, made of a twisted pair of stainless-steel (0.005 in.) teflon-coated wires (Model 791400, A-M Systems Inc., Carlsborg, WA, United States) was slowly lowered and positioned at the ventral region of the left IC central nucleus (AP: −9.0 mm referenced from the bregma, ML: −1.4 mm, DV: −4.0 mm) (Paxinos and Watson, 2007). The coordinates for electrode positioning were chosen according to the tonotopic organization of the IC since the ventral layers respond better to the high frequencies (Clopton and Winfield, 1973; Malmierca et al., 2008) as used in the CFC protocol. At the end stainless steel screws were implanted on the nasal bones (anterior to the olfactory bulb), one to the left as the reference electrode (0 V) and another one as the ground. Both reference/ground and recording electrodes were soldiers in a RJ-11 connector, which was fixed to the skull with dental acrylic. Animals received a prophylactic treatment with pentantibiotics (Zoetis Fort Dodge; 19 mg/kg) and anti-inflammatory (Banamine, 2.5 mg/kg) to prevent discomfort and infection after surgery and recovery for 7 day.

Classical Fear Conditioning (CFC)

The CS used in the CFC was a 10 kHz pure tone with its amplitude modulated by a sine wave of 53.7 Hz. These specific tone features were chosen based on previous results (Lockmann et al., 2017; Pinto et al., 2017).

The amplitude modulated tone generated by the customized conditioning chamber was amplified by a commercial sound amplifier (AB100, 100 WRMS, 4 Ω, NCA) and reproduced by a speaker (ST304, 40 WRMS, 8 Ω, Selenium Super Tweeter).

Before the behavioral sessions, the intensity of the CS tone was measured and set to 85 dB SPL at the center of the conditioning chamber (Brüel & Kjaer type 2238 sound level meter). This sound pressure level ensures an appropriate electrophysiological response considering the anatomical positioning of the recording electrode (Meeren et al., 2001; Malmierca et al., 2008).

CFC was performed on three consecutive days in two different contexts (Figure 6A). On the first day (preconditioning), ten rats were presented with 5 CS stimuli (30 s each apart from each other, with pseudorandom interval not longer than 120 s) in the context A (a black acrylic box, 30 × 20 × 25 cm3 with one transparent face and 10% alcohol solution scented).


Figure 6. The Fear conditioning protocol (CFC) was performed as a proof of concept for the customized chamber. (A) Preconditioning occurred in Day 1, when 5 trials of CS (10 kHz pure tone with its amplitude modulated by a sine wave of 53.7 Hz) were presented to the animals in a context A. The Conditioning occurred in Day 2, when 5 trials of CS and US (a footshock with 400 μA over 2 s) were presented to the Paired and Unpaired groups using the customized chamber. In Day 3, retention test occurred with 5 trials of CS being presented to both groups. Animal fear response (freezing) was measured in order to verify if the association between sound and shock. (B) Total mean freezing (± SEM) to CS in preconditioning and test sessions. (C) mean freezing (± SEM) to CS over trials. p < 0.05, ∗∗p < 0.01, ****p < 0.0001. 2-way ANOVA followed by Bonferroni post hoc test.

On the second day (conditioning), the behavioral task took place in the context B, which is the custom chamber proposed in this work (with 0.001% acetic Acid solution scented). The rats were randomly assigned to paired (n = 5) or unpaired (n = 5) groups and similarly to the day 1, five CS stimuli were presented, however five US were applied. The US consisted of a 400 μA current applied through metal bars on the floor over 2 s (Mourão et al., 2016). In the paired group, each presentation of CS was temporally paired with US in the last 2 s of the CS presentations. On the other hand, in the unpaired group, US occurred at random times between CS.

On the third day (retention test), rats were presented to an accurate repetition of the preconditioning procedure. Returning to the context A (10% alcohol solution scented), all animals were presented with 5 CS stimuli (30 s apart from each other, with pseudorandom interval not longer than 120 s).

The sessions were recorded by a camera set up in front of the box, and the videos were analyzed by an examiner blind to the experimental group (Figure 6A). Freezing behavior was defined as no movements, except those resulting from breathing, that last a minimum of 3 s (within each 3 s time epoch). Results were expressed as the percentage of freezing during each CS trial (30 s – 10 epochs in which a freezing episode either occurred or not) (Blanchard and Blanchard, 1972; Fanselow and Bolles, 1979; Curzon et al., 2009). Periods outside of the CS presentation were not considered for quantification.

LFP Recordings and Data Analysis

LFP signals from the ventral region of the left IC central nucleus were recorded during the CFC test sessions (Figure 7). The signals were obtained through a pre-amplified unit gain stage (1x gain. ZCA-AMN16 adapter. Omnetics®. Tucker-Davis Technologies) coupled to a thin recording cable (ZC16 – 16 channel ZIF-CLIP® digital head stages. Tucker-Davis Technologies). A small adapter was built into a printed circuit board so that the commercial pre-amplified unit gain stage coupled to the RJ-11 connector surgically implanted in the experimental animals. The signals were filtered between 1 and 2,000 Hz, amplified by 24,000 V/V and sampled at approximately 12 kHz by a bioamplifier processor (Tucker-Davis Technologies RZ2).


Figure 7. Oscillations in the IC can be entrained by the envelope of an amplitude modulated tone. (A, top) Representative time course of LFP (gray) and CS trials (light red, 10 kHz pure tone with an amplitude modulation of 53.7 Hz). (A, Bottom) Highlight to a sample time window at the beginning of the fourth trial showing that the IC LFP synchronizes with the CS amplitude envelope. The LFP and the CS envelope were band-pass filtered between 40 and 70 Hz. (B) Spectrogram showing SSEP power at 53.7 Hz (a.u., Arbitrary units). (C, left) Mean SSEP power at 53.7 Hz ± 3 Hz over trials for all animals. The figure shows a period of 30 s before CS onset, 30 s of CS presentation and 10 s after. (C, right) Qualitative analysis of SSEP power at 53.7 Hz ± 3 Hz for 30 s before CS onset compared to the 30 s of CS presentation (n = 5 animals; before CS vs. CS period; t(4) = 11.42, p = 0.0003). (D) Representative time course of delta phase values at 53.7 Hz ± 3 Hz (φSSEPCS) extracted from the Hilbert coefficients (gray) and CS trials (light red). (E) Delta phase vectors computed for 250 ms time windows during CS presentation (gray lines) and the respective estimate mean phase values (red lines). The numbers above the polar plots represents the phase coherence of each trial during CS presentation. (F) Representative time course of instantaneous oscillatory frequency estimated at 53.7 Hz ± 3 Hz from the changes in the SSEP phase angles (gray) and CS trials (light red). (G) Distribution of instantaneous oscillatory frequencies over trials for 30 s before CS onset (light gray) and 30 s of CS presentation (light red) and their respective cumulative distributions. Two Sample Kolmogorov–Smirnov test was used to test whether the two samples come from the same distribution (n = 5 animals; before CS vs. CS period delta phase angles distributions; KS = 0.3343, p < 0.0001).

The timestamps locked to the peaks and valleys of the CS modulating frequency were generated in parallel through one of the Arduino Digital I/O pins and then recorded by a digital input port of the bioamplifier processor. Through linear interpolation, these time values were used to obtain an instantaneous phase time series, which in turn were used to reconstruct/estimate the CS modulating signal itself. In this sense the time-frequency analysis could keep engaged with the stimulus presentation.

The data were off-line preprocessed and analyzed with custom-made and built-in MATLAB codes (MATLAB R2017a. EEG lab. Open source environment for electrophysiological signal processing8). Time-frequency power of the SSEP (frequency range 40–70 Hz) were calculated by the standard built-in spectrogram function (short-time Fourier transform-STFT; non-overlapping, 16,384-point Hamming window).

To calculate the Δ phase between CS amplitude modulating envelope and SSEP, the data were initially filtered at the frequency range of 53.7 ± 3 Hz and the coefficients were extracted by the built-in MATLAB function Hilbert transform. The Δ phase was calculated in the average time windows of 250 ms as the difference between the imaginary components of SSEP and the CS envelope:

Mean Δ phase = 1 N arg [ n =  1 N e i ( ϕ S S E P - ϕ C S ) ]

Mean Δ phase: argument of the sum of the phase vectors, where N is the number of time-axis samples of each signal and ϕSSEP and ϕCS are the phase values for the SSEP and CS envelope, respectively.

The phase coherence between CS envelope and SSEP was extracted by means of the length of the average vector of phase angles differences:

Phase coherence = 1 N | n =  1 N e i ( ϕ S S E P - ϕ C S ) |

Phase coherence: metric of phase synchronization. Adimensional real value between 0, that represent an uniform phase distribution and 1, a perfect phase grouping (Lachaux et al., 1999; Mormann et al., 2000).

The dynamics of instantaneous oscillatory frequency was estimated from the changes in the SSEP phase angles over time. As described above, the data was filtered (range of 53.7 ± 3 Hz) and the first derivative of SSEP phase from Hilbert coefficients was calculated in the average time windows of 250 ms. The phase-angle time series was then transformed to a time series of instantaneous frequency by multiplying with the sampling rate in hertz and then dividing by 2π (Boashash, 1992; Cohen, 2014).

Instantaneous frequency = f a 2 π d ϕ d t

Instantaneous frequency: frequency component linearly proportional present in the modulating signal. Where fa indicates the sampling rate and dϕ/dt indicates instantaneous variation of unwrapped angles over time.

Statistical Analysis

The quantitative data are expressed as means ± standard error of the mean (SEM). The approximation to the normal distribution was confirmed by the Kolmogorov–Smirnov test (P > 0.05). Statistical comparisons were made using Student’s t-test or one-way or two-way repeated-measures analysis of variance (ANOVA), followed by Bonferroni post hoc test. For some analyses Two Sample Kolmogorov–Smirnov test was used to test whether two samples come from the same distribution. Values of P < 0.05 were considered statistically significant. Data were analyzed using GraphPad Prism 7.0a Software and MATLAB (2016a), The Mathworks, Natick, United States.


Bench Test – CS and US Stimuli

The auditory stimulation system allows setting the carrier frequency in range of 1 Hz up to more than 100 KHz. In addition, the sound stimulus can be modulated in amplitude, also over a wide range of frequencies. Another flexible characteristic of the auditory stimulation is its intensity, which can be programed by controlling the amplitude of the Arduino digital port output. Some carrier and modulating frequencies were chosen to be depicted in Figure 4. Figure shows that the parameters were adjusted accurately. The amplitude of the programed tone (in this case 10 kHz carrier frequency) remains stable at its various programed levels (Figure 4E) and the amplitude of the recorded tones (2–20 kHz carrier frequency, Figure 4F; 50, 100, 150, and 200 Hz modulating frequency, Figure 4G) remains constant over time.

Regarding the aversive sensory stimulus, it also exhibited precisely configurable patterns, both temporal (number of pulses per second) and intensity (in μA) (Figure 5C). In addition, the footshock system showed little susceptibility to changes on animal body conductance. A 25% deviation around the 20 kΩ simulated rat resistance caused, in the worst case (R = 25 kΩ), a corresponding variation of only 4.74% (about 18 μA) in the expected shock intensity, which was 400 μA (Figure 5F). We understand that the effect of this on the experimental protocol is negligible and does not harm the behavioral data obtained with the custom box.

It is worth noting that this slight variation in shock intensity was only possible because the operating voltage of the shock circuitry is relatively high. The 310 VDC potential requires resistors of 300 kΩ or more to limit the shock intensity under 1000 μA. Since the animal resistance is much smaller than 300 kΩ, the shock intensity is largely determined by the resistors in the electronic circuitry rather than by the animal itself.

It should be noted that the Stimuli.ino and Control_Box.ino sketches can be easily modified to specify which bars will be used to apply footshock. This allows creating different spatial patterns of aversive electrical stimulation, which in turn makes it possible to perform different behavioral tasks.

Classical Fear Conditioning With an Amplitude Modulated Tone

Over the past decade, many studies have shown that auditory fear conditioning is able to induce the emergence of defensive behaviors (Maren, 2001). This traditional task can be considered one of the most important methodological tools that allow understanding of the underlying mechanisms of learning and memory (Quirk et al., 1995; Collins, 2000; Maren et al., 2001; Duvarci and Pare, 2014).

In the present work the animals submitted to the CFC in the customized chamber presented a robust conditioned response (Figures 6B,C). According to the results, in the preconditioning session, the auditory stimulus can be considered a neutral stimulus since it did not elicit high levels of freezing. However, in the test session, 24 h after the conditioning session, the paired group showed a significant increase of Freezing behavior (F(1,8) = 34.26; p < 0.0001), while the unpaired group maintained the baseline values as the preconditioning session. The comparison between the paired and unpaired groups showed significant differences in the test session (F(1,8) = 34.26; p < 0.0001).

LFP Recordings During the CFC Test Session

Oscillations in the auditory pathway (Rees et al., 1986) and more specifically in the IC (Lockmann et al., 2017; Pinto et al., 2017) can be entrained by the envelope of an amplitude modulated tone. Furthermore, after an associative learning task in which the auditory stimulus is paired with an aversive stimulus, the temporal dynamics of LFP can change substantially. The phase of evoked oscillation couples to the phase of the amplitude modulated tone and the power significantly increases with the auditory stimulus representations (Lockmann et al., 2017). In this sense, we reproduce the data previously published by our group in an attempt to prove the concept that the developed chamber generates an accurate set of auditory and aversive stimuli.

During the CFC test session, we recorded the oscillatory activity of the ventral region of the IC central nucleus in five rats from paired group. Region that, according to the IC tonotopic organization, perfectly responds to high frequencies (10 kHz - CS auditory stimulus). In addition, we modulate the evoked activity with a specific amplitude envelope (53.7 Hz) to generate a resonant frequency, an SSEP.

As expected, the LFP recorded in the IC shown a distinct power spectral signature embedded in the programed fm (Figures 7A,B) and moreover the SSEP power during the mean trials was significantly higher (∼3-fold) compared to the previous instants outside the trial periods (Figure 7C. t(4) = 11.42; p = 0.0003).

The qualitative analysis of delta phase values extracted from the Hilbert coefficients demonstrates that the angles are organized in clusters without major changes in the mean values. In addition, the data shown a high phase coherence values over each trial, suggesting a high level of synchronization between CS envelope and the SSEP (Figures 7D,E).

Finally, the distribution of instantaneous oscillatory frequencies over trials presented a variation around the modulation frequency, being significantly different from the distribution instantaneous oscillatory frequencies extracted from the previous instants outside the trial periods (Figures 7F,G. KS = 0.3343; p < 0.0001).


The proposed conditioning chamber has an auditory stimulation system which exhibited versatility in programing stimuli characteristics (carrier frequency, modulating frequency, intensity and duration). Furthermore, the equipment also has an aversive stimulation system, based on footshocks applied through electrified bars. Footshock intensity and duration, as well as the number of constant-current pulses per second, can be properly adjusted.

It is important to highlight that the versatility regarding the auditory stimulation system has an important application in providing a characteristic spectral signature in LFP electrophysiological recordings of brain structures processing the sensory stimuli. Lockmann et al. (2017) has shown that a pure, continuous and amplitude-modulated tone may acquire biological relevance since the neural activity of inferior colliculus, responsible for one of the first stages of auditory processing, presents significant changes in their temporal dynamics after conditioning. It is important to highlight that the SSEP provides a unique perspective on evaluating circuitry involved in sensory signal processing once its “tags” the electrophysiological recordings of such brain substrates with a distinct spectral signature assigned by the modulation frequency. Moreover, since the footshock can be precisely manipulated regarding its parameters the system can be used in different behavioral models, as an example of contextual fear conditioning (Pereira et al., 2019) or in studies of post-traumatic stress disorder (Bali and Jaggi, 2015).

In addition, the conditioning chamber architecture easily allows adding new peripherals to its design with little effort, for example: infrared sensors, touchscreens, servomotors (i.e., driving water and food dispensers), among others. This increases the equipment usability as a tool for customized scientific protocol design. However, it should be noted that the audio signal generation represents a considerable demand for the Arduino Due processor, since modulator and carrier waveforms are timed through a very high number of interrupts per second. In this sense, should be considered using another Arduino board in a master-slave architecture for more complex projects in order to incorporate features that require high processing. Furthermore, although using ASSR to evaluate neural circuitry involvement in sensory processing is an interesting improvement to classical conditioning experiments setups, the system still has the major caveat of having electrophysiological recordings compromised by footshock stimuli during the training sessions. In some cases, foot shock stimulation can actually drive recording amplifiers to saturation and, thus, severely contaminate LFP recordings.

As a high-level programing language platform, and with all community support via forums, the Arduino IDE also enables collaborative effort to enhance and enrich the chamber software routines (Web_page.ino and Stimuli.ino sketches). Our project is being made available through open-source initiatives9) and may be modified by collaborators adding new features to both hardware and software. In this publication all the files and tutorials will be available as Supplementary Data Sheet S1.

The initiative to build custom equipment encourages the development of unique investigation methods, exploring the peculiarities of each research group. Versatile and flexible features also allow studying cognitive and behavioral processes that are not observable with ordinary equipment. Finally, this custom equipment is also a low-cost alternative to commercially available devices, making them a very interesting solution for cognition and behavioral research in animals.


The datasets generated for this study are available on request to the corresponding author.


The animal study was reviewed and approved by Institutional Animal Care and Use Committee at the Universidade Federal de Minas Gerais (CEUA-UFMG; protocol no. 112/2014).

Author Contributions

PA-J, FM, and MM conceived and designed the project. PA-J, FM, MA, and MM designed the hardware and code. PA-J performed the sound and footshook validations. HP performed the behavioral tests. LG performed the behavioral analysis. FM and HP performed the surgery and electrophysiological records. FM and VC performed the electrophysiological analysis. FM prepared the figures. HM supervised and contributed to the refinements of the system. PA-J and FM drafted the manuscript. FM, MM, and HM edited and revised the manuscript. All authors approved the final version of the manuscript.


This work was supported by PRPq/UFMG (02/2019), CNPq (307354/2017-2 and 425746/2018-6), CAPES (PROCAD2013-184014 and STINT 88881.155788/2017-01), and FAPEMIG (CBB – APQ-03261-16).

Conflict of Interest

The authors declare that the research was conducted in the absence of any commercial or financial relationships that could be construed as a potential conflict of interest.


We would like to thank Grace Schenatto Pereira Moraes for helpful comments on the manuscript, and Davi Barreto Mourão and Frederico José Barreto Mourão for scientific inspiration.

Supplementary Material

The Supplementary Material for this article can be found online at:


  1. ^
  2. ^
  3. ^
  4. ^
  5. ^
  6. ^
  7. ^
  8. ^
  9. ^


Bali, A., and Jaggi, A. S. (2015). Electric foot shock stress: a useful tool in neuropsychiatric studies. Rev. Neurosci. 26, 655–677. doi: 10.1515/revneuro-2015-0015

PubMed Abstract | CrossRef Full Text | Google Scholar

Baron, A. (1959). Functions of CS and US in fear conditioning. J. Comp. Physiol. Psychol. 52, 591–593. doi: 10.1037/h0044913

PubMed Abstract | CrossRef Full Text | Google Scholar

Blanchard, D. C., and Blanchard, R. J. (1972). Innate and conditioned reactions to threat in rats with amygdaloid lesions. J. Comp. Physiol. Psychol. 81, 281–290. doi: 10.1037/h0033521

PubMed Abstract | CrossRef Full Text | Google Scholar

Boashash, B. (1992). Estimating and interpreting the instantaneous frequency of a signal. I. Fundamentals. Proc. IEEE 80, 520–538. doi: 10.1109/5.135376

CrossRef Full Text | Google Scholar

Buccino, A. P., Lepperød, M. E., Dragly, S.-A., Häfliger, P., Fyhn, M., and Hafting, T. (2018). Open source modules for tracking animal behavior and closed-loop stimulation based on Open Ephys and Bonsai. J. Neural Eng. 15:055002. doi: 10.1088/1741-2552/aacf45

PubMed Abstract | CrossRef Full Text | Google Scholar

Clopton, B. M., and Winfield, J. A. (1973). Tonotopic organization in the inferior colliculus of the rat. Brain Res. 56, 355–358. doi: 10.1016/0006-8993(73)90352-1

CrossRef Full Text | Google Scholar

Cohen, M. X. (2014). Fluctuations in oscillation frequency control spike timing and coordinate neural networks. J. Neurosci. 34, 8988–8998. doi: 10.1523/JNEUROSCI.0261-14.2014

PubMed Abstract | CrossRef Full Text | Google Scholar

Collins, D. R. (2000). Differential fear conditioning induces reciprocal changes in the sensory responses of lateral amygdala neurons to the CS and CS-. Learn. Mem. 7, 97–103. doi: 10.1101/lm.7.2.97

PubMed Abstract | CrossRef Full Text | Google Scholar

Curzon, P., Rustay, N. R., and Browman, K. E. (2009). “Cued and contextual fear conditioning for rodents,” in Methods of Behavior Analysis in Neuroscience, ed. J. J. Buccafusco, (Boca Raton, FL: CRC).

Google Scholar

Cushman, J. D., Aharoni, D. B., Willers, B., Ravassard, P., Kees, A., Vuong, C., et al. (2013). Multisensory control of multimodal behavior: do the legs know what the tongue is doing? PLoS One 8:e80465. doi: 10.1371/journal.pone.0080465

PubMed Abstract | CrossRef Full Text | Google Scholar

D’Ausilio, A. (2012). Arduino: a low-cost multipurpose lab equipment. Behav. Res. Methods 2, 305–313. doi: 10.3758/s13428-011-0163-z

PubMed Abstract | CrossRef Full Text | Google Scholar

Duvarci, S., and Pare, D. (2014). Amygdala microcircuits controlling learned fear. Neuron 82, 966–980. doi: 10.1016/j.neuron.2014.04.042

PubMed Abstract | CrossRef Full Text | Google Scholar

Fanselow, M. S., and Bolles, R. C. (1979). Naloxone and shock-elicited freezing in the rat. J. Comp. Physiol. Psychol. 93, 736–744. doi: 10.1037/h0077609

PubMed Abstract | CrossRef Full Text | Google Scholar

Holland, P. C. (1977). Conditioned stimulus as a determinant of the form of the Pavlovian conditioned response. J. Exp. Psychol. Anim. Behav. Process. 3, 77–104. doi: 10.1037//0097-7403.3.1.77

PubMed Abstract | CrossRef Full Text | Google Scholar

Kim, J. J., and Jung, M. W. (2006). Neural circuits and mechanisms involved in Pavlovian fear conditioning: a critical review. Neurosci. Biobehav. Rev. 30, 188–202. doi: 10.1016/j.neubiorev.2005.06.005

PubMed Abstract | CrossRef Full Text | Google Scholar

Kuwada, S., Batra, R., and Maher, V. L. (1986). Scalp potentials of normal and hearing-impaired subjects in response to sinusoidally amplitude-modulated tones. Hear. Res. 21, 179–192. doi: 10.1016/0378-5955(86)90038-9

PubMed Abstract | CrossRef Full Text | Google Scholar

Lachaux, J. P., Rodriguez, E., Martinerie, J., and Varela, F. J. (1999). Measuring phase synchrony in brain signals. Hum. Brain Mapp. 8, 194–208. doi: 10.1002/(sici)1097-0193(1999)8:4<194::aid-hbm4>;2-c

PubMed Abstract | CrossRef Full Text | Google Scholar

Liu, L. F., Palmer, A. R., and Wallace, M. N. (2006). Phase-locked responses to pure tones in the inferior colliculus. J. Neurophysiol. 95, 1926–1935. doi: 10.1152/jn.00497.2005

PubMed Abstract | CrossRef Full Text | Google Scholar

Lockmann, A. L. V., Mourão, F. A. G., and Moraes, M. F. D. (2017). Auditory fear conditioning modifies steady-state evoked potentials in the rat inferior colliculus. J. Neurophysiol. 118, 1012–1020. doi: 10.1152/jn.00293.2017

PubMed Abstract | CrossRef Full Text | Google Scholar

Malmierca, M. S., Izquierdo, M. A., Cristaudo, S., Hernández, O., Pérez-González, D., Covey, E., et al. (2008). A discontinuous tonotopic organization in the inferior colliculus of the rat. J. Neurosci. 28, 4767–4776. doi: 10.1523/JNEUROSCI.0238-08.2008

PubMed Abstract | CrossRef Full Text | Google Scholar

Maren, S. (2001). Neurobiology of pavlovian fear conditioning. Annu. Rev. Neurosci. 24, 897–931. doi: 10.1146/annurev.neuro.24.1.897

PubMed Abstract | CrossRef Full Text | Google Scholar

Maren, S., Yap, S. A., and Goosens, K. A. (2001). The amygdala is essential for the development of neuronal plasticity in the medial geniculate nucleus during auditory fear conditioning in rats. J. Neurosci. 21:RC135.

PubMed Abstract | Google Scholar

Meeren, H. K. M., van Cappellen van Walsum, A. M., van Luijtelaar, E. L. J. M., and Coenen, A. M. L. (2001). Auditory evoked potentials from auditory cortex, medial geniculate nucleus, and inferior colliculus during sleep–wake states and spike-wave discharges in the WAG/Rij rat. Brain Res. 898, 321–331. doi: 10.1016/s0006-8993(01)02209-0

CrossRef Full Text | Google Scholar

Mormann, F., Lehnertz, K., David, P., and Elger, C. E. (2000). Mean phase coherence as a measure for phase synchronization and its application to the EEG of epilepsy patients. Physica D 144, 358–369. doi: 10.1016/j.clinph.2013.09.047

PubMed Abstract | CrossRef Full Text | Google Scholar

Mourão, F. A. G., Lockmann, A. L. V., Castro, G. P., de Castro Medeiros, D., Reis, M. P., Pereira, G. S., et al. (2016). Triggering different brain states using asynchronous serial communication to the rat amygdala. Cereb. Cortex 26, 1866–1877. doi: 10.1093/cercor/bhu313

PubMed Abstract | CrossRef Full Text | Google Scholar

Paxinos, G., and Watson, C. (2007). The Rat Brain in Stereotaxic Coordinates, 6th Edn. Amsterdam: Elsevier Science.

Google Scholar

Pereira, L. M., de Castro, C. M., Guerra, L. T. L., Queiroz, T. M., Marques, J. T., and Pereira, G. S. (2019). Hippocampus and prefrontal cortex modulation of contextual fear memory is dissociated by inhibiting de novo transcription during late consolidation. Mol. Neurobiol. 56, 5507–5519. doi: 10.1007/s12035-018-1463-4

PubMed Abstract | CrossRef Full Text | Google Scholar

Picton, T. W., Sasha John, M., Purcell, D. W., and Plourde, G. (2003). Human auditory steady-state responses: the effects of recording technique and state of arousal. Anesth. Analg. 97, 1396–1402. doi: 10.1213/01.ane.0000082994.22466.dd

PubMed Abstract | CrossRef Full Text | Google Scholar

Pineño, O. (2014). ArduiPod box: a low-cost and open-source Skinner box using an iPod Touch and an Arduino microcontroller. Behav. Res. Methods 46, 196–205. doi: 10.3758/s13428-013-0367-5

PubMed Abstract | CrossRef Full Text | Google Scholar

Pinto, H. P. P., Carvalho, V. R., Medeiros, D., Almeida, A. F. S., Mendes, E. M. A. M., and Moraes, M. F. D. (2017). Auditory processing assessment suggests that Wistar audiogenic rat neural networks are prone to entrainment. Neuroscience 347, 48–56. doi: 10.1016/j.neuroscience.2017.01.043

PubMed Abstract | CrossRef Full Text | Google Scholar

Quirk, G. J., Christopher Repa, J., and LeDoux, J. E. (1995). Fear conditioning enhances short-latency auditory responses of lateral amygdala neurons: parallel recordings in the freely behaving rat. Neuron 15, 1029–1039. doi: 10.1016/0896-6273(95)90092-6

PubMed Abstract | CrossRef Full Text | Google Scholar

Rees, A., Green, G. G., and Kay, R. H. (1986). Steady-state evoked responses to sinusoidally amplitude-modulated sounds recorded in man. Hear. Res. 23, 123–133. doi: 10.1016/0378-5955(86)90009-2

PubMed Abstract | CrossRef Full Text | Google Scholar

Rescorla, R. A. (1967). Pavlovian conditioning and its proper control procedures. Psychol. Rev. 74, 71–80. doi: 10.1037/h0024109

PubMed Abstract | CrossRef Full Text | Google Scholar

Siegle, J. H., López, A. C., Patel, Y. A., Abramov, K., Ohayon, S., and Voigts, J. (2017). Open Ephys: an open-source, plugin-based platform for multichannel electrophysiology. J. Neural Eng. 14:045003. doi: 10.1088/1741-2552/aa5eea

PubMed Abstract | CrossRef Full Text | Google Scholar

Sinard, J. H., and Gershkovich, P. (2012). Custom software development for use in a clinical laboratory. J. Pathol. Inform. 3:44. doi: 10.4103/2153-3539.104906

PubMed Abstract | CrossRef Full Text | Google Scholar

Squire, L. R. (2009). Memory and brain systems: 1969-2009. J. Neurosci. 29, 12711–12716. doi: 10.1523/jneurosci.3575-09.2009

CrossRef Full Text | Google Scholar

Teikari, P., Najjar, R. P., Malkki, H., Knoblauch, K., Dumortier, D., Gronfier, C., et al. (2012). An inexpensive Arduino-based LED stimulator system for vision research. J. Neurosci. Methods 211, 227–236. doi: 10.1016/j.jneumeth.2012.09.012

PubMed Abstract | CrossRef Full Text | Google Scholar

Tsytsarev, V., Fukuyama, H., Pope, D., Pumbo, E., and Kimura, M. (2009). Optical imaging of interaural time difference representation in rat auditory cortex. Front. Neuroeng. 2:2. doi: 10.3389/neuro.16.002.2009

PubMed Abstract | CrossRef Full Text | Google Scholar

Walters, G., and Tullis, C. (1966). Skin resistance changes in the rat during repeated encounters with electric shock. Psychon. Sci. 5, 359–360. doi: 10.3758/bf03328438

CrossRef Full Text | Google Scholar

White, S. R., Amarante, L. M., Kravitz, A. V., and Laubach, M. (2019). The future is open: open-source tools for behavioral neuroscience research. eNeuro 6:ENEURO.223-19.2019.

Google Scholar

Keywords: classical fear conditioning, custom conditioning chamber, laboratory equipment, internet of things, Arduino, ESP8266

Citation: Amaral-Júnior PA, Mourão FAG, Amancio MCL, Pinto HPP, Carvalho VR, Guarnieri LO, Magalhães HA and Moraes MFD (2019) A Custom Microcontrolled and Wireless-Operated Chamber for Auditory Fear Conditioning. Front. Neurosci. 13:1193. doi: 10.3389/fnins.2019.01193

Received: 21 August 2019; Accepted: 21 October 2019;
Published: 07 November 2019.

Edited by:

Ioan Opris, University of Miami, United States

Reviewed by:

Vassiliy Tsytsarev, University of Maryland, College Park, United States
Lex Kravitz, Washington University in St. Louis, United States

Copyright © 2019 Amaral-Júnior, Mourão, Amancio, Pinto, Carvalho, Guarnieri, Magalhães and Moraes. This is an open-access article distributed under the terms of the Creative Commons Attribution License (CC BY). The use, distribution or reproduction in other forums is permitted, provided the original author(s) and the copyright owner(s) are credited and that the original publication in this journal is cited, in accordance with accepted academic practice. No use, distribution or reproduction is permitted which does not comply with these terms.

*Correspondence: Márcio Flávio Dutra Moraes,

These authors have contributed equally to this work