A Programmable EEG Monitoring SoC with Optical and Electrical Stimulation for Epilepsy Control

In this paper, a cross-domain integration system composed of a gene transfer technique with a pre-clinical trial, an on-chip circuit design, an off-chip hardware with peripheral unit integration, and a custom software is presented. Opsin protein–gene transfer is successfully conducted to demonstrate that gene transfer treatment with optical stimulation has several benefits compared with electrical treatment. The proposed wireless programmable stimulating system on chip (WPSSoC) is composed of two sensing channels combined with a decimation filter to acquire intracranial electroencephalography (iEEG), an epilepsy detection unit (EDU), a stimulator with a waveform controller, and an ultra-low-power embedded transceiver. The equivalent sample rate of sensed data is 375 samples/s with 16-bit output data. The performance of intermodulation distortion with a third order (IMD<sub>3</sub>) is approximately 68 dB. The EDU extracts approximate entropy (ApEn) and spectrum bins for the classifier. The stimulator with controller features on the waveform-adjustable function to provide 0–<inline-formula> <tex-math notation="LaTeX">$510~\mu \text{A}$ </tex-math></inline-formula> of electrical stimulation and 0–50 mW of optical stimulation. The proposed transceiver is implemented with a 2.45 GHz on–off keying (OOK) carrier frequency. Transmitter and receiver front-ends perform at 50.6 and 12.7 pJ/bit of energy per bit, respectively. Power consumption and area of WPSSoC are about 1 mW and 13.67 mm<sup>2</sup> in a <inline-formula> <tex-math notation="LaTeX">$0.18~\mu \text{m}$ </tex-math></inline-formula> process, respectively. Circuits of each part are integrated in a 4.3 cm <inline-formula> <tex-math notation="LaTeX">$\times2$ </tex-math></inline-formula> cm printed circuit board. The shrunk device is verified with Thy1-ChR2-YFP gene transfer in C57BL/6 mice by using a custom software which is used to provide commands and monitor iEEG.


I. INTRODUCTION
Epilepsy is a symptom caused by the abnormal discharge of neurons in the brain [1]. According to a statistical report by the World Health Organization in 2018 [2], about 50 million people worldwide have epilepsy. In therapies for epilepsy, the method of taking medicine is mainstream. Medicine treatment is simple and non-invasive, but it is not really applicable to about 30% of patients with intractable The associate editor coordinating the review of this manuscript and approving it for publication was Emil Jovanov. epilepsy [3]. Another treatment involves the removal of a part of a tissue and medicine intake after surgery, but the average effect of this method is not good according to statistical reports of patient status [4], [5]. Therefore, therapies with implanted devices serve as effective methods for patients with electrical stimulation systems, which have been used in clinical treatment for many years, with the development of neuroimaging and locating technology. In addition, another study discussed and verified optical stimulation for the precaution and suppression of neuropathy in the brain [6]. Reference [7] presented a wireless switched-capacitor solution for electrical/optical stimulation, where the feasibility of this interface was verified in acute animal testing by electrical/optical stimulation with its evaluation board and µLED embedded. A 64-channel wireless closed-loop neurostimulator was implemented, in which a sensing channel, a wireless interface, an adjustable current stimulation circuit, and a slightly complicated epilepsy detection circuit were developed in a system-on-a-chip (SoC) [8]. An eight-channel closed-loop SoC was also implemented in an acquisition circuit, a wireless interface with coil, an antropy-spectrum algorithm, and a waveform-fixed electrical stimulator [9]. A 16-channel SoC was also proposed with the mini-pig in vivo testing [10]. A 32/64-channel SoC was also proposed by R. Genov et al., including adaptive-input-range sensing channels, a CPU-embedded support vector machine (SVM)-based algorithm, and a controllable electrical stimulator [11]- [13]. Furthermore, an implantable optical system with SoC, which is composed of a µLED array, a power driver, and a coilbased receiver, was presented [14]. An intracranial electroencephalography (iEEG) reaction through open-loop optical stimulation was also shown in this paper. An open-and closed-loop discrete component system, which was constructed by using a micro-control-unit (MCU) embedded with a sensing channel, a wireless interface, and optical stimulation units, was also implemented [15], [16]. Moreover, an arbitrary-waveform electro-optical stimulator was proposed with wireless control function in a small printed circuit board (PCB) board [17].
These issues were popularly discussed in the previous publication, but a system combined with sensing bio-signal, controllable waveform, stimulation provision with electrical and optical methods, wireless interface, custom software, and integration on a system level was not presented. In addition, bio-related information, such as cell experiment for system pre-testing, was deficient in the previous study.
In the present paper, a proposed wireless programmable stimulating SoC (WPSSoC) is implemented. WPSSoC provides wireless open-and closed-loop stimulating functions simultaneously with an embedded epilepsy detection unit (EDU) through recommendation from clinical doctors. Optical and electrical stimulations are achieved using the adjustable waveform on stimulation intensity and each time piece of stimulation waveform, which is expected to improve the treatment for epilepsy suppression. The system is approved on stimulation parameters wirelessly controlled by a custom software with a graphical user interface (GUI) on a computer. Moreover, an animal test on the optogenetic tissue successfully reveals that nerve injury on optogenetic stimulation is lower than that on electrical stimulation for the development of new gene therapy. Lastly, the whole system is integrated in a 4.3 cm × 2 cm PCB with an off-chip optical stimulation module, a laser-fiber connection pipe, a bias, antennas of two wireless interfaces, an on-chip transceiver, and a Bluetooth Low Energy (BLE) module.
Details of the entire system design are described as follows. Section II presents the system architecture with operating procedure. Section III introduces the stimulation methods, features, and verifications of the two different treatment methods and the suggested specification for the design. Section IV presents the whole on-chip circuit design. Section V discusses the measured and experimental results, including WPSSoC function testing, optical stimulation, and in vivo testing. Finally, Section VI concludes the work and discusses its contributions. Fig. 1 is the block diagram of the proposed system, which is composed of a radio-frequency (RF) transceiver for wireless communication, bio-signal acquisition circuits for the capture of electroencephalogram (EEG) signals, digital circuits with signal pre-processing and stimulation control, on-chip/offchip circuits with electrical and optical stimulations, and a custom software.

II. SYSTEM ARCHITECTURE
The bio-related part on the lower left corner of Fig. 1 is implemented using the gene transfer technique with opsin protein gene fragment, medicine model to induce epilepsy, construction of animal testing flow, and verification of the stimulation effect.
The off-chip part on the upper right corner of Fig. 1 is composed of an integrity-adjustable optical stimulation module, an electrode, a wireless adapter for application, and a custom software to control the stimulation parameters. The integrityadjustable optical stimulation module was constructed by an off-chip MCU to convert the data format from WPSSoC for the requirement of an integrity control unit, a laser driver, an adapter, and a laser fiber. Recoding and stimulation electrodes were implanted on mice.
The proposed WPSSoC has four sub blocks: bio-signal acquisition circuits, digital circuits, an RF transceiver, and electrical stimulation circuits. According to the pre-testing of animal testing for matching the specification, a resolution equivalent to at least 8 bits under an input signal of 2 mV is required to implement the bio-signal acquisition circuits. The common-mode rejection ratio (CMRR) to reject 50/60 Hz DC offset from the electrode-tissue interface should be estimated for the pre-amplifier. The 60 Hz DC offset is evaluated by the recoded system in the animal system to be about 0.8 V. For bio-medical usage, the input range is designed as 10 mV with the desired lower-than-10% headroom on amplifier output. CMRR of the pre-amplifier should be designed higher than 58 dB by the estimation of the CMRR formula. Digital circuits are characterized by signal pre-processing, an EDU, a stimulation controller, and an information-packaging circuit. The RF transceiver is implemented in the industrial scientific medical (ISM) band according to the specification of IEEE 802.11 for implantable application. Moreover, the onoff keying (OOK) modulation is used as a wireless interface by considering short-distance, low-power consumption. The number of sensing/stimulation channels is decided by the available implantable electrodes on a human [18] and the consideration of decreasing damage to the animal used (B6 mice) in the animal experiment.
The operation of the signal processing in the entire system is described as follows. iEEG signals are sensed by electrodes and acquired by sensing channels. Sensing channels convert the sensed data into 16-bit digitalized data with 375 samples/s on each channel. In case epilepsy is detected, the controller triggers the stimulation circuit to deliver light/current to the brain tissue to suppress the symptom. The required stimulation waveform can be controlled by a custom software based on the wireless interface to reduce the wire interference in the animal study. The digitalized bio-information is also packed and sent to the custom monitoring software by the RF transceiver.

III. SIMULATION METHODS AND REQUIRED SPECIFICATIONS A. ELECTRICAL STIMULATION
Electrical stimulation uses the external electrical signal to lead the operation of Na+/K+ adenosine triphosphatase (ATPase) on the cell membrane, where the forced ion exchange on the sudden abnormal discharging cells reverts it to a normal state. In addition, the use of electrical stimulation on the brain is reasonable because the message in this organ is transmitted by low electricity, indicating that external electrical signal is easily spread to change the state of neurons and the interaction between them [19].
A previous research showed that electrical stimulation can decrease the times of epilepsy operation and suppress the symptom with two main methods [20]: off-focus and onfocus, which provide the stimulation in the cortex or medulla, respectively. Off-focus therapy is relatively safe and simple in medical application by implanting the electrode on the cortex of the brain to provide the stimulation for depressing the epilepsy, but it has a limited effect on epilepsy suppression compared with on-focus therapy. SANTE study group [21] showed a 29% decrease in operation frequency based on statistics from patients. By contrast, on-focus therapy directly provides stimulation to the lesion in the medulla. The effect of using on-focus therapy is dependent on stimulation frequency; high-frequency stimulation can rapidly suppress the operation, whereas low-frequency stimulation can decrease the operation frequency [22].
In previous experiments [23]- [25], the following advantages of electrical stimulation were described: 1) ability to generate sufficient stimulation to a range of neurons and 2) low complexity in system design, including mechanism parts. However, the following disadvantages were noted: 1) lack of selection on the block of minute tissues, in which all cells in the stimulation range are stimulated and suppressed, and 2) the possible formation of a large stimulation artifact influences the sensing channel and monitoring.

B. OPTICAL STIMULATION
This stimulation is built via the gene transfer technique with an opsin gene fragment, where opsin is a protein sensitive to light, such as cells on human eyes' retina. The procedure of optical stimulation is similar to that of electrical stimulation. Ion exchange is forced as transgenic cells are illuminated by light with different wavelengths dependent on different kinds of corresponding genes. The near-stimulated tissue is activated, forcing the epilepsy state to return to a normal state via neurotransmitter release. The released neurotrans- mitter suppresses the abnormally discharged neuron to stop epilepsy.
In the current paper, NpHR and ChR2 were generally used in optical gene transfer, and the corresponding wavelength and exchange ions are shown in Fig. 2 [26]. Considering the application on humans, adeno-associated virus (AAV) and lenti virus were found for safety and tested on animals and humans [27], [28].
Our team described optogenetic results [29] by using a laser instrument on an animal test involving bench-top commercial recording systems with open-and closed-loop control. It also showed the feasibility of reducing epilepsy using optical stimulation therapy. The advantages of optical stimulation observed in the experiment are as follows: 1) no or slight stimulation artifact affects the measured iEEG, and 2) the range of stimulation can be controlled. By contrast, the strength of stimulation is relatively small, but locating the lesion and transgenic surgery are required in advance for stimulation.

C. HYPOTHESIS VERIFICATION
The difference between optical and electrical stimulations is illustrated in Fig. 3. Our hypothesis is that electrical stimulation causes a greater damage than optical stimulation because transgenic neurons release neurotransmitters through optical stimulation without scarifying normal neurons. However, normal neurons are directly forced to undergo ion exchange by the external current to stop epilepsy during electrical stimulation.
The AAV-carrying ChR2 gene was used and injected into the CA3 region of the mouse brain to verify this hypothesis. The benefit of using ChR2 is high reaction speed with 20 ms by lighting up, which is faster than that of other proteins [26]. Tissue dyeing testing was also performed to ensure the location of the transferred gene. In vivo testing revealed that adult mice, which have the gene type Thy1-ChR2-YFP,  were used at the age of 90 days and split into mock, optical, and electrical stimulation groups with lithium-pilocarpine method to induce epilepsy [30]. The cell experiment result is shown in Fig. 4, which was taken by a microscope with 200x magnification. The comparison of neurotransmitter amount between mock and post-optical-stimulation group in Fig. 4 (a) shows that neurotransmitter amount in the optical stimulation group exceeds that of the mock group. Moreover, Fig. 4 (b) shows that the number of dead neurons is slightly attenuated in the optical stimulation group after an epilepsy attack compared with that of the mock group. Furthermore, the number of apoptotic neurons in the electrical stimulation group is greater than that in the optical stimulation group. Therefore, treatment with ChR2 plus optical stimulation can reduce neuronal death compared with the electrical method.

D. SPECIFICATION OF CIRCUITS AND SYSTEMS
The specification should be pre-tested to implement the whole system as an implantable/portable device. Specification of the bio-signal, including amplitude and spectrum range, is listed in Table 1 [31]. In our in vivo pre-testing, the equivalent measured iEEG is less than 50 µV in the normal state and ranging from 150 µV to 500 µV during acute epilepsy operation in the animal test with ChR2 transgenic mice. Moreover, the spectrum of the measured epileptic iEEG ranges from 5 Hz to 25 Hz. According to the experiment, the specification of the sensor channels is equivalent to 8 bits when the input is 1 mV with a minimum sample rate of 300 Hz.
Stimulation specification was also determined in accordance with a previous work [32]. Intensity was set to a maximum current of 500 µA with 8-bit resolution in the adjustable electrical stimulator with a mode of a mono-/bi-phasic waveform design. Moreover, the frequency of the stimulation ranged from 100 Hz to 1 kHz. The wavelength of the optical stimulation ranging from 440 nm to 460 nm, namely, blue light, was used to activate the target tissue because of the ChR2 gene transfer. Moreover, flicker frequency and intensity should be adjusted from 10 Hz to 100 Hz and from 0 mW to 60 mW in the controller design, respectively. Fig. 1 shows WPSSoC, including a sensing channel with bio-signal acquisition circuits and a decimation filter, digital circuits with a stimulator, and an RF transceiver. Bio-signal acquisition circuits convert iEEG to modulated digital data and are demodulated by a decimation filter. Digital circuits provide the algorithm to detect epilepsy, generate stimulation function according to the command, and pack information using the universal asynchronous receiver/transmitter (UART) format. An OOK-based RF transceiver with 2.4 GHz was implemented to receive and transmit the information requested by the custom software. Details of each circuit are described as follows:

IV. WIRELESS PROGRAMMABLE STIMULATION SOC
A. SENSING CHANNEL Fig. 5 shows the architecture of the proposed bio-signal acquisition circuits with its signal spectrum plot on each node. In conventional architecture, the ripple on the chopper output is a large problem. A filter is generally used to solve this problem with extra hardware and power consumption. Compared with traditional architecture, the proposed architecture is only composed of a chopper-based programmable gain amplifier (CPGA) and a high-pass sigma delta modulator (HPSDM) to convert input signal into modulated digital data [33]. The input signal is sampled and modulated to a highfrequency band by the chopper at the input stage of the CPGA to prevent flicker noise. The differential difference amplifier (DDA) structure is selected for the CPGA to isolate the input signal path from the feedback gain control path with three types of gain, which is designed as 5, 10, and 20 V/V for different applications in usage, and pseudo-resistors are implemented for area reduction [34]. The HPSDM here provides a high-pass noise-shaping function to convert modulated signal into serial output digitalized data. A three-stage feed-forward HPSDM structure with OSR of 128 and 1-bit DAC was selected and conducted with an integrator to build the required transfer function.
Moreover, the modulated digitalized bio-information was demodulated by using a decimation filter at the first stage of digital circuits. It is composed of a digital-based chopper in a 1-bit demodulator, a comb filter in a cascade structure to decrease frequency and extend bit length, a filter to compensate the in-band gain lost by a comb filter, an infinite impulse response (IIR) filter to cut the high-frequency noise out of the signal band, and an equalizer to fix the group delay caused by an IIR filter [35], [36].

B. DIGITAL CIRCUITS
The signal flow chart in digital circuits is shown in Fig. 6. At the first stage of the digital circuit, a decimation filter is used to demodulate the information. Demodulated data are sent to the UART package circuit with 8-N-1 protocol and used to monitor iEEG signals. It also provides EDU, which is composed of the averaged approximate entropy (A-ApEn), certain bins of spectrum power, an amplitude recording and a classifier, to detect the stimulation results using a designed detection window. The stimulation controller regulates the stimulation circuits in accordance with the internal setting and identifies the result to execute the neural feedback control.
An ApEn is used to calculate signal regularity. The calculation step of ApEn was listed in other studies [37], [38]. For the low-cost hardware design issue, m and r are selected as 1 and 2 to a negative power, respectively, where m and r are variables used in ApEn calculation. An ApEn is implemented via a huge array of registers to accumulate data in a detection window and provide the 2-D array computation, including variance computation and distance calculation between two coordinates, in the entire accumulated data. Therefore, an A-ApEn is proposed and verified to decrease the complexity of calculation and the memory size compared with other types of ApEn. The designed circuit block is illustrated in Fig. 7. The idea of A-ApEn is using small segment points to calculate ApEn values and obtain their average to simulate the origin VOLUME 8, 2020  points of ApEn. The N/2 A-ApEn is selected based on the simulation result from MATLAB, where N is the number of sampled data in the algorithm detection window.
In the animal study with the operation of epilepsy on mice, which was compared with a normal status, the average spectrum of the iEEG signal in Fig. 8 shows three evident tones in the iEEG spectrum. The same experimental result was also observed in another study [39]. Therefore, a threebin value can also be selected as a feature for identification. Single-bin discrete Fourier transfer (SBDFT) and Goertzel transform (GT) [40] are good choices instead of radix-2 and butterfly fast Fourier transfer structure for calculating certain bin values. The gate counts of the SBDFT are slightly smaller than GT estimated by auto place and route (APR) synthesis tool; thus, SBDFT was selected to implement the hardware.
The architecture of the classifier is selected based on the convenience of use and area cost. The linear least square (LLS) type and the neuron network-based (NN-based) classifier are utilized in circuit implementation compared with that in our previous work [41]. The precision of the LLS type is lower, but its hardware cost is lower, in which the NN-based classifier is constructed by an SRAM to store 144 coefficients with a recursive-calculation neuron, and the LLS type only uses six coefficients with recursive calculation. Therefore, the LLS-type classifier was selected in the EDU. Test data were acquired from animal testing by using 400 s raw data for training and another 400 s raw data for testing.
Feature extraction was implemented to identify the abnormal state by every 64 points with a sample rate of 375 Hz. The 64-point window was selected based on bin frequency and A-ApEn precision. Moreover, considering animal safety, three classified results were used to determine whether stimulation is activated. In the experiment, the delay time of the feature extraction is close to 0.16 s, and the time from epilepsy attack to detection is approximately 0.5 s. Fig. 9 shows the proposed RF transceiver for wireless communication [42]. The transmitter is composed of a bias-stimulating circuit (BSC), a current-reused self-mixing voltage control oscillator (CRSMVCO), and a quadrupletransconductance power amplifier (QTPA) with a matching circuit on the output stage. The receiver is constructed by a single-end input to differential-end-output envelope detector (SDED), a level shifter, a baseband amplifier (BA), and a hysteresis comparator.

C. RF TRANSCEIVER
The BSC is implemented by delay cells, control logics, and switches with different voltage levels to generate a preemphasized waveform to the bias point of CRSMVCO at the next stage. The input of Fig. 10 (a) shows that the wave shape of the bias point is a short interval of peak voltage (V boost ) and a relatively long interval of low voltage (V bias ) in the presence of high-voltage level data input. The generated waveform, namely, V BN waveform in Fig. 10(a), not only increases data rate by V boost but also decreases power consumption and maintains VCO function during V bias , in which power consumption is proportional to bias voltage.
The self-mixing technique is implemented by a frequency doubler and a cross-couple mixer (CCM) with a currentreused structure in CRSMVCO to decrease power consumption and increase phase margin, where the self-mixing circuit acts as a positive feedback loop to enlarge the amplitude of the output resonant signal. Moreover, the method of the capacitor feedback with CCM [43] is adopted to not only cancel the parasitic effect but also enhance the equivalence transconductance of the CCM pairs without extra current. The transconductance with 1.7 mS can be expressed as ''C 2 /C 1 × R,'' where R is the total loss of the LC-pair, and C 1 = 0.02 pF. Fig. 10 (b) shows that the proposed QPTA uses the same operation current on two pairs of common drain and common source amplifiers to achieve the quadruple transconductance donated to the overall gain and improve the power efficiency of the whole power amplifier compared with that of traditional power amplifier. Fig. 10 (c) shows that a single-input differential output amplifier is implemented at the input stage of SDED with the advantage of no external balun, which usually requires a large area, thereby making system-level integration difficult. According to the characteristic of MOSFETs' nonlinearity and corresponding derivation result of square law, the DC level of the amplifier output can be increased when the carrier is received by the SDED. The first-order low-pass filter of the output stage is used to slightly remove the harmonic    distortion from the other terms of nonlinearity. In addition, the impedance boosting technique is used to provide a large output resistance and enhance the conversion gain. Fig. 11 shows that the controller is followed by an 88-bit comment to realize the stimulation wave shape by four time intervals and two intensities on three different modes (pulse width modulation, monophasic, or biphasic current stimulation) with the setting of stimulation counts and the least time interval between two stimulation feedback procedures. Fig. 12 illustrates the block diagram of the stimulator, which is composed of a stimulation controller, an 8-bit current- steering digital-to-analog converter (DAC) with switches for current direction control and a range of 0-510 µA, and an VOLUME 8, 2020  optical stimulation module constructed by discrete components. The electrical stimulation method is similar to an Hbridge structure, which is featured on simple to realize and well phase match for charge-balanced stimulus [44], by using the digital circuit to control the switch on the output stage of current DAC. The comment, which is decoded by the arithmetic logic unit with a simple check at the first stage, is set to activate the stimulator at the beginning. The controller has two modes, namely, open (manual)-or closed (auto)loop mode, to control the stimulation. Moreover, the level shifter is used as the interface of digital and analog circuits for integration.

V. EXPERIMENTAL RESULT
The measured result and condition are provided in four parts. Sub section A shows the measurement result of the designed WPSSoC. Sub section B describes the measurement, including the optical stimulation module and the brain tissue model. Sub section C details the animal testing flow. Sub section D  presents the measurement of the integrated system with the result of optical and electrical stimulations displayed on the custom software screen. Fig. 13 shows the chip photograph. The proposed WPSSoC was fabricated in an 0.18 µm CMOS process, and the total chip area is 3.63 mm × 3.77 mm.

A. MEASUREMENT AND VERIFICATION OF WPSSoC
In Fig. 14, the sensing channel is verified by a 5 mV P−P input with 10 Hz for single-tone testing. The effective number of bits is about 8.5, and the third harmonic distortion is about 70.64 dB when implementing a 27 dB gain in CPGA. The sensing channel with the decimation filter is measured under the input signal of 2.5 mV P−P according to a two-tone test with 10 and 30 Hz, respectively. The gain of 27 dB is selected in CPGA, the sampling frequency of HPSDM is 48 kHz, and the equivalent sampling frequency after decimation is 375 Hz. The measured intermodulation distortion on third order (IMD3) is 68 dB, and the power consumptions are  29 and 16 µW for acquisition circuits and the decimation filter, respectively.
The epilepsy detection algorithm was verified by using four datasets with normal-to-epileptic waveform, and the measured accuracy and sensitivity are 88.73% and 86.16%, respectively, as estimated with a self-labeled dataset. Fig. 15 shows the schematic of the epilepsy detection algorithm by using in vivo datasets. Although the obtained result is generally correct, the artifact caused by the breath behavior of mice allows the epilepsy detector to react.
The measured functions of the stimulator, including monophasic and biphasic waveforms, are also illustrated in Fig. 16. The upper part shows a single waveform shape of stimulus, and the lower part implies the stimulation action on treatment.
The measured waveform of the proposed transceiver is presented in Fig. 17. In the transmitter, a 122 mV P−P (−14.3 dBm) with OOK modulation is measured on the output of the transmitter with a data rate of 16 Mbps. The measurement conditions on the receiver are 2.45 GHz OOK carrier modulated pseudo-random data with 11 mV P−P (−35 dBm) and 1 Mbps data rate. S 11 on receiver can achieve −17 dB at 2.455 GHz. The transceiver is also verified by the communication in a 13.5 cm distance. The bit error rate (BER) versus distance plot of the proposed wireless interface is also given with the antenna gain of 5 on measurement. A 2 × 10 −4 BER can be achieved when the distance is about 14 cm. The related information is listed and compared with previous works in Tables 2 and 3.
Details of each sub block specification in the proposed WPSSoC are also listed in Table 4. Total power consumption of the proposed WPSSoC is less than 1 mW. VOLUME 8, 2020

B. ELECTRICAL/OPTICAL STIMULATION SETUP
The LCR meter was used to test the impedance composed of the electrode and the brain tissue of mice to ensure the real impedance of the whole electrical stimulation loop. The measured and synthesized results are shown in Fig. 18. The impedance model was synthesized by MATLAB with the curve fitting method. Four-element RC-shunt with a series R model was used to synthesize rather than a RC-shunt with a series R model for increased fit with the result measured with six mice.
The output power of optical stimulation was measured and ensured using the ceramic connection pipe (ADAF1-5, Thorlab) with fiber by the optic power meter. The block diagram of the optical stimulating module is illustrated in Fig. 19 (a). The laser diode in this illustration is made by Osram (PL450B). The output integrity of optical power is controlled by the variable resistor with 16 modes controlled by the commands   from WPSSoC and an outside MCU. The measured result of the integrity in different modes is presented in Fig. 19 (b), where the flicker frequency of laser is 100 Hz. Seven modes  of intensity can be used in the real application with sufficient output power.

C. ANIMAL TESTING FLOW
In the animal test, 90-day-old C57BL/6 mice with Thy1-ChR2-YFP gene transfer were used to verify the inte- gration system. All experiments were executed and supported by the National Cheng Kung University Hospital VOLUME 8, 2020 and the Institution of Animal Care in National Cheng Kung University. Fig. 20 shows the implant positions of the electrode and the surgery-experimented mice. E2 is the recoding electrode with a double-channel stainless wire (MS303/2-A/SPC, PlasticOne), E1 and E3 are the mounting screw electrodes (E363/20/2.4/SPC, PlasticOne) that serve as reference points for electrical stimulation and two-channel iEEG measurement, and E4 is the fiber (CFM12L02, Thorlab) with stainless steel to connect with the laser unit.
The test flow chart of the animal study is illustrated in Fig. 21. Anesthesia system and stereotaxic apparatus support the electrode implant surgery. The lithium-pilocarpine acute-epilepsy model was adopted in this paper to induce attack by a large damage in the hippocampus. One-week rest was needed to let the artifact caused by the wound to decrease after electrode implant surgery. Lithium chloride was injected at 17-24 h before pilocarpine was injected to induce acute epilepsy in the animal test. The amount of medicine used in the experiment is expressed in (1).

D. VERIFICATION OF EPILEPSY SUPPRESSION BY WPSSoC
The measurement of epilepsy suppression is illustrated in Fig. 22 with two cases of epilepsy suppression. In the first case, the electrical stimulation in 100 Hz, 192 µA, 50% duty cycle with about three cycles of duration was applied to depress the epilepsy. In the second case, the optical stimulation in 60 Hz, 58 mW intensity, and 3 s duration was used to suppress the epilepsy. The difference between optical stimulation and electrical stimulation was observed as mentioned in a previous section. Optical stimulation results in a slight artifact, and electrical stimulation induces a large artifact. Fig. 23 (a) shows that the whole system also shrank into a PCB with a wireless interface and off-chip components. The size is 4.3 cm × 2 cm. The detailed block diagram of the housed components in test PCB is also provided. A current buffer with high-voltage supply supported the insufficient voltage of the in-chip DAC to apply electrical stimulation in animal testing. The artifact-tolerant method to prevent DC offset from the electrode was required in real in vivo testing, where on-chip solutions were also provided by previous works [52], [53]. Without a designed on-chip, the DC blockage (high-pass filter with bias, corner frequency: 0.05 Hz) with passive element was added at the input stage of integrated system board to prevent the DC offset. BLE was adopted as the wireless interface that connects to the custom software screen illustrated in Fig. 23 (b), and a 60 mAh lithium battery was used in the experiment. Measurement setup and experimental situation of the microsystem with WPSSoC on irritated electrode-implanted C57BL/6 mice are shown in Fig. 23 (a). The proposed WPSSoC is compared with recent works in Table 5 based on performance and system item.

VI. CONCLUSION
A system involving gene transfer, epilepsy suppression, onchip circuit design, off-chip hardware with peripheral unit, and custom software is presented and integrated into PCB. The hypothesis between electrical and optical stimulations is verified using biotechnology. The proposed WPSSoC is implemented in circuit design domain. Moreover, optical stimulation is verified with intensity control function. The impedance model of the stimulation loop is synthesized and provided. The whole design is integrated into a PCB with 4.3 cm × 2 cm for an animal study. Two stimulation methods, namely, electrical and optical stimulations, are verified and controlled by GUI via the self-developed custom software.
In vivo testing shows that optical treatment has a slight artificial noise on iEEG and is another choice of stimulation for epilepsy treatment.