Extracellular pH monitoring for use in closed-loop vagus nerve stimulation

Objective. Vagal nerve stimulation (VNS) has shown potential benefits for obesity treatment; however, current devices lack physiological feedback, which limit their efficacy. Changes in extracellular pH (pHe) have shown to be correlated with neural activity, but have traditionally been measured with glass microelectrodes, which limit their in vivo applicability. Approach. Iridium oxide has previously been shown to be sensitive to fluctuations in pH and is biocompatible. Iridium oxide microelectrodes were inserted into the subdiaphragmatic vagus nerve of anaesthetised rats. Introduction of the gut hormone cholecystokinin (CCK) or distension of the stomach was used to elicit vagal nerve activity. Main results. Iridium oxide microelectrodes have sufficient pH sensitivity to readily detect changes in pHe associated with both CCK and gastric distension. Furthermore, a custom-made Matlab script was able to use these changes in pHe to automatically trigger an implanted VNS device. Significance. This is the first study to show pHe changes in peripheral nerves in vivo. In addition, the demonstration that iridium oxide microelectrodes are sufficiently pH sensitive as to measure changes in pHe associated with physiological stimuli means they have the potential to be integrated into closed-loop neurostimulating devices.


Introduction
Vagal nerve stimulation (VNS) has been used clinically for many years for the treatment of intractable epilepsy [1]. However, it is becoming increasingly clear that VNS offers potential therapeutic benefit in a number of conditions. One such condition is obesity, where pre-clinical and clinical studies have shown VNS produces moderate weight loss [2][3][4][5]. In the USA, the Federal Drug Administration (FDA) has recently approved the use of VNS for the treatment of obesity.
The role of the vagus nerve in promoting weight loss is well documented. Signals which terminate feeding such as cholecystokinin (CCK) and gastric distension, mediate their effects through interacting with the vagus nerve [6][7][8], which in turn activates brainstem areas associated with satiety [9]. Sensitivity of the vagus nerve to these satiety signals is reduced in obesity [10] and is believed to be enhanced by VNS [11].
Currently the main limitation with VNS devices (and indeed most brain-technology interfaces), is lack of physiological feedback. Integration of physiological feedback to control stimulation is generally associated with improved therapeutic efficacy [12,13]. Recording changes in the activity of the vagus nerve associated with satiety signalling, and stimulating it in response to them, may augment the normal physiological signalling of the vagus and increase the efficacy of VNS. However recording such changes remains problematic.
Recording changes in electrical activity of the vagus nerve is one such method by which physiological feedback can be incorporated into VNS devices, however electrical recordings from peripheral nerves tend to be in the µV range [14], meaning they are hampered by low signal to noise ratio (SNR). In order to compensate for this, individual axons either have to be dissected out of the nerve [15], or the whole nerve removed for ex vivo recording [16]. Both methods severely limit the amount of in vivo functionality that can be deciphered. It is therefore clear that novel technologies for the detection of changes in neural activity in vivo are required for a chronically implanted device.
Previous studies have demonstrated that neural activity correlates with changes in extracellular pH (pH e ) [17][18][19]. In the ex vivo vagus nerve, electrical stimulation results in alkaline pH e shifts of around 0.02 pH units and acid shifts of around 0.05 pH units [18]. Furthermore, in in vitro central nervous tissue preparations, depolarisation of neuronal membranes results in pH e changes in both the acidic and alkaline direction [20]. Since pH e changes are recorded directly from within target tissues, they lack interference from distal tissues, providing greater SNR than traditional electrical recordings. However, previous studies examining pH e changes associated with neural activity have significant limitations, in that they have exclusively been performed either in vitro or ex vivo, and by utilising glass micropipettes to record pH e changes. Due to their fragility and lack of biocompatibility, the use of glass microelectrodes remains unsuitable for incorporation into implantable closed-loop devices. Recent advances in chemical sensing technology and materials have enabled new, stable methods for ionic sensing, especially with pH sensing (for review see [21]). Iridium oxide (IrO x ) has previously been shown to have good pH sensing properties [22] and recently, we described a method for measuring pH in biological tissue using electrodeposited IrO x [23,24]. An IrO x microwire has the advantage of being rigid, thus allowing easy penetration of the nerve. In addition, iridium is widely used in implantable stimulating electrodes due to its biocompatibility [25]. Sputtering or electrodeposition of iridium oxide is a typical process used in the construction of neural electrical recording electrodes, such as the Utah microelectrode array [26]. Chemical sensing of dopamine has previously been achieved in vivo and successfully integrated into closed-loop neurostimulating devices [27], but chemical sensing of the peripheral nervous system in vivo has not yet been achieved. Advances in chemical sensing technologies mean it is now possible that pH e recordings could be incorporated into closed-loop neurostimulating devices. However pH e changes in the vagus nerve have not yet been demonstrated in vivo.
In this paper, we aimed to determine (a) whether IrO x microelectrodes have sufficient pH sensitivity as to detect changes in pH e in the in vivo vagus nerve associated with naturally occurring satiety signals, and (b) whether such changes in pH e could be used for closed-loop VNS.

Production of IrO x microelectrodes
Iridium wire (0.125 mm temper annealed) was soldered to the exposed end of a covered stainless steel wire. A heat shrink was applied to the exposed connection and Araldite glue applied to each end. After drying, iridium microelectrodes were oxidised in dilute sulphuric acid (0.5 M) using cyclic voltammetry (CHI760E electrochemical workstation, CH Instruments, USA) for 2.5 h.

Calibration of in-house constructed IrO x mircroelectrodes and Utah electrodes
IrO x microelectrodes and commercially available Utah array were tested for pH sensitivity using 5 pH buffers (pH4-8). Custom made Matlab code then determined the electrochemical potential of each IrO x microelectrode and Utah array. For in vivo studies, only IrO x microelectrodes with a sensitivity of >40 mV/pH were used.

Animals
Male Wistar rats (average weight 350 g, range 300-400 g) were used in all experiments and were obtained from Charles River. All experiments were conducted in accordance with the Animal (Scientific Procedures) Act 1986 and following local ethical approval. Unless otherwise stated, animals were allowed ad libitum access to food and water and were maintained on a 12 h light:dark cycle.

pH measurements from subdiaphragmatic vagus
Rats were initially anaesthetised with isoflurane. An intravenous cannula was inserted into the tail vein, through which urethane was slowly infused (20 mg kg −1 ) over a period of 25 min, during which isoflurane was slowly reduced to zero. Full anaesthesia was assessed through absence of forepaw pinch reflex. Throughout the procedure, body temperature was monitored via rectal thermistor and maintained at 37 ± 1 °C (PhysioSuite, Kent Scientific). Heart rate and oxygen saturation were monitored through a pulse oximeter (PhysioSuite, Kent Scientific). Once fully anaesthetised, a midline incision was made in the neck and the trachea exposed, incised and intubated, to allow artificial ventilation (WPI, CW-SAR1000). To record pH changes in the subdiaphragmatic vagus nerve, a midline incision was made in the abdomen, the oesophagus and subdiaphragmatic vagus nerve were exposed and a small thread placed under the vagus. The IrO x microelectrode was inserted into the vagus nerve and the abdominal cavity was filled with warmed paraffin oil. A silver-silver chloride (Ag/AgCl) electrode was placed inside the abdominal cavity to act as a reference.

Cervical stimulation and electrical recording
In a subset of animals (n = 13), the ipsilateral vagus nerve was stimulated at the cervical level. The cervical vagus nerve was exposed using the same midline incision used for ventilation, and a pseudo-tripolar electrode was placed under the nerve. A bipolar platinum electrode was placed inferior to the IrO x microelectrode for electrical recording of stimulated compound action potentials (CAPs). Symmetric biphasic pulses of 0.1, 0.2, 0.5 and 1 ms, with currents ranging from 0 to 3 mA were applied to the cervical ipsilateral branch (Keithley 6221 current source, Tektronix, USA), programmed via custom made Matlab script. Each current was iterated 10 times and averaged. Signals were then integrated over bins of 2 ms and a threshold applied (90th percentile of all signals) to detect clusters of A and C fibre activity. C fibre threshold was set at 2 m s −1 . These strength-duration curves were model led using Weiss' equation: Rheobase * (1 + Chronaxie⁄PW), where PW is the pulse width. In the control case, no electrode was inserted and four strength durations generated. CAPs were recorded using a RHD200 Series amplifier (Intan Technologies, USA) which utilises the multichannel RHD2132 Digital Electrophysiology Interface Chip (gain 45.66 dB, bandwidth 0.2-7.2 kHz). The signal was recorded using Intan's data acquisition software. Bipolar platinum electrodes; similar to those used to record, were placed under the abdominal skin to act as reference electrodes.

CCK studies
In a subset of rats (n = 6), CCK at increasing doses (50-300 pmol kg −1 ) was administered to stimulate the vagus nerve. The IrO x electrodes were tested prior to and after the experiment to determine their sensitivity. Following introduction of the IrO x microelectrode, animals were left to stabilise for 10-15 min. Following baseline pH measurements, CCK-8 (Tocris Bioscience, UK) was dissolved in saline and the required amount drawn into a 250 µl Hamilton syringe, which was back filled with saline. CCK was delivered through the i.v. tail cannula, with a further 250 µl saline used to flush the cannula. A minimum of 15 min was left between subsequent injections.

Gastric distension
In a subset of animals (n = 5), gastric inflation was used to stimulate afferent vagal nerve activity. Animals were fasted for 24 h prior to the experiment. Following exposure of the vagus nerve, as detailed above (section 2.4), but prior to insertion of the IrO x microelectrode, an 8Fr Foley catheter with 3 ml balloon was inserted into the stomach through the oesophagus, with the balloon positioned inside the stomach. The IrO x microelectrode was then inserted into the vagus nerve and the animal was left to stabilise for 10-15 min. Following baseline pH recordings, the balloon was inflated for 3 min with increasing volumes of saline (0.5, 1, 2 and 3 ml), with a minimum of 15 min between inflations.

Data acquisition
pH data was collected from the sensors in vivo using commercially available multichannel instrumentation amplifiers, EMF 6 (Lawson Labs Inc, USA), in differential configuration.
The sampling rate of the data acquisition was set at 5 Hz per channel to capture pH changes and safely avoid high frequency electromagnetic or line interference at 50 Hz. The data acquisition and amplifier configuration was performed using customised software provided by Lawson Labs.

Data analysis
The recorded neural pH signal typically consists of inherent drift originating from the open circuit potential of the IrO x electrode [28]. This linear drift was negative in almost all instances, and was unidirectional throughout the recording. As part of the post-experiment data analysis procedure, the acquired data was subjected to linear estimation using custom made Matlab script, to account for the linear electrode drift. This was done by selecting an observation window (OW), prior to the injection time. The size of the OW varied between 2 and 5 min dependent on the variance of drift. The size of the OW was chosen from the instance when the stimulus was introduced to point of slope changes. After choosing a suitable OW size, a linear regression was applied on the pre-injection pH waveform. As shown in figure 1(A), the pH waveform, including pre-stimulus pH waveform and the observed pH change in response to the stimulus was subtracted, from the OW linear estimation to subtract background and remove electrode drift to give an accurate value of the pH change associated to the stimulus.
To calculate relative pH change, baseline pH and peak pH values were obtained by recording the average value of a 5 s window just prior to the stimulus and at peak change. The relative pH change was then calculated by subtracting these values.

Statistical analysis
To determine whether relative changes in pH to a given stimulus were statistically significant, paired t-tests were used to compare baseline against peak pH change. A p value of <0.05 was considered statistically significant. Values for each stimulus from each animal were then pooled and a one-way ANOVA was used to determine significance between groups.

Code calibration for closed-loop experiments
The data recorded by the EMF 6 was monitored in real time using a Matlab script and converted into pH values from voltage values based on the sensitivity of IrO x electrodes measured prior to the experiment. In order to detect the pH change due to CCK injection, the pH waveform was monitored for a period of 5 min pre-injection. This period is referred to as the code calibration period. During code calibration, a linear estimation was applied to the waveform over OW epochs of 1 min to calculate linear drift/slope of the pH in the nerve. The reason for applying a linear estimation was to apply the transformation between pH and voltage in accordance with the Nernst equation. At the end of the code calibration period, the mean slope and the slope standard deviation of 1 min epochs was recorded and CCK was injected. The above method was adopted to mitigate the effect of large non-linear changes in real time.

Detection of pH change for closed-loop stimulation
After code calibration (section 2.11) and CCK injection (section 2.6), the pH waveform following injection was also monitored in epochs of 1 min (figure 6(C)), in which the linear regression was applied on the epochs in real time. However, this time, the epoch slope was subtracted from the mean code calibration slope to minimise false detection. Previous experiments in which 300 pmol kg −1 CCK was applied (section 3.3) showed that this dose of CCK produces a change in pH of −0.03 ± 0.01 pH min −1 before returning to baseline. At any given time the code ensures that the epoch slopes of the past 2 min and the pH waveform are stored. If the ΔpH slope of the previous epoch is negative and its absolute value is 0.03 ± 0.01 pH min −1 , the code then checks ΔpH slope in the subsequent epoch to be positive (i.e. returning to baseline). If this condition is satisfied, then the pH waveform trend is said to be similar to the CCK response trend (figure 6(C)). The stimulation parameters (frequency, pulse width of stimulation, duration of stimulation and stimulation current) having been programmed into the Keithley 6221 current source using the Matlab script prior to injection, and on detection of the pH slope trend, the Keithely 6221 was signalled to start electrical stimulation. With the above univariate methodology of CCK-pH response detection, there is a minimum delay of 2 min between CCK injection and start of stimulation. At the onset of stimulation, the epoch slopes are not monitored for a period of 15 min before the next CCK injection.

pH sensitivity of IrO x microelectrodes and Utah array
The pH sensitivity of in-house constructed IrO x microelectrodes was determined before and after each experiment. Because the Utah array is a validated electrode for clinical use [29,30], the pH sensitivity of an iridium oxide constructed Utah array was also determined. Figure 2(A) shows the typical pH response slope of a single in-house constructed IrO x microelectrode compared to an IrO x constructed Utah array. This IrO x microelectrode shows a pH sensitivity of −75.39 ± 0.07 mV/pH unit. In comparison, the Utah array has a slightly lower pH sensitivity of −59.9 ± 4.8 mV/pH unit. Figure 2(B) shows the average pH sensitivity of a population of IrO x microelectrodes before and after experimentation, demonstrating a slight decrease in sensitivity after experimentation (−68.78 ± 5.3 mV/pH unit versus −64.75 ± 7.94 mV/pH, p < 0.002, n = 16).

Nerve integrity testing
Strength duration curves were produced by electrical stimulation of the ipsilateral vagus nerve at the cervical level before and after IrO x electrode insertion into the subdiaphragmatic region. Rheobase is a measure of neuronal excitability, and is defined as the minimum current required to depolarise a neuronal membrane. Chronaxie is the minimum time required for a current double the rheobase to depolarise a neuronal membrane. These parameters are governed by the Lapicque equation: Where I relates to current, b rheobase, c chronaxie and d duration.
Rheobase and chronaxie measurements showed no significant alterations in excitation properties ( figure 3). Furthermore, latency to activation, fibre type activation and stimulation threshold were unaltered. Control experiments, in which multiple strength duration stimulations were performed in the absence of IrO x electrode insertion showed no alterations in nerve responses. This suggests that insertion of the IrO x electrodes into the subdiaphragmatic vagus nerve does not result in acute injury to the nerve.

CCK-induced changes in pH e
The ability of CCK to produce detectable changes in pH e in the subdiaphragmatic vagus nerve was investigated. Intravenous injection of increasing doses of CCK (50, 100, 300 and 1000 pmol kg −1 ) produced significant dose-dependent acidosis in the vagus nerve of 0.014 ± 0.004 pH units for 50 pmol kg −1 to 0.039 ± 0.007 pH units for 1000 pmol kg −1 ( figure 4). In some cases, this acidosis was followed by alkalosis (as observed in figure 6). The decrease in pH started within 15 s of injection, and lasted between 3 and 4 min before returning to baseline. Injection of saline alone did not result in any significant change in pH e (figure 4(E)).

Gastric distension-induced changes in pH e
We then determined whether gastric distension produced detectible changes in pH e in the vagus nerve. Small distension volumes (0.5-1 ml) produced a reproducible alkalosis of 0.017 ± 0.0009 and 0.025 ± 0.003 pH units respectively (figures 5 (A) and (B)). In 55% of cases, larger distension volumes (2-3 ml) produced an alkalosis of 0.05 ± 0.01 and 0.03 ± 0.004 pH units respectively (figures 5(C) and (E)), whereas in the remaining 45% of animals, an acidosis was observed of magnitude 0.05 ± 0.01 pH units and 0.06 ± 0.01 pH units for 2 and 3 ml respectively (figures 5(D) and (F)).

Demonstration of closed-loop capabilities of pH e measurements
Finally, we sought to demonstrate that IrO x -measured pH e changes in the subdiaphragmatic vagus nerve could be used for closed-loop VNS. Intravenous infusion of 300 pmol kg −1 CCK produced a significant change in pH e (as described above in section 3.3). Matlab code produced in house automatically identified the shift in pH and triggered a neurostimulator implanted on the ipsilateral cervical vagus nerve (figures 6(A) and (B)). Automatic stimulation of the left vagus nerve was associated with a reduction in heart rate that lasted for the duration of stimulation, before returning to baseline. CCK injection itself was also associated with a modest decrease in heart rate, which has been described previously [31] and was less than that observed for VNS. Stimulation of the ipsilateral vagus nerve also caused profound changes in pH e (likely due to stimulation-induced electrical activity). This lasted for around 10 min before returning to baseline. The detection algorithm is written as such that following positive detection of a CCK-induced pH e change; no further changes are recorded for 15 min. This mitigates the risk of false positive detections caused by stimulation-induced pH e changes.

Discussion
In this paper we demonstrate a method for recording changes in extracellular pH in the subdiaphragmatic vagus nerve in vivo, in the anaesthetised rat. Furthermore we provide evidence that pH e can be incorporated into, and used for closedloop neurostimulation.
It has been previously documented in vitro that electrical activity of neurons is coupled with changes in extracellular pH [17,18,20]. Furthermore, IrO x has previously been validated as a pH sensor [22,32], however IrO x microelectrodes have never before being applied to the measurement of pH fluxes in peripheral nerves. This has traditionally been achieved through the use of glass micropipettes in ex vivo nerve preparations. Due to technical limitations, the use of such micropipettes in vivo is challenging, and due to their fragility and inability to be miniaturised, such micropipettes are unsuitable for implantation. Here, we have demonstrated that IrO x microelectrodes are sufficiently sensitive to measure changes in pH e in neuronal tissue in vivo caused by physiological stimuli and such changes can be used to drive algorithms for closed-loop neuromodulation.
The vagus nerve is a highly complex nerve, receiving sensory information from both thoracic and abdominal organs. In this regard, signals arising from the gastrointestinal tract can be masked by afferent information arising from cardiorespiratory organs. In order to overcome this issue, we recorded pH e changes specifically from the subdiaphragmatic region of the vagus nerve, which does not receive afferent information from such organs. Furthermore, as this was a proof-ofconcept study, animals were artificially ventilated throughout the experiment in order to prevent any changes in spontaneous ventilation which could result in changes in systemic pH. Nevertheless, given the homeostatic mechanisms involved in regulating systemic pH in the conscious animal, we do not anticipate such changes to significantly affect recording accuracy.
Following CCK administration, pH e reliably and reproducibly became more acidic, regardless of the administered dose. This contrasts with gastric distension, whereby small levels of distension (0.5-1 ml) produced alkaline responses, but larger levels of distension (2-3 ml) either produced a biphasic alkaline followed by acidic response, or acidic only. The reasons for this difference in response to the same stimulus across animals are not fully understood, nor are the underlying mechanisms governing pH e changes associated with neural activity. However, both acidic, alkaline and biphasic changes in pH e have been observed by others [33][34][35][36]. Kraig et al found that repetitive stimulation of the rat cerebellum often, but not always, resulted in an initial alkaline shift [33]. This initial alkaline shift was blocked by Mn 2+ , a calcium channel blocker, suggesting a role for calcium-induced neuronal activity. In contrast, Chesler and Chen found that stimulation of the turtle cortex in vitro resulted in alkalisation, which lasted for the duration of the stimulus and was also blocked by application of Mn 2+ [36]. The vagus nerve has previously been shown to respond with a brief alkalisation followed by acidification following stimulation in vitro, although no underlying mechanism was investigated [18], however, it has previously been suggested that acidosis could be the result of metabolic acidosis [37]. In our study, we have observed both acidic and alkaline changes in pH e in the vagus nerve in response to two distinct physiological stimuli. In the case of gastric distension, we observed both alkaline shifts and acidic shifts to the same level of stimulus across animals. If the acidification is due to metabolic acidosis, this may represent differences in the ability of the nerve to respond to large stimuli, or may be related to differences in the interaction with afferent fibres communicating gastric distension in the nerve, since these contribute only a minor population [8]. In this paper, we have not sought to add information as to the mechanisms by which pH e changes occur in response to neural activity, but have sought to demonstrate the applicability of pH e to closed-loop neurostimulation. In this demonstration, we used 300 pmol kg −1 CCK as the stimulus, which produces reproducible changes in pH e , with a characteristic shape, slope and peak pH e change across animals. Through this, the detection algorithm could be 'trained' to detect this characteristic change in pH e , thus reducing the chances of false-positive detections. The different responses in pH e associated with gastric distension produce an obvious limitation to the algorithm design, however provided the response is maintained in each individual animal, it is possible that the algorithm could be trained in the same manner.
The electrochemical potential of iridium oxide in a solution depends mainly on the pH of the media, since an electrochemical equilibrium between the iridium oxide and the H + ions is established as described by the following equation: This equilibrium is governed by the Nerst equation: This equation predicts that the electrochemical potential of the iridium oxide electrodes changes linearly with the pH with a typical slope of −59 mV/pH unit. In reality, interfacial equilibrium is slightly more complex which accounts for larger slopes, typically ranging from −59 to −90 mV/pH unit depending on the preparation protocols. Using our protocols, we demonstrate a pH sensitivity of −68.78 ± 5.3 mV/pH unit. The differences between measured and theoretical pH sensitivities of IrO x are dependent upon the reduction state of the anodic iridium oxide film, with the reduced state having more acidic properties than the oxidised form [38] and are therefore influenced by oxidising paradigm and efficiency.
Recording neural activity has become a major challenge in the expanding field of neuro-technology. Electrical recording from within neural tissue offers significantly enhanced spatiotemporal resolution when compared to non-invasive techniques (e.g. fMRI, EEG) [39]. However recordings from peripheral nerves are especially associated with interference from neighbouring electrically dependent processes (e.g. heart rate, respiration, muscle movement) [40]. Small electrical signals produced by peripheral nerves, as well as the presence of interfering bioelectrical signals from distal tissues within the bandwidth of interest, produce challenges for electronic frontends and interfaces [41]. We sought to overcome these limitations by recording chemical changes associated with nerve activity. Chemical signals have significantly higher amplitude (tens of millivolts) and hence better SNR compared with traditional electrical recordings. The chemical signals also have lower bandwidth, hence making them easy to separate from interferences such as cardiorespiratory signals. In the context of the vagus nerve, we have demonstrated that chemical neural recordings can be used as a viable means of detecting We have also demonstrated that neural pH e changes observed in relation to CCK and gastric distension have characteristic shapes and follow dose-response relationships.
In order to further increase spatial resolution of neural recordings, various laboratories have developed high density multielectrode arrays (MEAs), with large numbers of individually addressable spikes. Many of these MEAs have the added benefit of varying spike length, offering further spatial resolution. One such device is the commercially available Utah electrode array (UEA), which is constructed from either platinum or iridium oxide. Because of its construction from IrO x , and its previous use in clinical applications [29,30], we further provided evidence that the UEA has pH sensing capabilities. The development of a slanted UEA for use in peripheral nerves [26], further increases the possibility that devices such as the UEA can be used for human pH e nerve recordings.

Conclusions
VNS has been shown to produce moderate effects on weight loss using current 'open-loop' technologies [2,5,42]. The addition of physiological feedback to create closed-loop VNS devices has been shown to offer greater efficacy [43,44]. We provide a novel approach to providing physiological feedback to VNS devices, through the use of extracellular pH changes associated with neural activity. Furthermore, the use of pH e for the control of neural implants extends further than peripheral nervous tissues, and has the potential to integrate into central brain structures. The characteristic shape of neural pH change, its proportionality to dosage, ease of separation from interfering signals, the possibility to record neural pH e using IrO x , (which is a biocompatible material and has an established fabrication procedure), and the demonstration that pH e can be used in a closed-loop paradigm, demonstrates that chemical neural recording has the potential of being used as a viable neurotechnology within closed-loop implants. The drop in pH e is detected by custom made Matlab script and triggers the implanted stimulator (grey line). (C) Schematic representation of custom made Matlab script. Script reads data in 1 min epochs, with a decrease of 0.03 ± 0.01 pH min −1 in OW2 against OW1, followed by an increase in pH e of the same magnitude in OW3 is recognised as a positive CCK-induced pH e change. (D) should the introduction of CCK occur in the middle of an OW, the OW window is automatically reduced to 30 s. N = 11 animals. and is supported by the NIHR Biomedical Research Centre Funding Scheme.

Author contributions
AE, SRB and CT conceived the project. SCC performed in vivo pH recordings and closed-loop stimulation recordings. AE and KBM produced Matlab scripts for data analysis. KBM produced Matlab scripts for closed-loop VNS. CZ developed the protocol for IrOx microelectrode production. SCC wrote the manuscript with input from all authors. KN, JVG, SRB and CT directed the project. JVG, SRB and CT directed the project.

Competing financial interests
CT holds a patent on chemical monitoring of the vagus nerve (US9055875 B2). All other authors declare no competing financial interests.