electronics

Article A Closed-Loop Optogenetic Stimulation Device

Epsy S. Edward and Abbas Z. Kouzani *

School of Engineering, Deakin University, Geelong, Victoria 3216, Australia; [email protected] * Correspondence: [email protected]; Tel.: +61-3-52272818

 Received: 20 November 2019; Accepted: 27 December 2019; Published: 3 January 2020 

Abstract: Closed-loop optogenetic stimulation devices deliver optical stimulations based on real-time measurement and analysis of neural responses to stimulations. However, the use of large bench-top and tethered devices hinders the naturalistic test environment, which is crucial in pre-clinical studies involving small rodent subjects. This paper presents a tetherless, lightweight and miniaturized head-mountable closed-loop optogenetic stimulation device. The device consists of three hardware modules: a hybrid electrode, an detector, and an optogenetic stimulator. In addition, the device includes three software modules: a feature extractor, a control algorithm, and a pulse generator. The details of the design, implementation, and bench-testing of the device are presented. Furthermore, an in vitro test environment is formed using synthetic neural signals, wherein the device is validated for its closed-loop performance. During the in vitro validation, the device was able to identify abnormal neural signals, and trigger optical stimulation. On the other hand, it was able to also distinguish normal neural signals and inhibit optical stimulation. The overall power consumption of the device is 24 mW. The device measures 6 mm in radius and weighs 0.44 g excluding the power source.

Keywords: action potential detector; closed-loop control; deep stimulation; hybrid electrode; optogenetic stimulator

1. Introduction Neuroscientists required a technology to selectively excite or inhibit neural structures of the brain. They used electrical deep brain stimulation to modulate target brain regions [1]. However, electrical stimulation lacks cell-specific access during neuromodulation [2]. Therefore, light-based stimulation called optogenetics has emerged for cell-specific modulation [3]. Optogenetics is a stimulation technique that uses light to control the neural activity of the brain [4]. In this method, the target are transfected with microbial that are sensitive to light. The unique combination of opsins and light wavelengths defines the type of neuromodulation (excitation or inhibition) of the neurons. In contrast to electrical stimulation, optogenetics provides enhanced spatial and temporal resolution during the neural stimulation. However, many of optogenetic stimulation implementations are driven by pre-defined stimulation patterns called open-loop stimulation which disregards the neural responses to neural stimulations [5]. Closed-loop optogenetic stimulation (CLOS), on the other hand, modulates the neurons based on real-time measurement and analysis of neural responses. This approach enhances the efficacy of neuromodulation [6] and is being explored as an option for investigating neuropsychiatric disorders [7], particularly for pre-clinical studies involving small animals. Krook-Magnuson et al. [8] presented a CLOS device to selectively modulate specific- cells upon detection of seizure activity in the brain. The device acquired electrophysiological readout through electroencephalogram (EEG). However, the latter stages of amplification, filtration, digitization and control-logic executions relied on a computer-based setup, which implemented customized seizure detection algorithm, followed by on-demand activation of optical output. Optical neuromodulation was

Electronics 2020, 9, 96; doi:10.3390/electronics9010096 www.mdpi.com/journal/electronics Electronics 2020, 9, 96 2 of 17 delivered by a laser source, which was controlled by signals generated by a digitizer. Laxpati et al. [9] reported a CLOS device using an open-source platform and commercially available modules. The device employed the open-source software tool NeuroRighter [10] to implement cost-effective real-time closed-loop optogenetic neuromodulations. NeuroRighter acquired electrophysiological readouts from the target brain region, followed by real-time isolation of single cell activity and local-field potentials, online signal analysis, and visualization. Furthermore, NeuroRighter was also responsible for performing positive and negative threshold crossing, superparamagnetic clustering, signal classification, closed-loop control and modulation of stimulation parameters. Optical neuromodulations were also delivered using a commercially available Plexon LED (Plexon Inc., Dallas, TX, USA), and associated electronics. The overall device implementation was validated in vivo for both open and closed-loop stimulations. Nguyen et al. [11] implemented a CLOS device suitable for neuro-prosthetic and scientific research applications. The device performed a 32-channel low-noise neural recording, followed by online signal analysis using spike detection and classification through spike sorting. The stages of signal acquisition and online signal processing was carried out using a Neuralynx system (Neuralynx Inc., Bozeman, MT, USA) and a custom-built MATLAB (MathWorks, Natick, MA, USA) code deployed in LabVIEW (National Instruments, Austin, TX, USA). In this system, on-demand neuromodulations were delivered when a specific spike cluster were identified. Optical stimulation was delivered by an LED light-source controlled by pulses. The device was validated in vivo and achieved reduced delay with overall real-time processing time of 8 ms. Newman et al. [12] illustrated an optoclamp based control, to deliver real-time closed-loop optical stimulations. A 59-channel microelectrode array was employed to acquire electrical neural activity. The stages of online signal analysis were performed in a RZ2 bio-acquisition system (Tucker-Davis Technologies, USA), while the optical stimulations were delivered using a high-power LED and custom LED drive circuitry. Alternatively, for in vitro implementation, NeuroRighter was employed to acquire and analyze real-time neural data. The device demonstrated proportional-integral control and on-off control. Based on the online control signal, the stimulation parameters (e.g., light intensity, frequency, and pulse width) were modulated, which in turn altered the optical output of the light-source. Pashaie et al. [13] reported a distinct approach of delivering CLOS using micro- (micro-ECoG) fabricated on an optically transparent substrate. The device performed online signal processing using a computer-based setup. The closed-loop algorithm was realized using proportional control logic, for which a pre-defined spatial-temporal activity was determined to estimate the error signal. Based on the calculated deviation, the stimulation parameters were modulated until the desired neural response was achieved. Optical stimulations were controlled by a programmable digital micro-mirror device (DVD), which modulated the optical output of the laser and arc-lamp. The device demonstrated a single-site and multi-site CLOS suitable for mathematical modelling of neural activity. It is evident that most of the existing approaches require tethered benchtop settings to achieve closed-loop neuromodulation. A suitable miniaturized device that addresses the issues of weight, size, and tethering in CLOS is required. This paper presents a lightweight, tetherless, and miniature head-mountable solution that hosts the necessary components to deliver CLOS to small laboratory animals. The design, construction, and evaluation of the CLOS device are presented. It can be carried by small laboratory animals without significant disruption of their natural behavior, which makes the device suitable for pre-clinical studies.

2. Closed-Loop Optogenetic Stimulation System The proposed CLOS device (see Figure1) consists of two components: hardware and software. The hardware component comprises three modules: a hybrid electrode (HE), an action potential detector (APD), and an optogenetic deep brain stimulator (ODBS). The software component consists of three modules also: a feature extractor (FE), a control algorithm (CA), and a pulse generator (PG). Electronics 2019, 8, x FOR PEER REVIEW 3 of 17

APD consists of a pre-amplifier, a band pass filter, and a post-amplifier. The pre-amplifier magnifies the signal by a fixed gain of 160 times. The band pass filer passes signals within the frequency range of 300 Hz and 6 kHz. The post-amplifier further amplifies the signal by a gain of 160 times. The signal from the APD output is then fed to the microcontroller in the ODBS. The microcontroller hosts the software component which analyses the neural signals and implements the closed-loop CA. Based on the output of the CA, the microcontroller controls the LED driver circuitry, which in turn modulatesElectronics 2020 the, 9, 96LED (see Section 3 for the description of the design and function of the hardware3 of 17 component). Electronics 2019, 8, x FOR PEER REVIEW 3 of 17

APD consists of a pre-amplifier, a band pass filter, and a post-amplifier. The pre-amplifier magnifies the signal by a fixed gain of 160 times. The band pass filer passes signals within the frequency range of 300 Hz and 6 kHz. The post-amplifier further amplifies the signal by a gain of 160 times. The signal from the APD output is then fed to the microcontroller in the ODBS. The microcontroller hosts the software component which analyses the neural signals and implements the closed-loop CA. Based on the output of the CA, the microcontroller controls the LED driver circuitry, which in turn modulates the LED (see Section 3 for the description of the design and function of the hardware component).

FigureFigure 1. ProposedProposed closed-loop optogenetic stimulation device. ( (aa)) Hybrid electrode. ( (bb)) Action Action potential detector. ( cc)) Optogenetic Optogenetic deep deep brain brain stimulator.

WithinThe HE the hosts software two detection component, electrodes the FE and characteri a stimulationzes the LED.neural The signals detection based electrodes on their amplitude detect the variations.neural signals The fromCA implements the target neurons, a closed-loop which on-off are then logic. fed The as PG input controls to the the APD. stimulation The APD parameters selectively (e.g.,isolates pulse the width, neural signalsduty cycle from and the frequency), surrounding modu noiselating signals the and LED amplifies (see Section them. 4 The for APDthe description consists of ofa pre-amplifier,the design and a band function pass filter,of the and software a post-amplifier. component). The pre-amplifierFigure 2 shows magnifies the head-mountable the signal by a configurationfixed gain of 160of the times. CLOS The device band for pass use filer with passes small signals laboratory within animals. the frequency range of 300 Hz and 6 kHz. The post-amplifier further amplifies the signal by a gain of 160 times. The signal from the APD output is then fed to the microcontroller in the ODBS. The microcontroller hosts the software componentFigure which 1. Proposed analyses closed-loop the neural optogenetic signals and stimulation implements device. the closed-loop (a) Hybrid CA.electrode. Based ( onb) theAction output of thepotential CA, the microcontrollerdetector. (c) Optogenetic controls deep the LEDbrain driverstimulator. circuitry, which in turn modulates the LED (see Section3 for the description of the design and function of the hardware component). WithinWithin the the software software component, component, the the FE FE characterizes characterizes the the neural neural signals signals based based on on their their amplitude amplitude variations.variations. The The CA CA implements implements a a closed-loop closed-loop on-o on-offff logic. logic. The The PG PG controls controls the the stimulation stimulation parameters parameters (e.g.,(e.g., pulse pulse width, width, duty duty cycle cycle and and frequency), frequency), modulating modulating the the LED LED (see (see Section Section4 for 4 thefor descriptionthe description of theof designthe design and function and function of the software of the component).software component). Figure2 shows Figure the head-mountable2 shows the head-mountable configuration ofconfiguration the CLOS device of the for CLOS use with device small for laboratoryuse with small animals. laboratory animals. Figure 2. Head-mountable configuration.

3. Hardware Component

3.1. Hybrid Electrode The hybrid electrode is designed to be easily implantable into the target brain region and is capable of simultaneous neural signal detection and optical stimulation (see Figure 3). In this work, the ODBS module is designed to deliver optical stimulation to activate light-sensitive protein 2 (ChR2). To activate ChR2 transfected neurons, 470 nm light of 1 mW/mm irradiance is required [14]. However, the power consumption of LED plays a crucial role in defining FigureFigure 2. 2.Head-mountable Head-mountable configuration. configuration. the operational duration. Lee et al. [15] reported the need for high driving current of about 1.0 A for 3. Hardware2 Component 27mW/mm3. Hardware irradiance, Component which was due to poor coupling efficiency of the fiber/LED coupler. After detailed review of optical and electrical features of various LEDs, Cree chip-LED (Cree Inc., Durham, 3.1. Hybrid Electrode 3.1. Hybrid Electrode The hybrid electrode is designed to be easily implantable into the target brain region and is capable of simultaneousThe hybrid neural electrode signal is detectiondesigned and to be optical easily stimulation implantable (see into Figure the3 ).target In this brain work, region the ODBS and is modulecapable is of designed simultaneous to deliver neural optical signal stimulation detection toand activate optical light-sensitive stimulation (see protein Figure Channelrhodopsin 3). In this work, (ChR2).the ODBS To activate module ChR2 is designed transfected to neurons,deliver optical 470 nm stimulation light of 1 mW to/ mmactivate2 irradiance light-sensitive is required protein [14]. However,Channelrhodopsin the power (ChR2). consumption To activate of LED ChR2 plays tr aansfected crucial role neurons, in defining 470 thenm operational light of 1 duration.mW/mm2 Leeirradiance et al. [15 is] reportedrequired [14]. the need However, for high the driving power consumption current of about of LED 1.0 A plays for 27 a crucial mW/mm role2 irradiance, in defining the operational duration. Lee et al. [15] reported the need for high driving current of about 1.0 A for 27mW/mm2 irradiance, which was due to poor coupling efficiency of the fiber/LED coupler. After detailed review of optical and electrical features of various LEDs, Cree chip-LED (Cree Inc., Durham,

Electronics 2020, 9, 96 4 of 17

Electronicswhich was 2019 due, 8, xto FOR poor PEER coupling REVIEWe fficiency of the fiber/LED coupler. After detailed review of optical4 of and 17 electrical features of various LEDs, Cree chip-LED (Cree Inc., Durham, NC, USA) [16] was employed NC,in our USA) work. [16] Creewas employed chip-LEDs in can our deliverwork. Cree peak chip optical-LEDs power can deliver output peak of about optical 33 power mW suitable output forof aboutCLOS. 33 Optical mW suitable stimulations for CLOS. are Optical delivered stimulations by the Cree are chip-LED delivered DA2432 by the Cree of size chip-LED 240 µm DA2432320 µ ofm, × sizehosted 240 nearμm × the 320 tip μ ofm, thehosted HE. Thenear neural the tip activity of the HE. is sensed The neural by two activity detection is sensed electrodes by two of size detection 150 µm electrodes150 µm of each, size located150 μm adjacent× 150 μm to each, the LED.located One adjacent of the to electrodes the LED. acts One as of a the reference electrodes input, acts while as a × referencethe other input, as the while channel the inputother toas thethe APDchannel module. input to The the illumination APD module. of The the LEDillumination is controlled of the by LED the isODBS controlled module. by the For ODBS easier module. integration For easier of the integr implantableation of electrodethe implantable to the headstageelectrode to (including the headstage APD (includingand ODBS), APD four and connecting ODBS), four pads connecting with through pads holes with through are included holes near are included the rearend near of the the rear HE end in a ofstacked the HE configuration. in a stacked Theconfiguration. use of onboard The chip-LEDuse of onboard in the HEchip-LED enhances in thethe deviceHE enhances portability. the Thedevice use portability.of chip-LED The in theuse HEof chip-LED also eliminates in the the HE optical also eliminates power losses the due optical to the power fiber /LEDlosses coupling due to [the17]. fiber/LEDThe entire coupling electrode [17]. is fabricated The entire on aelectrode flexible PCBis fabr oficated size 16 on mm a inflexible length PCB and of 1.2 size mm 16 in mm width in suitablelength andfor chronic1.2 mm in neuromodulation. width suitable for The chronic LED neuromodul is hand solderedation. with The LED the help is hand of a soldered 120-times with ASH the Digital help ofMicroscope a 120-times and ASH Measurement Digital Microscope System (Ash and TechnologiesMeasurement Ltd, System Ireland), (Ash and Technologies then tested alongLtd, Ireland), with the andAPD then and tested ODBS along for CLOS. with the APD and ODBS for CLOS.

FigureFigure 3. 3. (a(a) )Hybrid Hybrid electrode. electrode. (b (b) )Electrode Electrode size. size. (c ()c )Operation Operation of of the the LED. LED.

3.2.3.2. Action Action Potential Potential Detector Detector TheThe Action Action Potential Potential Detector Detector (APD) (APD) comprises comprises of of three three stage stage amplification amplification and and filtration filtration circuit, circuit, wherewhere the the neural neural signals signals detected detected by by the the HE HE are are isolated isolated from from the the surroun surroundingding noise noise signals signals and and amplifiedamplified to to a a suitable suitable level level for for further further processing processing in in the the ODBS. ODBS. 3.2.1. Pre-Amplifier 3.2.1. Pre-Amplifier In the pre-amplifier stage, the detected neural signals are amplified by the AD8293 amplifier [18], In the pre-amplifier stage, the detected neural signals are amplified by the AD8293 amplifier see Figure4. It provides a fixed gain of 160-times. The output of the pre-amplifier stage is: [18], see Figure 4. It provides a fixed gain of 160-times. The output of the pre-amplifier stage is: 2𝑅22R2 V𝑉OUTOUT =𝑉= VREFREF++ 𝑉(INPVINP𝑉INNVINN ) (1)(1) 𝑅1R1 − wherewhere VVINPINP isis the the positive positive input input terminal terminal of of the the amplifier, amplifier, VVINNINN isis the the negative negative input input terminal terminal of of the the amplifier,amplifier, VVREFREF isis the the internal internal voltage voltage shift shift set set by by a a voltage voltage divider divider circuit, and VOUT isis the the output output of of thethe pre-amplifier pre-amplifier stage. stage.

3.2.2. Band Pass Filter In the band pass filter stage, a two-pole low pass filter and a passive high pass filter are implemented. Based on the AP signal characteristics, the high pass and low pass cut-off frequencies are estimated to be 300 Hz and 6 kHz, respectively. The AD8293 is configured to perform low pass filtration with two external capacitors (C2 and C3). This is followed by a passive high pass filter with a cut-off frequency of 300 Hz.

Electronics 2020, 9, 96 5 of 17 Electronics 2019, 8, x FOR PEER REVIEW 5 of 17

FigureFigure 4.4. Schematic of the action potential detector.

3.2.2.3.2.3. BandPost-Amplifier Pass Filter InIn the the band post-amplification pass filter stage, stage, a two-pole the neural low pass signals filter andare further a passive amplified high pass by filter a factor are implemented. of 10. The BasedAD8237 on micro the AP power signal amplifier characteristics, [19] is theincorporated high pass andin this low stage, pass cut-osee Figureff frequencies 4. The gain are estimatedis set using to betwo 300 external Hz and resistors 6 kHz, respectively.according to: The AD8293 is configured to perform low pass filtration with two external capacitors (C2 and C3). This is followed by𝑅5 a passive high pass filter with a cut-off frequency 𝐺 = 1 + (2) of 300 Hz. 𝑅4 3.2.3.Depending Post-Amplifier on the required frequency bandwidth and gain factor, the bandwidth mode is set via Pin 1 of AD8237. In this design, R4 and R5 values are configured to achieve 10-times gain within a 10 In the post-amplification stage, the neural signals are further amplified by a factor of 10. The AD8237 kHz frequency range, to fulfil the AP signal characteristics. micro power amplifier [19] is incorporated in this stage, see Figure4. The gain is set using two external The printed circuit board (PCB) of the APD was designed using EAGLE (Autodesk, USA). The resistors according to: choice of electronic components and the compact PCB design significantly downsized the APD R5 module and ensured robust coupling to theG ODBS= 1 + and the HE. The radius of the fabricated and(2) R4 assembled APD is about 6 mm. Depending on the required frequency bandwidth and gain factor, the bandwidth mode is set via Pin3.3. 1Optogenetic of AD8237. Deep In thisBrain design, StimulatorR4 and (ODBS)R5 values are configured to achieve 10-times gain within a 10 kHz frequency range, to fulfil the AP signal characteristics. TheThe printedODBS samples circuit boardand digitizes (PCB) ofthe the amplified APD was neural designed signal, using runs the EAGLE control (Autodesk, algorithm, USA). and Theoperates choice the of light electronic source. components The circuit diagram and the compactof the optogenetic PCB design stimulator significantly is shown downsized in Figure the 5. APD The moduleoptogenetic and stimulator ensured robust comprises coupling a pico-power to the ODBS microcontroller and the HE. ATtiny The radius 44A [2 of0], thea constant fabricated current and assembledLED driver APD CAT4104 is about [21], 6 mm.a port for connection to a 475 nm stimulation LED, and an on-board LED for interaction with the user. 3.3. OptogeneticThe device Deep benefits Brain from Stimulator an Atmel (ODBS) ATtiny 44A microcontroller. It is a high-performance pico- power 8-bit microcontroller featuring 4 KB flash program , 256B data SRAM, 256B EEPROM, The ODBS samples and digitizes the amplified neural signal, runs the control algorithm, and 12 general purpose I/O lines, an 8-bit timer/counter, a 16-bit timer/counter, internal and external operates the light source. The circuit diagram of the optogenetic stimulator is shown in Figure5. interrupts, an 8-channel 10-bit A/D converter, a programmable watchdog timer, an internal calibrated The optogenetic stimulator comprises a pico-power microcontroller ATtiny 44A [20], a constant current oscillator, and four power saving modes. The microcontroller can operate with a voltage source LED driver CAT4104 [21], a port for connection to a 475 nm stimulation LED, and an on-board LED for within the range 1.8–5.5 V. Its program memory can be reprogrammed in-system through an SPI interaction with the user. serial interface. The microcontroller is supported by a suite of programs as well as system The device benefits from an Atmel ATtiny 44A microcontroller. It is a high-performance development tools such as C compiler. Atmel Studio is an integrated development platform for pico-power 8-bit microcontroller featuring 4 KB flash program memory, 256B data SRAM, 256B developing and debugging the Atmel microcontroller-based applications. A 100 nF capacitor is used EEPROM, 12 general purpose I/O lines, an 8-bit timer/counter, a 16-bit timer/counter, internal and between the VCC and GND pins of the microcontroller to bypass any undesired high-frequency external interrupts, an 8-channel 10-bit A/D converter, a programmable watchdog timer, an internal signals to ground. A pulse width modulation (PWM) signal is generated on bit 5 of Port A. The signal calibrated oscillator, and four power saving modes. The microcontroller can operate with a voltage is used to control the operation of the stimulation LED through the LED driver CAT4104. Three 100 source within the range 1.8–5.5 V. Its program memory can be reprogrammed in-system through an SPI μF capacitors are used to smooth out current surges during the pulsing of the stimulation LED. serial interface. The microcontroller is supported by a suite of programs as well as system development The devices employ a quad channel constant current LED driver CAT4104. It facilitates four tools such as C compiler. Atmel Studio is an integrated development platform for developing and matched low dropout current sinks to drive high-brightness LED strings up to 175 mA per channel. The LED channel current is set by an external resistor (RSET) according to:

Electronics 2020, 9, 96 6 of 17 debugging the Atmel microcontroller-based applications. A 100 nF capacitor is used between the VCC and GND pins of the microcontroller to bypass any undesired high-frequency signals to ground. A pulse width modulation (PWM) signal is generated on bit 5 of Port A. The signal is used to control the operation of the stimulation LED through the LED driver CAT4104. Three 100 µF capacitors are used to smooth out current surges during the pulsing of the stimulation LED. The devices employ a quad channel constant current LED driver CAT4104. It facilitates four matchedElectronics 2019 low, 8 dropout, x FOR PEER current REVIEW sinks to drive high-brightness LED strings up to 175 mA per channel.6 of 17 Electronics 2019, 8, x FOR PEER REVIEW 6 of 17 The LED channel current is set by an external resistor (RSET) according to: 1.2𝑉 𝐼LED ≅ 100 1.2V (3) I 100 1.2𝑉𝑅SET (3) 𝐼LED ≅ 100 (3) × RSET A 10 kΩ resistor is thus used to set the LED current 𝑅toSET 12 mA. The EN/PWM logic input supports the deviceA 10 10 k k enableΩΩ resistorresistor and is is high thus thus frequency used used to to set set external the the LED LED PW curre currentM dimmingnt to to 12 12 mA. mA. control. The The EN/PWM ENFigure/PWM 6 shows logic logic input inputthe assembled supports supports thetheAPD device device and ODBSenable enable boards. and and high high frequency frequency external PW PWMM dimming control. Figure Figure 66 showsshows thethe assembledassembled APD and ODBS boards.

Figure 5. Schematic of the optogenetic stimulator. FigureFigure 5. SchematicSchematic of of the the optogenetic optogenetic stimulator. stimulator.

(a) (b) (c) (a) (b) (c) Figure 6.6. (a) UnassembledUnassembled board. ( (b)) Action potential detector (APD). (c) OptogeneticOptogenetic deepdeep brainbrain Figurestimulator 6. ( a (ODBS).(ODBS).) Unassembled board. (b) Action potential detector (APD). (c) Optogenetic deep brain stimulator (ODBS). 3.4. Power Source 3.4. Power Source 3.4. Power Source The entire CLOS device is powered by a 3.7 V 30 mAh Lithium Ion Polymer battery, for the durationThe ofentireof per-clinical per-clinical CLOS device studies. studies. is Thispowered This power power by source a source 3.7 allowsV 30allows mAh uninterrupted uninterrupted Lithium Ion operation Polymer operation of thebattery, of CLOS the for deviceCLOS the durationfordevice over for 5of h,over per-clinical making 5 h, making it suitable studies. it suitable for This pre-clinical forpower pre-clinical source neuroscience allowsneuroscience studies. uninterrupted studies. operation of the CLOS device for over 5 h, making it suitable for pre-clinical neuroscience studies. 3.5. Integration of the CLOS Device 3.5. Integration of the CLOS Device 3.5. IntegrationThe three of hardware the CLOS modulesDevice including the HE, APD, and ODBS are integrated as shown in The three hardware modules including the HE, APD, and ODBS are integrated as shown in Figure7. The device weighs only 0.44 g excluding the battery and 1.07 g with the battery. The electronic FigureThe 7. three The devicehardware weighs modules only including0.44 g exclud the HE,ing theAPD, battery and ODBSand 1.07 are gintegrated with the asbattery. shown The in circuity, PCB design, and the stacked architecture of the CLOS device enhance the overall device Figureelectronic 7. Thecircuity, device PCB weighs design, only and 0.44 the stackedg exclud aringchitecture the battery of the and CLOS 1.07 device g with enhance the battery. the overall The portability. The device can be easily head-mounted on small rodents in pre-clinical settings. electronicdevice portability. circuity, PCBThe devicedesign, can and be the easily stacked head-mou architecturented on of small the CLOS rodents device in pre-clinical enhance the settings. overall device portability. The device can be easily head-mounted on small rodents in pre-clinical settings.

Electronics 2020, 9, 96 7 of 17 Electronics 2019, 8, x FOR PEER REVIEW 7 of 17

(a)

(b) (c) (d)

Figure 7. Closed-loop optogenetic stimulation (CLOS) device. ( a) Connections between the hardware modules. (b) Weight ofof the device with battery. (c) Weight ofof the device without battery. (d) Integrated CLOS device.

4. Software Component The software was developed in C language and uploaded into the ATtiny ATtiny 44A in the ODBS. TheThe pseudo-codepseudo-code forfor thethe programprogram isis presentedpresented inin FigureFigure8 .8. 4.1. Feature Extractor 4.1. Feature Extractor In the FE, the acquired neural signals are characterized based on their amplitude variations. In the FE, the acquired neural signals are characterized based on their amplitude variations. The The analog neural signals from the APD output are received by the analog to digital converter (ADC) analog neural signals from the APD output are received by the analog to digital converter (ADC) of of the microcontroller. These signals are digitized by the ADC. For each sample, the amplitude value is the microcontroller. These signals are digitized by the ADC. For each sample, the amplitude value is measured (Vm). This value is then used in the CA to perform on-off control logic. measured (Vm). This value is then used in the CA to perform on-off control logic. 4.2. Control Algorithm 4.2. Control Algorithm The CA implements a closed-loop on-off control logic. Initially, the distorted neural signals are The CA implements a closed-loop on-off control logic. Initially, the distorted neural signals are examined for their maximum amplitude. A threshold value (Vt) is set slightly above this value, in order examined for their maximum amplitude. A threshold value (Vt) is set slightly above this value, in to differentiate the abnormal neural activity from the normal neural activity. In our implementation, order to differentiate the abnormal neural activity from the normal neural activity. In our the threshold value is estimated to be 2.5 V. A stimulation timeout counter (Sc) is allocated. For each implementation, the threshold value is estimated to be 2.5 V. A stimulation timeout counter (Sc) is sample, the measured value (Vm) is compared against the threshold value. If the measured value allocated. For each sample, the measured value (Vm) is compared against the threshold value. If the exceeds the threshold value, the stimulation timeout counter is reset, and the stimulation is disabled. measured value exceeds the threshold value, the stimulation timeout counter is reset, and the Otherwise, the counter is incremented. When the counter content goes above a set value, the stimulation stimulation is disabled. Otherwise, the counter is incremented. When the counter content goes above is enabled. The identification accuracy of the normal and abnormal signals is 100% as distinguishing a set value, the stimulation is enabled. The identification accuracy of the normal and abnormal signals is 100% as distinguishing between the normal and abnormal signals based on examining their amplitudes and using a threshold to identify the signals was a straightforward task.

Electronics 2020, 9, 96 8 of 17 between the normal and abnormal signals based on examining their amplitudes and using a threshold toElectronics identify 2019 the, 8 signals, x FOR PEER was REVIEW a straightforward task. 8 of 17

4.3. Pulse Generator 4.3. Pulse Generator The PG controls the stimulation parameters (e.g., pulse width, duty cycle, and frequency) and The PG controls the stimulation parameters (e.g., pulse width, duty cycle, and frequency) and modulates the LED output. The stimulation parameters are set based on the required optical output. modulates the LED output. The stimulation parameters are set based on the required optical output. If the stimulation is disabled, then pulses are not triggered, and the LED is turned OFF. If the stimulation If the stimulation is disabled, then pulses are not triggered, and the LED is turned OFF. If the is enabled, then pulses are triggered, and the LED is turned ON. stimulation is enabled, then pulses are triggered, and the LED is turned ON.

Feature Extractor: 1. Receive analog neural data from the APD through Pin 15 (ADC 7). 2. Perform analog to digital conversion. 3. Measure the amplitude value of each sample.

Control Algorithm: 4. Set the threshold value to distinguish normal from abnormal neural state. 5. Reset the stimulation timeout counter. 6. Compare the measured value against the threshold value for each sample. 7. If the measured value is greater than the threshold value, reset the stimulation timeout counter. a. When the stimulation timeout counter is reset, disable stimulation. b. Go to Step 9. 8. If the measured value is less than the threshold value, increment the stimulation timeout counter. a. When the stimulation timeout counter overflows, enable stimulation. Pulse Generator: 9. Set the stimulation parameters (frequency, pulse width, and duty cycle) based on the required optical output. 10. If the stimulation is disabled, do not generate pulses to drive the LED. 11. If the stimulation is enabled, generate pulses to drive the LED. 12. Go to Step 1.

FigureFigure 8. 8.Pseudo-code Pseudo-code forfor thethe softwaresoftware component.component.

5.5. ExperimentalExperimental SetupSetup TheThe evaluationevaluation ofof thethe devicedevice isis carriedcarried outout inin three three stages: stages: withwith thethe hybridhybrid electrode,electrode, withwith thethe actionaction potentialpotential detector, detector, and and with with the the integrated integrated CLOS CLOS device. device. 5.1. Evaluation of Hybrid Electrode 5.1. Evaluation of Hybrid Electrode The hybrid electrode is analyzed for two operations: (1) signal detection, and (2) optical output. The hybrid electrode is analyzed for two operations: (1) signal detection, and (2) optical output. The detection electrodes are analyzed in vitro by injecting synthetic neural signal through NI myDAQ The detection electrodes are analyzed in vitro by injecting synthetic neural signal through NI myDAQ (National Instruments, USA) into a saline solution. The saline solution is prepared with 9 g of NaCl (National Instruments, USA) into a saline solution. The saline solution is prepared with 9 g of NaCl (Sigma-Aldrich Pty Ltd., Castle Hill, Australia) per liter of water [22]. The signals detected by the (Sigma-Aldrich Pty Ltd., Castle Hill, Australia) per liter of water [22]. The signals detected by the electrodes were continuously recorded and then analyzed in MATLAB. The signals were compared electrodes were continuously recorded and then analyzed in MATLAB. The signals were compared against the input signals using root-mean square in MATLAB. The results showed less than 3% against the input signals using root-mean square in MATLAB. The results showed less than 3% deviation between the two signals. The optical output of the LED was analyzed using a Thorlabs deviation between the two signals. The optical output of the LED was analyzed using a Thorlabs PDA36A-EC sensor and an oscilloscope, see Figure9. The LED output was controlled by a pulse width PDA36A-EC sensor and an oscilloscope, see Figure 9. The LED output was controlled by a pulse modulation (PWM) signal generated by the ODBS. The LED was driven with varying PWM duty width modulation (PWM) signal generated by the ODBS. The LED was driven with varying PWM cycles, and the corresponding optical output and power consumption were measured. duty cycles, and the corresponding optical output and power consumption were measured.

Electronics 2020, 9, 96 9 of 17 Electronics 2019, 8, x FOR PEER REVIEW 9 of 17 Electronics 2019, 8, x FOR PEER REVIEW 9 of 17

Figure 9. Setup for the electrode analysis. Figure 9. Setup for the electrode analysis. 5.2. Evaluation of Action Potential Detector 5.2. Evaluation of Action Potential Detector 5.2.1.5.2.1. Bench-Testing Bench-Testing Setup Setup 5.2.1. Bench-Testing Setup Bench-testingBench-testing of theof the APD APD was was performed performed in two in testtwo environments: test environments: (i) with (i) sine with signals sine generatedsignals Bench-testing of the APD was performed in two test environments: (i) with sine signals bygenerated a function by generator, a function and generator, (ii) with and synthetic (ii) with neuralsynthetic signals neural generated signals ge bynerated LabVIEW. by LabVIEW. In both In test generated by a function generator, and (ii) with synthetic neural signals generated by LabVIEW. In environments,both test environments, a power supply a power was supply used was to powerused to the power APD, the and APD, its and output its output was monitored was monitored by the both test environments, a power supply was used to power the APD, and its output was monitored oscilloscope.by the oscilloscope. The input The signal input was signal either was generated either ge bynerated a function by a function generator ge ornerator LabVIEW, or LabVIEW, see Figure see 10. by the oscilloscope. The input signal was either generated by a function generator or LabVIEW, see InFigure both instances,10. In both the instances, input signal the input was signal voltage was divided voltage todivided generate to generate two waveforms two waveforms of varying of Figurevarying 10. amplitudes,In both instances, which served the input as the signal reference was and voltage channel divided input to to the generate APD. The two APD waveforms amplified of amplitudes, which served as the reference and channel input to the APD. The APD amplified and varyingand filtered amplitudes, the differential which served input. as The the gain reference and frequency and channel response input ofto thethe APDAPD. were The APDmeasured amplified by filtered the differential input. The gain and frequency response of the APD were measured by applying andapplying filtered sinethe signalsdifferential of varying input. frequenciesThe gain and from frequency 100 Hz to response 10 kHz atof athe constant APD wereamplitude. measured Bode by sine signals of varying frequencies from 100 Hz to 10 kHz at a constant amplitude. Bode analysis was applyinganalysis sine was signals performed of varying using NI frequencies myDAQ and from NI 100ELVISmx Hz to Bode10 kHz Analyzer at a constant tool. The amplitude. analog input Bode performed using NI myDAQ and NI ELVISmx Bode Analyzer tool. The analog input channel AI0 analysischannel was AI0 performed acted as the using stimulus NI myDAQ channel and NIthe ELVISmxanalog input Bode channel Analyzer AI1 actedtool. Theas the analog response input acted as the stimulus channel and the analog input channel AI1 acted as the response channel. channelchannel. AI0 acted as the stimulus channel and the analog input channel AI1 acted as the response channel.

FigureFigure 10. 10.Bench-testing Bench-testing setup setup for for the the APD APD evaluation. evaluation. (a) With (a) Withsine signal. sine signal. (b) With ( bsynthetic) With synthetic neural neuralsignal. signal.

Figure 10. Bench-testing setup for the APD evaluation. (a) With sine signal. (b) With synthetic neural signal.

Electronics 2020, 9, 96 10 of 17

Electronics 2019, 8, x FOR PEER REVIEW 10 of 17 5.2.2. In Vitro Test Setup 5.2.2. In Vitro Test Setup In vitro testing of the APD was performed in two test environments: (i) with sine signals generated In vitro testing of the APD was performed in two test environments: (i) with sine signals by a function generator, and (ii) with synthetic neural signals generated by LabVIEW. The in vitro generated by a function generator, and (ii) with synthetic neural signals generated by LabVIEW. The test setup aims to reproduce the neural detection conditions within the brain, see Figure 11. The HE in vitro test setup aims to reproduce the neural detection conditions within the brain, see Figure 11. consists of the detection electrodes and the stimulation LED. For the APD validation, only the detection The HE consists of the detection electrodes and the stimulation LED. For the APD validation, only electrodes are utilized. One additional wire electrode is used to inject sine/synthetic neural signals into the detection electrodes are utilized. One additional wire electrode is used to inject sine/synthetic theneural saline signals solution. into Forthe saline testing solution. with the For sine testing signals, with thethe sine input signals, signals the are input generated signals are by generated the function generatedby the function within generated the frequency within spectrum the frequency of the spectr APum signals of the (i.e., AP signals 300 Hz (i.e., to 6300 kHz), Hz to see 6 kHz), Figure see 11 a. ForFigure testing 11a. with For synthetictesting with neural synthetic signals, neural the sign signalsals, the are signals generated are generated by the NI by ELVISmx the NI ELVISmx Arbitrary WaveformArbitrary generator Waveform tool generator and NI tool myDAQ, and NI seemyDAQ, Figure see 11 b.Figure Then, 11b. the Then, generated the generated signals aresignals fed are to the simulationfed to the electrodesimulation through electrode the through analog the output analog port output of NI port myDAQ of NI (AO0).myDAQ (AO0).

FigureFigure 11. 11. InIn vitrovitro testtest setup setup for for the the APD APD evaluation. evaluation. (a) With (a) Withsine signal. sine signal.(b) With (syntheticb) With syntheticneural neuralsignal. signal.

5.3.5.3. Evaluation Evaluation of of CLOS CLOS Device Device InIn vitro vitroCLOS CLOS test test setup setup reproduces reproduces thethe closed-loopclosed-loop optogenetic optogenetic stimulation stimulation condition condition within within thethe brain. brain. Apart Apart from from the the HE, HE, oneone additionaladditional wire wire el electrodeectrode is is used used to to inject inject synthetic synthetic neural neural signals signals intointo the the saline saline solution. solution. For For testing testing the the CLOS CLOS devi device,ce, two two synthetic synthetic neural neural signals signals are generated are generated by byusing using the the LabVIEW LabVIEW program, program, see see Figure Figure 12. 12 The. The optical optical stimulations stimulations were were initiated, initiated, when when the the detecteddetected neural neural response response met met aa setset ofof specifiedspecified criteria in in the the CA. CA. This This criterion criterion was was characterized characterized as as undesirableundesirable neural neural signal, signal, duringduring whichwhich neuromodulationneuromodulation was was re required.quired. Upon Upon neuromodulation, neuromodulation, undesirableundesirable neural neural signals signals were altered to to attain attain norm normalal neural neural activity. activity. Therefore, Therefore, to simulate to simulate an in an invitro vitro CLOSCLOS test test environment, environment, two two synthetic synthetic neural neural signals signals of ofvarying varying signal signal features features are are generated generated byby using using the the LabVIEW LabVIEW program. program. One One waveform waveform with withlow lowamplitude amplitude andand spikespike countcount is considered as abnormalas abnormal neural neural signal. signal. Another Another waveform waveform with with high high amplitudeamplitude and and spike spike count count is isconsidered considered as as normalnormal neural neural signal. signal.

ElectronicsElectronics2020 2019, ,9 8,, 96 x FOR PEER REVIEW 11 of 17 Electronics 2019, 8, x FOR PEER REVIEW 11 of 17

Begin Begin1. Set a threshold on the output voltage of photodiode. 2. 1.Read Set thea threshold output ofon the the photodiode. output voltage of photodiode. 3. 2.Compare Read the the output photodiode of the photodiode. output against the threshold value. 4. 3.If Comparephotodiode the output photodiode is greater output than against the thethreshold threshold value value. (LED ON), inject normal neural signals through the analog4. If photodiodeoutput of NI output myDAQ. is greater Go to than step the 2. threshold value (LED ON), inject normal neural signals through the 5. analogIf photodiode output ofoutput NI myDAQ. is less than Go to the step threshold 2. value (LED OFF), inject abnormal neural signals through the analog5. If photodiodeoutput of NI output myDAQ. is less Go than to stepthe threshold 2. value (LED OFF), inject abnormal neural signals through the End analog output of NI myDAQ. Go to step 2. End FigureFigure 12.12. Pseudo-codePseudo-code forfor LabVIEW program. Figure 12. Pseudo-code for LabVIEW program. TheThe challenge challenge was was to to replicate replicate optical optical stimulations, stimulations, in which in which neural neural activity activity is altered is altered upon optical upon The challenge was to replicate optical stimulations, in which neural activity is altered upon stimulation.optical stimulation. The simulation The simulation of optical of neuromodulation optical neuromodulation was realized was by realized a photodiode. by a photodiode. The VTB8440BH The optical stimulation. The simulation of optical neuromodulation was realized by a photodiode. The photodiodeVTB8440BH was photodiode used to detectwas used optical to stimulationsdetect optical from stimulations the LED, from which the triggered LED, which normal triggered neural VTB8440BH photodiode was used to detect optical stimulations from the LED, which triggered signalsnormal through neural signals LabVIEW through program. LabVIEW Otherwise, program. the LabVIEWOtherwise, program the LabVIEW initiated program abnormal initiated neural normal neural signals through LabVIEW program. Otherwise, the LabVIEW program initiated signals.abnormal The neural generated signals. neural The signalsgenerated were neural fed to signals the simulation were fed electrodeto the simulation through electrode the analog through output abnormal neural signals. The generated neural signals were fed to the simulation electrode through the analog output of NI myDAQ, see Figure 13. of NIthe myDAQ,analog output see Figure of NI myDAQ,13. see Figure 13.

FigureFigure 13. 13.In In vitro vitrovalidation validation of of the the CLOS CLOSdevice. device. (a) In vitro setup. (b (b) )Photodiode Photodiode and and LED LED setup. setup. Figure 13. In vitro validation of the CLOS device. (a) In vitro setup. (b) Photodiode and LED setup. (c)( Inc) vitroIn vitro evaluation. evaluation. (c) In vitro evaluation. 6. Experimental6. Experimental Results Results 6. Experimental Results 6.1.6.1. Evaluation Evaluation Results Results of of Hybrid Hybrid Electrode Electrode 6.1. Evaluation Results of Hybrid Electrode TheThe detection detection electrodes electrodes immersed immersed inin thethe salinesaline solutionsolution were were able able to to actively actively detect detect the the neural neural signals.signals.The The detectionThe comparison comparison electrodes of of the the immersed detected detected in signalssignals the saline matchedmatched solution the the waveformwere waveform able topattern pattern actively of of the detect the actual actual the input neural input signals.signals.signals. TheThe The resultscomparison results show show almostof almost the detected null null measurable meas signalsurable matched distortiondistortion the in thewaveform the output output waveform.pattern waveform. of the actual input signals. The results show almost null measurable distortion in the output waveform.

Electronics 2019, 8, x FOR PEER REVIEW 12 of 17

The power consumption with and without the LED corresponding to varying PWM duty cycle of the LED was analyzed. Power consumption increased proportional to the PWM duty cycle. At Electronics 2020, 9, 96 12 of 17 100% duty cycle, the overall power consumption was 24 mW (including the ODBS and LED), of which ~30% was contributed by the LED. Thus, it is evident that the stimulation parameters not only influenceThepower the optical consumption output, with but and also without the power the LED consumption. corresponding The to varyingresults PWMalso indicate duty cycle that of implantablethe LED was chip-LEDs analyzed. exhibit Power consumptionbetter optical increasedefficacy, compared proportional to fiber-coupled to the PWM dutylight-sources. cycle. At 100% duty cycle, the overall power consumption was 24 mW (including the ODBS and LED), of which ~30% was6.2. Evaluation contributed Results by the of LED. Action Thus, Potential it is evident Detector that the stimulation parameters not only influence the optical output, but also the power consumption. The results also indicate that implantable chip-LEDs 6.2.1.exhibit Bench-Testing better optical Results efficacy, compared to fiber-coupled light-sources. Considering ideal op-amps, the APD is estimated to provide 1600-times gain between 300 Hz 6.2. Evaluation Results of Action Potential Detector and 6 kHz frequency range. Initially, the empirical response of APD was constructed using sine signals.6.2.1. Bench-Testing The results Resultsmatched the theoretical estimation of gain and cut-off frequency of APD, see Figure 14. A flat passband frequency response was observed between 300 Hz and 6 kHz. Output signalsConsidering were observed ideal with op-amps, noise the interference APD is estimated and distortion to provide at frequencies 1600-times gainbelow between 300 Hz 300and Hz above and 6 kHzkHz, frequency which were range. out Initially,of the passband the empirical frequenc responsey range. of APD The wasmeasured constructed gain usingfactor sineachieved signals. a Themaximum results gain matched of about the 60 theoretical dB within estimation the passband. of gain and cut-off frequency of APD, see Figure 14. A flatThe passband empirical frequency frequency response response was observedof the APD between was constructed 300 Hz and 6using kHz. NI Output myDAQ signals and were NI ELVISmxobserved withBode noise Analyzer interference tool. The and empirical distortion freq at frequenciesuency response below matched 300 Hz the and simulated above 6 kHz, response, which weresee Figure out of 15. the Because passband of frequencytechnical limitations range. The in measured applying gain very factor low input achieved voltage a maximum using myDAQ, gain of higherabout 60 gain dB configurations within the passband. of the APD could not be analyzed.

Figure 14. Output of APD, ( a)) for input sine sine signal signal below below 300 300 Hz, Hz, ( (bb)) for for input input sine sine signal signal of of 1 1 kHz, kHz, and ((cc)) forfor inputinput sine sine signal signal greater greater than than 6 kHz.6 kHz. (d )(d Plot) Plot of APDof APD output output at varyingat varying frequency frequency range range and andconstant constant amplitude. amplitude.

6.2.2.The In Vitro empirical Test frequencyResults response of the APD was constructed using NI myDAQ and NI ELVISmx Bode Analyzer tool. The empirical frequency response matched the simulated response, see Figure 15. After analyzing the APD gain and frequency response, we evaluated the APD for the AP signal Because of technical limitations in applying very low input voltage using myDAQ, higher gain detection, under in vitro test condition. The output waveform recorded from the APD output during configurations of the APD could not be analyzed. in vitro validation is presented in Figure 16. The APD output waveform verified the theoretical estimates of amplification and filtration. Further, the output was compared against the input neural signal and measured almost null distortion.

Electronics 2019, 8, x FOR PEER REVIEW 13 of 17

6.3. Evaluation Results of CLOS Device During the in vitro validation of the CLOS device, the LabVIEW was used to inject abnormal signals during no optical stimulations. These signals were sensed and processed by the CLOS device, which immediately triggered optical stimulations by turning the LED ON. During LED ON, the LabVIEWElectronics 2020 injected, 9, 96 normal neural signals to the saline solution. The CLOS device sensed13 and of 17 processedElectronics 2019 the, 8 ,normal x FOR PEER neural REVIEW signals, and hence terminated optical stimulation, see Figure 17. 13 of 17

6.3. Evaluation Results of CLOS Device During the in vitro validation of the CLOS device, the LabVIEW was used to inject abnormal signals during no optical stimulations. These signals were sensed and processed by the CLOS device, which immediately triggered optical stimulations by turning the LED ON. During LED ON, the LabVIEW injected normal neural signals to the saline solution. The CLOS device sensed and processed the normal neural signals, and hence terminated optical stimulation, see Figure 17.

Figure 15. EmpiricalEmpirical frequency response of the APD.

6.2.2. In Vitro Test Results After analyzing the APD gain and frequency response, we evaluated the APD for the AP signal detection, under in vitro test condition. The output waveform recorded from the APD output during in vitro validation is presented in Figure 16. The APD output waveform verified the theoretical estimates of amplification and filtration. Further, the output was compared against the input neural signal and measured almost null distortion. Figure 15. Empirical frequency response of the APD.

Figure 16. APD output during in vitro validation.

Figure 16. APD output during in vitro validation.

6.3. Evaluation Results of CLOS Device During the in vitro Figurevalidation 17. Stimulation of the CLOS control device, signal the of the LabVIEW CLOS device. was used to inject abnormal signals during no optical stimulations. These signals were sensed and processed by the CLOS device,In addition, which immediately a further CLOS triggered validation optical was stimulations carried out byusing turning synthetic the LED neural ON. data During that combined LED ON, boththe LabVIEW normal and injected abnormal normal neural neural signals. signals A stream to the salineof alternating solution. normal The CLOS and distorted device sensed synthetic and processedneural signals the normalwas created neural using signals, the andLabVIEW hence terminatedwaveform editor. optical These stimulation, data were see Figure injected 17 .into the salineIn solution addition, using a further NI myDAQ. CLOS validation The CLOS was device carried turned out using the stimulation synthetic neural ON upon data thatidentification combined both normal and abnormal neural signals. A stream of alternating normal and distorted synthetic neural signals was createdFigure using 17. theStimulation LabVIEW control waveform signal of editor. the CLOS These device. data were injected into the saline solution using NI myDAQ. The CLOS device turned the stimulation ON upon identification of the abnormalIn addition, neural a further activity, CLOS otherwise, validation turned was OFF carri theed out stimulation using synthetic during neural normal data neural that activity, combined see Figureboth normal 18. Thus, and this abnormal confirmed neural the signals. instantaneous A stream capability of alternating of the CLOS normal device and todistorted deliver synthetic real-time neural signals was created using the LabVIEW waveform editor. These data were injected into the saline solution using NI myDAQ. The CLOS device turned the stimulation ON upon identification

Electronics 2019, 8, x FOR PEER REVIEW 13 of 17

6.3. Evaluation Results of CLOS Device During the in vitro validation of the CLOS device, the LabVIEW was used to inject abnormal signals during no optical stimulations. These signals were sensed and processed by the CLOS device, which immediately triggered optical stimulations by turning the LED ON. During LED ON, the LabVIEW injected normal neural signals to the saline solution. The CLOS device sensed and processed the normal neural signals, and hence terminated optical stimulation, see Figure 17.

Figure 15. Empirical frequency response of the APD.

Electronics 2020, 9, 96 14 of 17 closed-loop optogenetic stimulations. There was no measurable delay during CLOS. Thus, the CLOS device demonstrated fast and simple closed-loop optogenetic stimulation operation. Figure 16. APD output during in vitro validation.

Electronics 2019, 8, x FOR PEER REVIEW 14 of 17 of the abnormal neural activity, otherwise, turned OFF the stimulation during normal neural activity, see Figure 18. Thus, this confirmed the instantaneous capability of the CLOS device to deliver real- time closed-loop optogenetic stimulations. There was no measurable delay during CLOS. Thus, the CLOS device demonstratedFigureFigure fast 17.17. and Stimulation simple closed-loop control signalsignal optogenetic ofof thethe CLOSCLOS stimulation device.device. operation.

In addition, a further CLOS validation was carried out using synthetic neural data that combined both normal and abnormal neural signals. A stream of alternating normal and distorted synthetic neural signals was created using the LabVIEW waveform editor. These data were injected into the saline solution using NI myDAQ. The CLOS device turned the stimulation ON upon identification

FigureFigure 18.18. In vitro testtest resultsresults ofof thethe CLOSCLOS device.device.

7.7. Discussion TableTable1 1shows shows a a comparison comparison of of the the developed developed CLOS CLOS device device against against a a number number of of existing existing counterparts.counterparts. Krook-Magnuson Krook-Magnuson et et al. al. [8] [8] used off- off-the-selfthe-self components except forfor thethe implantedimplanted electrodeelectrode andand optic optic fiber. fiber. Similarly, Similarly, Laxpati Laxpati et al.et [al.9] and[9] and Newman Newman et al. et [12 al.] employed [12] employed the open-source the open- NeuroRighter,source NeuroRighter, which iswhich a platform is a platform dedicated dedicated for multi-electrode for multi-electrode recording recording and and stimulation, stimulation, for closed-loopfor closed-loop neuromodulation. neuromodulation. These These systems systems are are bulky bulky and and require require animal animal anesthetics anesthetics oror cagingcaging duringduring inin vivovivo experimentations. This issue is addressed in our head-mountable and tetherless CLOS device,device, whichwhich enablesenables freefree movementmovement ofof animalsanimals duringduring inin vivovivo trials.trials. AA mainmain challengechallenge inin thethe realizationrealization ofof miniatureminiature CLOSCLOS devicesdevices isis thethe incorporationincorporation ofof thethe entireentire softwaresoftware components on-board on-board of of the the device. device. Although Although Nguyen Nguyen et al. et [11] al. developed [11] developed a custom a custom device devicefor CLOS, for CLOS,their neural their neural signal signal analysis analysis and andclosed-loop closed-loop control control modules modules were were implemented implemented in inMATLAB MATLAB and and LabVIEW LabVIEW on on an an external external computer. computer. Similarly, Similarly, other other devices devices also required eithereither MATLAB,MATLAB, LabVIEWLabVIEW oror NeuroRighterNeuroRighter platforms.platforms. Whereas,Whereas, thethe CLOSCLOS devicedevice hostshosts the entire software on-boardon-board ofof thethe device.device. Nevertheless,Nevertheless, thethe CLOSCLOS devicedevice alsoalso incorporatedincorporated aa power-epower-efficientfficient hybridhybrid electrode.electrode. TheThe useuse ofof aa chip-LEDchip-LED insteadinstead ofof LEDLED coupledcoupled withwith opticoptic fiberfiber eliminatedeliminated the opticaloptical outputoutput losses due to lowlow couplingcoupling effiefficiencies,ciencies, improved improved the the device device operation operation duration, duration, and reduced and reduced the electrode the electrode size. Because size. ofBecause the small of the size small of the size LED, of wethe couldLED, we integrate could bothintegrate detection both electrodesdetection electrodes and stimulation and stimulation LED into aLED single into flexible a single board flexible of board the size of 16the mm size in16 lengthmm in andlength 1.2 and mm 1.2 in mm width. in width. The electrode The electrode design design also improvedalso improved the operation the operation duration duration of the of CLOS the CLOS device device from 2 from h to more2 h to than more 5 h, than due 5 to h, the due reduced to the powerreduced requirement power requirement to drive the to LED. drive Furthermore, the LED. Furthermore, the device cost the was device reduced cost from was reported reduced pricing from ofreported $12,000 pricing [9] to less of $12,000 than $100. [9] to less than $100. On the other hand, concerns have been raised with the implantation of chip-LEDs within the brain in terms of their thermal and biocompatibility impacts on the brain tissue. These concerns have been investigated in recent studies. Rossi et al. [23] demonstrated in vivo chronic optical stimulation using an implanted LED. They conducted in vivo temperature measurements using a fluke temperature probe. The results indicated that temperature rise in the neural tissue was a function of the optical power and stimulation duty cycle. However, optical stimulations using common stimulation parameters such as 20% duty cycle and 10 mW power indicated only ~0.3 °C rise in the tissue temperature. Their research also validated long-term stability of implanted LEDs for over 50 days after surgery during in vivo experimentation. Similarly, Cao et al. [17] performed in vivo validation of an integrated neural probe hosting an implantable LED. The neural probe was encapsulated with Polydimethylsiloxane to provide thermal and electrical insulations from neighboring tissues making the probe moisture proof. Alternatively, another research work reported a polycrystalline diamond (PCD) probe with higher thermal conductivity allowing the dissipation of heat through the entire probe preventing localized heat accumulation near the LED. It maintained

Electronics 2020, 9, 96 15 of 17

Table 1. Comparison of the developed CLOS device against existing counterparts.

Detection Stimulation Stimulator Power Ref Detector Circuit Software Size/Weight Fixation Method Electrode Electrode Circuit Supply NI USB-6221BNC Plastics One Fiber-coupled Analogue Brownlee Screws and dental [8] digitizer, optical MATLAB Bench-top _ electrode diode laser 410 amplifier cement patch cords 16-channel Plexon Triangle Biosystems Plexon V-I Neuro-Righter Flexible cable, skull [9] tungsten MEA, Fiber-coupled Bench-top _ recording head-stage controller platform screws NeuroNexus array LED Bench-top setup Flat cable, 32-channel Fiber-coupled RHA2132 amplifier, MATLAB and Battery +3 V [11] LED driver PCB—29.5 mm micro-drive and electrodes LED AD7980 digitizer LabVIEW and +5 V 43.3 mm × screw Multichannel systems MEA60 analog Fiber-coupled Custom LED Neuro-Righter [12] MEA amplifier, RZ2 Bench-top _ _ LED driver platform multichannel bio acquisition Digital Laser source and Tucker–Davis high Computer based Bench-top [13] 4 4 µECoG array micromirror __ arc lamp impedance amplifier system Implant—400 mg × device Head-mountable LED driver and Embedded C Size: 6 mm LiPo Battery This work Hybrid electrode with implantable LED Amplifier and filter No tether micro-controller program diameter; Weight: +3.7 V 0.44 g Electronics 2020, 9, 96 16 of 17

On the other hand, concerns have been raised with the implantation of chip-LEDs within the brain in terms of their thermal and biocompatibility impacts on the brain tissue. These concerns have been investigated in recent studies. Rossi et al. [23] demonstrated in vivo chronic optical stimulation using an implanted LED. They conducted in vivo temperature measurements using a fluke temperature probe. The results indicated that temperature rise in the neural tissue was a function of the optical power and stimulation duty cycle. However, optical stimulations using common stimulation parameters such as 20% duty cycle and 10 mW power indicated only ~0.3 ◦C rise in the tissue temperature. Their research also validated long-term stability of implanted LEDs for over 50 days after surgery during in vivo experimentation. Similarly, Cao et al. [17] performed in vivo validation of an integrated neural probe hosting an implantable LED. The neural probe was encapsulated with Polydimethylsiloxane to provide thermal and electrical insulations from neighboring tissues making the probe moisture proof. Alternatively, another research work reported a polycrystalline diamond (PCD) probe with higher thermal conductivity allowing the dissipation of heat through the entire probe preventing localized heat accumulation near the LED. It maintained the maximum surface temperature of the probe below 1 ◦C. The probe was encapsulated with Parylene C. In relation to the biocompatibility concern, the main approach used to provide electrical insulation and bio-stability has been the use of Parylene C in implants, electrodes, medical devices and neural interfaces [24,25]. Accordingly, further to the current in vitro experimentation reported in this paper, we plan to study the thermal properties and biocompatibility of the electrode with the CLOS device through in vivo validations in our future work.

8. Conclusions This paper presented the design, implementation, and validation of a lightweight, portable, tetherless, and miniature closed-loop optogenetic stimulation (CLOS) device suitable for pre-clinical trials with small laboratory animals. The device is validated for its CLOS operation through bench and in vitro tests and has demonstrated its capacity to deliver instantaneous optical stimulations for prolonged operational duration. The entire device is powered by a battery and operated for over 5 h, which is suitable for pre-clinical neuroscience studies. On the other hand, there is room for improvement in terms of the CA, and multi-channel detection and stimulation configuration. Next, the CLOS device will be tested through in vivo validations under pre-clinical laboratory settings.

Author Contributions: Conceptualization, E.S.E. and A.Z.K.; methodology, E.S.E. and A.Z.K.; hardware, E.S.E. and A.Z.K.; software, E.S.E. and A.Z.K.; validation, E.S.E.; formal analysis, E.S.E.; investigation, E.S.E.; resources, A.Z.K.; data curation, E.S.E.; writing—original draft preparation, E.S.E.; writing—review and editing, E.S.E. and A.Z.K.; visualization, E.S.E.; supervision, A.Z.K.; project administration, A.Z.K. All authors have read and agreed to the published version of the manuscript. Funding: This research received no external funding. Conflicts of Interest: The authors declare no conflict of interest.

References

1. Parastarfeizabadi, M.; Kouzani, A.Z. Advances in closed-loop deep brain stimulation devices. J. Neuroeng. Rehabil. 2017, 14, 79. [CrossRef][PubMed] 2. Montagni, E.; Resta, F.; Mascaro, A.L.A.; Pavone, F.S. Optogenetics in brain research: From a strategy to investigate physiological function to a therapeutic tool. Photonics 2019, 6, 92. [CrossRef] 3. Cardoso-Cruz, H.; Paiva, P.; Monteiro, C.; Galhardo, V. Bidirectional optogenetic modulation of prefrontal-hippocampal connectivity in pain-related working memory deficits. Sci. Rep. 2019, 9, 1–17. [CrossRef] 4. Deisseroth, K. Optogenetics. Nat. Methods 2011, 8, 26–29. [CrossRef] 5. Edward, E.S.; Kouzani, A.Z.; Tye, S.J. Towards miniaturized closed-loop optogenetic stimulation devices. J. Neural Eng. 2018, 15, 021002. [CrossRef][PubMed] Electronics 2020, 9, 96 17 of 17

6. Wu, H.; Ghekiere, H.; Beeckmans, D.; Tambuyzer, T.; Van Kuyck, K.; Aerts, J.M.; Nuttin, B. Conceptualization and validation of an open-source closed-loop deep brain stimulation system in rat. Sci. Rep. 2015, 5, 9921. [CrossRef][PubMed] 7. Grosenick, L.; Marshel, J.H.; Deisseroth, K. Closed-loop and activity-guided optogenetic control. Neuron 2015, 86, 106–139. [CrossRef][PubMed] 8. Krook-Magnuson, E.; Armstrong, C.; Oijala, M.; Soltesz, I. On-demand optogenetic control of spontaneous seizures in temporal lobe epilepsy. Nat. Commun. 2013, 4, 1376. [CrossRef][PubMed] 9. Laxpati, N.G.; Mahmoudi, B.; Gutekunst, C.A.; Newman, J.P.; Zeller-Townson, R.; Gross, R.E. Real-time in vivo optogenetic neuromodulation and multielectrode electrophysiologic recording with NeuroRighter. Front. Neuroeng. 2014, 7, 40. [CrossRef][PubMed] 10. NeuroRighter. Available online: https://sites.google.com/site/neurorighter/ (accessed on 22 December 2019). 11. Nguyen, T.K.; Navratilova, Z.; Cabral, H.; Wang, L.; Gielen, G.; Battaglia, F.P.; Bartic, C. Closed-loop optical neural stimulation based on a 32-channel low-noise recording system with online spike sorting. J. Neural Eng. 2014, 11, 046005. [CrossRef][PubMed] 12. Newman, J.P.; Fong, M.F.; Millard, D.C.; Whitmire, C.J.; Stanley, G.B.; Potter, S.M. Optogenetic feedback control of neural activity. Elife 2015, 4, e07192. [CrossRef][PubMed] 13. Pashaie, R.; Baumgartner, R.; Richner, T.J.; Brodnick, S.K.; Azimipour, M.; Eliceiri, K.W.; Williams, J.C. Closed-loop optogenetic brain interface. IEEE Trans. Biomed. Eng. 2015, 62, 2327–2337. [CrossRef][PubMed] 14. Kwon, K.Y.; Sirowatka, B.; Weber, A.; Wen, L. Opto-micro ECoG array: A hybrid neural interface with transparent micro ECoG electrode array and integrated LEDs for optogenetics. IEEE Trans. Biomed. Circuits Syst. 2013, 7, 593–600. [CrossRef][PubMed] 15. Lee, S.T.; Williams, P.A.; Braine, C.E.; Lin, D.T.; John, S.W.; Irazoqui, P.P. A miniature, fiber-coupled, wireless, deep-brain optogenetic stimulator. IEEE Trans. Neural Syst. Rehabil. Eng. 2015, 23, 655–664. [CrossRef] [PubMed] 16. Cree Direct Attach DA2432 LEDs CxxxDA2432-Sxx00-x Data Sheet. Available online: https://www.cree.com/ led-chips/media/documents/CPR3FM.pdf (accessed on 22 December 2019). 17. Cao, H.; Gu, L.; Mohanty, S.K.; Chiao, J.J. An integrated micro-LED optrode for optogenetic stimulation and electrical recording. IEEE Trans. Biomed. Eng. 2013, 60, 225–229. [CrossRef][PubMed] 18. AD8293. Available online: https://www.mouser.com/datasheet/2/609/AD8293G80_160-877846.pdf (accessed on 22 December 2019). 19. AD8237. Available online: https://www.analog.com/media/en/technical-documentation/data-sheets/AD8237. pdf (accessed on 22 December 2019). 20. ATtiny44A. Available online: http://ww1.microchip.com/downloads/en/devicedoc/8183s.pdf (accessed on 22 December 2019). 21. CAT4104. Available online: https://www.onsemi.com/pub/Collateral/CAT4104-D.pdf (accessed on 22 December 2019). 22. Qian, X.; Chen, Y.; Feng, Y.; Ma, B.; Hao, H.; Li, L. A method for removal of deep brain stimulation artifact from local field potentials. IEEE Trans. Neural Syst. Rehabil. Eng. 2017, 25, 2217–2226. [CrossRef][PubMed] 23. Rossi, M.A.; Go, V.; Murphy, T.; Fu, Q.; Morizio, J.; Yin, H.H. A wirelessly controlled implantable LED system for deep brain optogenetic stimulation. Front. Integr. Neurosci. 2015, 9, 8. [CrossRef][PubMed] 24. Hsu, J.M.; Rieth, L.; Normann, R.A.; Tathireddy, P.; Solzbacher, F. Encapsulation of an integrated neural interface device with Parylene C. IEEE Trans. Biomed. Eng. 2009, 56, 23–29. [CrossRef][PubMed] 25. Kuppusami, S.; Oskouei, R.H. Parylene coatings in medical devices and implants: A review. Univers. J. Biomed. Eng. 2015, 3, 9–14.

© 2020 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).