ABSTRACT
Purpose
Gastrointestinal slow waves are rhythmic electrical events that contribute to the coordination of motility. Functional motility disorders such as gastroparesis are linked to abnormal slow wave activity, and current treatments do not target the underlying electrical dysfunction. Gastrointestinal electrical pacing restores normal rhythms, but open‐loop pacing lacks adaptation to underlying slow wave activity, leading to reduced energy efficiency and potential overstimulation.
Methods
A novel closed‐loop pacing system was developed to detect gastric and intestinal slow waves and dynamically pace in response to the underlying rhythm. High‐resolution electrode arrays were placed on the serosal surface of anesthetized pigs for simultaneous pacing and mapping. The control strategy comprised two steps: (i) continuous detection and classification of slow waves as normal rhythm (stomach: 15–25 s; small intestine: 3–5 s) or abnormal rhythm; and (ii) pacing delivery and entrainment assessment, with pulses (100–400 ms, 3–8 mA) triggered by abnormal rhythms or failed entrainment.
Results
Detection of slow wave events achieved an accuracy of 78% for both the stomach and the small intestine. Entrainment detection yielded an accuracy of 73% for the stomach and 67% for the small intestine. Closed‐loop pacing successfully restored abnormal gastric and small intestinal slow wave periods to normal physiological ranges and reduced the number of pulses delivered by 60% compared to open‐loop pacing.
Conclusion
Closed‐loop pacing significantly reduced pulse delivery, demonstrating the feasibility of a targeted, adaptive approach that may reduce pacing burden, although effects on motility and gastric emptying warrant further investigation.
Keywords: closed‐loop pacing, entrainment, gastrointestinal motility, pacing, slow waves
Key Points
A novel closed‐loop gastrointestinal pacing system was developed that detects and classifies slow wave activity and delivers pacing only when abnormal rhythms are identified.
Closed‐loop pacing successfully restored gastric and small intestinal slow wave periods to physiological ranges while achieving reliable detection and entrainment performance in vivo.
Compared with conventional open‐loop pacing, the proposed approach reduced pulse delivery by 60%, demonstrating improved energy efficiency and more targeted bioelectrical modulation.
Closed‐loop gastrointestinal pacing continuously monitors electrical rhythm, detects dysrhythmia, delivers adaptive pacing, and verifies entrainment to restore normal electrical rhythm.

1. Introduction
Gastrointestinal (GI) motility is regulated in part by electrical events known as slow waves. These slow waves are generated by pacemaker cells called the interstitial cells of Cajal [1, 2, 3]. Disruptions to these electrical events can result in impaired motility which is associated with GI disorders such as gastroparesis and functional dyspepsia [4, 5]. Current conventional treatments fail to address the underlying slow wave abnormalities. Gastric electrical pacing and high frequency stimulation have been utilized as potential treatment options for GI motility disorders [6, 7]. Enterra Therapy (Enterra Medical, St. Louis Park, MN, USA) is currently the only implantable device for treating gastroparesis through continuous electrical stimulation; however, its efficacy remains variable [8, 9]. This highlights the growing need for novel targeted and physiologically responsive treatments to modulate coordinated GI activity.
GI electrical pacing involves the delivery of high‐energy electrical pulses to modulate underlying slow wave activity and improve motility [10]. Gastric and intestinal pacing can modulate slow wave patterns, restoring coordinated motility in dysrhythmic states [11, 12]. These effects suggest potential benefits for enhancing gastric emptying and nutrient absorption, especially in conditions such as gastroparesis [13, 14, 15]. Gastric electrical pacing was first proposed in the 1960s, and significant research has also been conducted to date utilizing open‐loop pacing (continuous pacing irrespective of the underlying physiology) [16, 17]. More recent efforts have refined pulse parameters and electrode configurations to improve reliability while minimizing energy usage [6]. However, the open‐loop systems are incapable of pacing in response to the underlying dynamic slow wave activity. As a result, excessive pacing pulses will be delivered, exceeding physiological requirements and thereby reducing long‐term viability due to higher energy consumption and potential tissue damage [17, 18]. These limitations have prompted further research into more sophisticated closed‐loop pacing methods to enhance treatment efficacy for GI motility disorders [19].
Closed‐loop pacing dynamically applies pacing pulses based on the underlying physiological activity. By integrating sensing and pacing in a feedback loop, these systems aim to deliver pulses only when necessary. While this concept is yet to be fully validated in GI applications, it has been widely adopted in the cardiac field [20, 21]. Resynchronization therapy and closed‐loop dual chamber pacing systems in the cardiac field highlight the potential for closed‐loop pacing to improve GI treatment outcomes by tailoring interventions to physiological needs [20, 21, 22]. Existing GI closed‐loop approaches have relied on simulated data rather than experimental data [19], and despite significant advancements in modeling and simulations, no in vivo studies have validated closed‐loop pacing for the GI tract.
This study aimed to develop and evaluate the technical feasibility of a closed‐loop GI pacing system that (i) detects and classifies slow waves as normal or abnormal rhythm and (ii) dynamically delivers pacing in response to abnormal rhythm. The performance of the system was evaluated through benchtop testing and acute in vivo evaluation in pigs.
2. Materials and Methods
2.1. Closed‐Loop Pacing System
A closed‐loop pacing system was developed and validated in MATLAB 2023b (MathWorks, Natick, MA, USA). It comprised eight interconnected components (see Figure 1) including (i) data streaming, (ii) baseline correction, (iii) pacing artifact detection, (iv) pacing artifact removal, (v) slow wave detection, (vi) entrainment detection, (vii) slow wave period classification, and (viii) pacing controller. Together they facilitated streaming, processing, and pacing of GI slow wave activity in 120 s windows. The system architecture integrated bioelectrical data acquisition setup, pacing hardware, and electrode arrays for both signal detection and pulse delivery. At initiation, a log file was generated to document applied experimental parameters, facilitating post‐experimental validation and comprehensive analysis of the system effectiveness.
FIGURE 1.

Overview of the closed‐loop pacing system that consisted of eight components: data streaming, baseline correction, pacing artifact detection, pacing artifact removal, slow wave detection, entrainment detection, slow wave period classification, and pacing controller. Entrainment detection and slow wave period classification enabled the system to identify when pacing had successfully entrained the slow wave activity.
2.1.1. Data Streaming
The system initially established a connection to stream between the acquisition system hardware, ActiveTwo System (BioSemi, Amsterdam, Netherlands), and the analysis software component, enabling signal acquisition and visualization. A graphical user interface was implemented to stream signals, while incoming data was structured for analysis and processed in 120 s time windows.
2.1.2. Baseline Correction
The baseline wander was estimated using a median filter and a Savitzky–Golay filter (polynomial order = 2; window = 3 s) [23]. The estimated baseline wander was then subtracted from the raw signal.
2.1.3. Pacing Artifact Detection
Due to the high amplitude of the pacing artifacts, the underlying slow wave activity is usually obscured [23, 24]. Therefore, pacing artifacts were detected based on an established method, which used a Hampel filter to identify outliers in the signals [23]. Once detected, artifact data were stored for further processing, enabling subsequent analysis of pacing‐induced slow wave dynamics.
2.1.4. Pacing Artifact Removal
Linear interpolation was used to remove detected artifacts from the baseline corrected signals of all recording channels [23]. Artifacts were removed by interpolating between the start and end points of each artifact across all recording channels. This approach effectively eliminated pacing artifacts, enabling more reliable analysis of the underlying electrical activity.
2.1.5. Slow Wave Detection
Following the removal of pacing artifacts, the signal was filtered using a moving mean filter (window = 1 s). Slow wave identification was performed with the MATLAB function findpeaks using the Minimum Peak Prominence parameter that was used as a criterion for distinguishing significant peaks from baseline noise. A peak was detected if its prominence exceeded a predefined Minimum Peak Prominence threshold (stomach = 0.35 mV; small intestine = 0.035 mV) [25, 26]. In addition, peak detection was constrained by the Minimum Peak Distance parameter, which defined the minimum separation required between adjacent peaks. The Minimum Peak Distance was set to 10 s in the stomach and 2 s in the small intestine to account for the expected slow wave periods. With the detected peaks, slow wave period was determined by computing the time difference between consecutive peaks. Signals without pacing artifacts were evaluated against the normal physiological range for slow wave period classification. Detection of pacing artifacts triggered subsequent assessment of entrainment status within the entrainment detection module.
2.1.6. Entrainment Detection
The entrainment detection module identified the nearest slow wave peak following each pacing artifact to compute the time lag, as illustrated in Figure 2. Time differences (∆t) within a predefined entrainment threshold between consecutive pacing artifacts and slow waves were classified as successful slow wave entrainment (1 s for the stomach and 0.1 s for the small intestine). Entrainment was assessed across overlapping groups of three consecutive pacing events (e.g., pulses 1–3, pulses 2–4, pulses 3–5, etc.), and if the time differences between the pacing artifact and slow waves were below the predefined entrainment threshold, the slow wave activity was classified as entrained. This calculation extended beyond adjacent cycles to include all detected time lags within the same analysis window, ensuring accurate pacing response evaluation and effective modulation of slow wave activity. If slow waves were entrained, the system analyzed the next time window without prompting further pacing. However, if unentrained, the signals were further evaluated in the slow wave period classification module.
FIGURE 2.

Detection of slow wave entrainment. Pacing artifacts are identified by green circles and the red line illustrates the time lag between each pacing artifact and the corresponding slow wave event (blue circles). Entrainment was determined by evaluating whether the time lags between pacing artifacts and corresponding slow wave events remained below a predefined entrainment threshold across consecutive cycles.
2.1.7. Slow Wave Period Classification
As shown in Figure 1, this module determined whether the slow wave period was within the normal physiological range. The signals which did not have pacing artifacts were evaluated against the normal physiological range of slow waves (stomach: 15–25 s; small intestine: 3–6 s) [26, 27]. If the detected slow wave period was outside this normal range (e.g., bradygastric, tachygastric or quiescent slow wave activity), the pacing controller module was activated. If the slow wave period was within a normal range, the system progressed to the next time window.
2.1.8. Pacing Controller
The system initialized an Arduino microcontroller (Arduino UNO R3) by setting parameters to transmit pacing pulses at specified intervals. Pulse delivery was managed by issuing a digital signal to the Arduino to initiate each pulse, with the corresponding timing and count recorded. All pulse events were logged for subsequent analysis and validation.
2.2. Benchtop Testing
Benchtop testing setup included a water bath designed to simulate the tissue conductivity. Two electrodes were placed in the water bath: one for recording and pacing, and one to generate rectangular synthetic waves (pulse‐amplitude = 1–2 mV, pulse‐width = 100 ms). Synthetic waves were simulated at both normal and dysrhythmic slow wave periods, where normal rhythm was defined within the physiological ranges for the stomach (15–25 s) and small intestine (3–6 s), and dysrhythmic activity as periods outside of these ranges. Secondary rectangular pulses were introduced to simulate pacing artifacts with a pulse‐amplitude of 5–8 mV and pulse‐width of 100 ms. Entrained and non‐entrained scenarios were simulated by altering the period of either the synthetic slow waves or the pacing artifacts, resulting in variable time differences between the two events.
2.3. In Vivo Application
2.3.1. Animal Preparation
Ethical approval was granted by the University of Auckland Animal Ethics Committee (AEC 28442). The study is reported in accordance with the ARRIVE guidelines. Experiments were conducted in vivo on 10 pigs (6 females, 4 males; 40.4 ± 3.1 kg). Animal care and surgical procedures have previously been described in detail [26]. In brief, the pigs were acclimatized for a day and fasted overnight. Following anesthesia, a midline laparotomy was performed to expose the stomach and small intestine. At the conclusion of the studies, pigs were euthanized with a bolus injection of pentobarbital at a dosage of 150 mg/kg while still under anesthesia.
2.3.2. Experimental Setup
A 64‐channel flexible surface‐contact electrode array with 5 mm inter‐electrode spacing (see Figure 3a) was used to enable simultaneous pacing and response mapping of slow wave activity [25]. Of the 64 channels, 57 channels had a diameter of 0.3 mm designed for recording, and the remaining 7 channels had a diameter of 3 mm designed for pacing [25]. In the stomach, two electrode arrays were placed on the anterior serosal surface, with pacing applied at the mid‐corpus (Figure 3b). In the small intestine, a proximal jejunal loop (~20 cm) was exteriorized, and electrodes were placed on the top and bottom serosal surfaces, with pacing applied approximately 10 cm distal to the ligament of Treitz (Figure 3c). This configuration comprised a total of 128 electrodes across both regions, and the entire setup was covered in plastic film to minimize drying and cooling, with electrodes placed using minimal tissue handling.
FIGURE 3.

Placement of surface contact electrode arrays for sensing and pacing. (a) Surface contact electrode array with 64 channels designed for simultaneous pacing and high‐resolution mapping of electrical signals. (b) Two 64‐channel surface contact electrodes were positioned on the anterior side of the stomach. (c) Two 64‐channel surface contact electrodes were placed on opposing surfaces of the small intestine.
Data was acquired using a signal acquisition system (ActiveTwo system, BioSemi, Amsterdam, Netherlands) at 512 Hz, with signals streamed to the closed‐loop pacing software for slow wave analysis. Pacing was applied using a DS8000 stimulator (World Precision Instruments, Sarasota, FL, USA), and controlled using an Arduino (Arduino UNO R3) and the closed‐loop pacing software. Pacing was delivered at 1.1 × intrinsic slow wave frequency using either a 100 ms or 400 ms pulse‐width, across a range of pulse‐amplitudes tailored to each organ [17, 28]. For the small intestine, pulse‐amplitudes of 4–8 mA were applied, while in the stomach, 3–8 mA were used [17, 28].
2.3.3. Validation With High‐Resolution Mapping
Analyses were performed on a per‐experiment basis, where each experiment comprised an independent 120 s recording session, and each pig contributed 2–3 experiments. First, pacing artifacts were removed using the approach described in Section 2.1, which applies a Hampel filter for detection, while artifact reconstruction was performed using an established autoregressive model [23]. Next, activation times (AT) were automatically detected and grouped into individual wavefronts using custom software [29], followed by manual review. Isochronal AT maps were then generated to visualize propagation patterns [29]. Pacing studies were classified as entrained or non‐entrained, where entrainment was confirmed by detecting radial slow wave propagation originating near the pacing electrodes. Finally, the closed‐loop system was quantitatively evaluated by correlating the experimental log files with the slow wave propagation and entrainment outcomes determined by the isochronal AT maps.
2.4. System Evaluation
2.4.1. Performance Metrics
System performance was evaluated based on pulse delivery, slow wave period, and the ability to distinguish entrained from non‐entrained activity. Accuracy was assessed separately for the stomach and small intestine, focusing on (i) slow wave period detection and (ii) entrainment detection. System recorded essential parameters such as pulse delivery timestamps, pacing parameters (e.g., pulse‐amplitude, pulse‐width, etc.), as well as key outputs including computed slow wave periods and entrainment state in a log file. These outputs were validated against measurements obtained using custom software [29].
For slow wave period detection, periods calculated and stored in the log files were compared with those derived from custom software, which automatically identified AT points and computed the intervals between consecutive activations. For entrainment detection, the entrained or non‐entrained states recorded in the log files were compared against AT maps generated by the custom software; entrainment was defined by the presence of a consistent propagation pattern originating from the pacing site.
Key performance metrics included accuracy, precision, recall, and F‐score, and they were calculated using Equations (1), (2), (3), (4).
| (1) |
where TP is true positives, TN is true negatives, FP is false positives, and FN is false negatives.
| (2) |
| (3) |
| (4) |
2.4.2. Pacing Efficiency
To quantify closed‐loop pacing efficiency, pulses delivered in the closed‐loop system were compared with theoretically estimated pulses from an open‐loop system. Open‐loop pacing follows a fixed periodic delivery from the start of the experiment until its completion. The total pulses saved during closed‐loop pacing were computed using Equations (5), (6), (7).
The total number of pulses that would be delivered under an equivalent open‐loop pacing strategy was estimated as:
| (5) |
where the No. of Paced Windows denotes the total number of windows where pacing was triggered based on the logged data. No. of Pulses is the total number of pacing pulses applied in each pacing window.
The total number of pulses applied during open‐loop pacing is given by:
| (6) |
where the Duration of Experiment is the total experiment time, and Pacing Period refers to the interval between pulses.
The estimated percentage reduction of pulses applied compared with open‐loop pacing was calculated using Equation (7):
| (7) |
where Pulses Saved is the difference between pulses applied during open‐loop (Equation 6) and closed‐loop pacing (Equation 5).
2.5. Statistical Analysis
All statistical analyses were performed using MATLAB 2023b (MathWorks, Natick, MA, USA), and data are presented as mean ± standard deviation. The normality of the data was assessed using the Shapiro–Wilk test. For normally distributed data, a two‐sample t‐test was conducted to compare groups, while the Wilcoxon rank‐sum test was used for non‐normally distributed data. Confidence intervals (CIs) are reported where appropriate. p < 0.05 was considered statistically significant throughout the analysis. Statistical analyses were conducted to assess the efficiency of closed‐loop pacing compared to open‐loop pacing.
3. Results
3.1. Benchtop Testing
A series of 11 benchtop validation experiments (n = 4 for slow wave detection, n = 7 for entrainment detection) were conducted to assess slow wave and entrainment detection. Evaluation of slow wave detection determined the capability of the system to accurately detect synthetic slow waves and their period, while the entrainment assessments evaluated if entrained synthetic slow wave events during pacing were accurately captured.
The applied synthetic slow wave period was 15.6 ± 2.6 s, while the detected period was 15.5 ± 2.6 s. This resulted in an average error of −0.1 ± 0.4 s. The system achieved a 71% accuracy rate in identifying entrained events, calculated using Equation (1).
3.2. In Vivo Validation
In vivo gastric and small intestinal experiments were conducted to evaluate the ability of the closed‐loop pacing system to dynamically deliver pacing only when required. The study focused on two key functions of the system: detecting slow wave events and determining whether pacing successfully entrained the underlying activity. System performance was assessed by examining representative examples of pacing‐induced entrainment and by quantifying detection and entrainment metrics across both organs.
The gastric closed‐loop pacing system initiated pacing whenever the detected slow wave period deviated from the normal physiological range of 15–25 s. Figure 4 illustrates a representative case of entrained gastric slow wave activity. Slow waves propagated in the antegrade direction with a tachygastric period prior to pacing (Figure 4a,b). Subsequently, slow wave activity was spatiotemporally entrained in response to pacing with activity originating from the pacing site (Figure 4c,d).
FIGURE 4.

Gastric slow wave response to closed‐loop pacing. (a) Baseline signal traces from six electrodes over four waves show intrinsic antegrade slow wave propagation, and (b) the corresponding activation time map visualizes this pattern. (c) During pacing, the activity became entrained with waves originating near the pacing site (yellow star), with green arrows showing propagation direction and blue lines marking pacing times, and (d) the corresponding activation time map illustrates the pacemaker‐driven propagation with pacing electrodes indicated by positive and negative symbols. The red indicates the earliest activation, and blue indicates the latest activation times in the activation time maps with white arrows indicating the direction of propagation. The electrodes shown in (a) and (c) are arranged in an evenly spaced linear array, corresponding to the numbered positions (from 1 to 6) indicated on the activation time maps in (b) and (d).
The small intestine closed‐loop pacing system initiated pacing whenever the detected slow wave period deviated from the normal physiological range of 3–5 s. Figure 5 illustrates a representative case of entrained intestinal slow wave activity. Slow waves propagated in the antegrade direction with a slow wave period of 2.8 s prior to pacing (Figure 5a,b). Subsequently, slow wave activity was spatiotemporally entrained in response to pacing with slow wave activity originating from the pacing site and propagating radially outwards (Figure 5c,d). The slow wave period was modulated to 3 s (same as the paced period), indicating effective temporal slow wave entrainment.
FIGURE 5.

Small intestine slow wave response to closed‐loop pacing. (a) Baseline signal traces from six electrodes over six consecutive waves show intrinsic antegrade slow wave propagation, and (b) the corresponding activation time map visualizes this pattern. (c) During pacing, the activity became entrained with waves originating near the pacing site (yellow star), with green arrows showing propagation direction and blue lines marking pacing times, and (d) the corresponding activation time map illustrates the pacemaker‐driven propagation with pacing electrodes indicated by positive and negative symbols. The red indicates the earliest activation, and blue indicates the latest activation times in the activation time maps with white arrows indicating the direction of propagation. The electrodes shown in (a) and (c) are arranged in an evenly spaced linear array, corresponding to the numbered positions indicated on the activation time maps in (b) and (d).
3.3. Performance Metrics
Data were analyzed separately for slow wave and entrainment detection. Figure 6 presents the confusion matrices for each detection task and organ, from which the performance metrics shown in Figure 7 were calculated. Figure 7 summarizes the performance of the closed‐loop system for detecting gastric and small intestinal slow waves and entrainment.
FIGURE 6.

Confusion matrices summarizing the performance of the closed‐loop algorithm for slow wave detection in the (a) stomach and (b) small intestine, and for entrainment detection in the (c) stomach and (d) small intestine.
FIGURE 7.

Performance metrics including precision, recall, F‐score, and accuracy under both (a) slow wave detection and (b) entrainment detection derived from confusion matrices in Figure 6. Overall, the system demonstrated similar performances for both gastric and small intestinal recordings for slow wave detection and entrainment detection. Error bars represent 95% confidence intervals.
A FN in the detection phase could potentially lead to excessive pacing and unnecessary energy expenditure, while an FP in the detection phase could potentially lead to a lost opportunity to pace and correct a disordered rhythm. A FN in the entrainment detection phase would result in excessive pacing and energy expenditure, while an FP would result in a lost opportunity to pace and correct a disordered rhythm.
3.3.1. Detection of Slow Waves
The system showed a precision of 86% (CI = 49%–97%), recall of 67% (CI = 35%–88%), an F‐score of 74% (CI = 51%–90%), and an accuracy of 78% (CI = 55%–91%) in detecting slow wave events of the stomach. The system also demonstrated a precision of 75% (CI = 41%–93%), recall of 75% (CI = 41%–93%), an F‐score of 75% (CI = 51%–90%), and an accuracy of 78% (CI = 55%–91%) in detecting small intestine slow waves.
3.3.2. Detection of Entrainment
The entrainment of the gastric slow waves in response to pacing was detected with a precision of 86% (CI = 49%–98%) and a recall of 67% (CI = 35%–88%), with an F‐score of 74% (CI = 51%–90%) and an accuracy of 73% (CI = 48%–89%). In contrast, the system achieved a precision of 86% (CI = 49%–98%) but its recall decreased to 60% (CI = 31%–83%), resulting in an F‐score of 71% (CI = 45%–88%) and an accuracy of 67% (CI = 42%–85%) for small intestine slow waves.
3.4. Efficiency of Closed‐Loop Pacing
The closed‐loop pacing system was evaluated against an open‐loop approach by comparing the number of pulses delivered over the same duration (Figure 8). In the stomach, closed‐loop pacing resulted in a 60.1% ± 16.8% reduction over 6 experiments. Similarly, in the small intestine, closed‐loop pacing resulted in a 60.6% ± 7.7% reduction over 6 experiments. Overall, these findings demonstrate a substantial improvement in pacing efficiency with closed‐loop control.
FIGURE 8.

Comparison of pulses saved between closed‐loop and open‐loop pacing (n = 6; 3 females, 3 males). Closed‐loop pacing resulted in a 60.1% ± 16.8% and 60.6% ± 7.7% reduction in the number of pulses delivered in the stomach and small intestine, respectively.
4. Discussion
A novel closed‐loop pacing system for the GI tract was developed and validated, addressing key limitations associated with traditional open‐loop pacing. The system integrated an effective feedback mechanism that dynamically adjusted the application of pacing pulses based on intrinsic slow wave responses, thereby improving the effectiveness and efficiency of GI pacing. Previous work has relied on computational simulations and synthetic data [19], whereas this study presents the first experimental validation of closed‐loop GI pacing in an acute in vivo setting.
The benchtop experiments demonstrated high fidelity in slow wave period detection, with a negligible mean error of −0.1 ± 0.3 s relative to applied synthetic waveforms. This level of temporal accuracy is critical, as precise timing underpins effective closed‐loop decision‐making. The system also showed reliable entrainment detection in controlled conditions, achieving a 71% accuracy rate. These findings provide strong foundational evidence that the sensing and classification components are robust and well‐suited for transition into physiological environments.
The in vivo results demonstrated that the system effectively detects and responds to dysrhythmic activity in both the stomach and small intestine. It reliably distinguished entrained from non‐entrained events and delivered pacing only when slow wave periods moved outside normal ranges. For slow wave detection and classification (i.e., identifying slow waves and classifying them as normal or abnormal), precision ranged from 75% to 86% with F‐scores of 74% to 75%. For entrainment detection (i.e., assessing pacing delivery in response to abnormal rhythm), precision was 86% with F‐scores of 71%–74%. Although recall was moderate, the system consistently identified true events despite the variability of GI activity, demonstrating robust performance across regions.
The closed‐loop system reduced the number of pacing pulses delivered by 60% compared to an equivalent open‐loop approach, enabling a substantial reduction in delivered pulses. Reduced pulse delivery may have broader implications for implantable pacing systems, including the potential to improve the battery life of pacemakers, reduce electrode usage, and minimize tissue exposure from pacing [30, 31]. This reduction will promote and enable safer long‐term application of pacing methods [18].
Open‐loop pacing approaches rely on predefined stimulation protocols without physiological feedback mechanisms [25, 32], and most current GI stimulation strategies similarly remain open‐loop. While closed‐loop control may inform existing clinical gastric stimulation systems, such as the high‐frequency stimulation paradigm employed by Enterra Medical (St. Louis Park, MN, USA) [33, 34], the mechanistic differences between high‐frequency stimulation and the slow wave pacing approach investigated here should be carefully considered. The present study demonstrates the technical feasibility of integrating physiological sensing with adaptive pacing, establishing a proof‐of‐concept closed‐loop framework for GI pacing that is analogous to feedback‐based cardiac pacing strategies [35, 36].
Despite the promising outcomes, a key limitation of the system was its reliance on a single sensing electrode. This reduced spatial resolution and likely contributed to lower detection accuracy, particularly when the selected channel had poor signal quality, increasing the risk of misclassification and unnecessary pacing. The moderate recall indicates that some events were missed by the algorithm. Consequently, false negatives may result in unnecessary pacing and increased energy expenditure, whereas false positives may lead to missed opportunities for corrective pacing. In the present study, false negatives occurred more frequently than false positives, indicating that the algorithm was more likely to trigger unnecessary pacing than to miss opportunities for corrective pacing. Incorporating multiple electrodes in future designs would improve the overall robustness [37, 38]. Additional refinements, such as using more established slow wave detection methods (e.g., maximum negative gradient [39, 40]) or integrating machine learning approaches could further enhance performance. Chronic studies will also provide critical insight into the long‐term efficacy of the system, biocompatibility, and tissue responses [25, 41]. Complementary computational modeling will help optimize closed‐loop strategies, reduce animal use, and enable systematic exploration of diverse physiological and dysrhythmic scenarios [42, 43, 44].
The miniaturization of the closed‐loop system into implantable devices marks a promising step toward clinical translation. Integration of closed‐loop control into emerging technologies such as smart pills and ingestible electronics offers minimally invasive routes for monitoring and modulating GI activity [45, 46]. These devices, capable of interfacing directly with the mucosa or lumen, could reduce procedural invasiveness while enabling targeted sensing and pacing [47, 48]. Ultimately, the closed‐loop system developed here presents a crucial step toward the clinical realization of adaptive GI pacing to improve bioelectrical activity.
The developed closed‐loop pacing system autonomously detected GI slow wave activity and delivered adaptive pacing in response to predefined electrophysiological states. This automated approach enabled effective detection of gastric and small intestinal slow wave dysrhythmias and, in a closed‐loop manner, paced when abnormal or unentrained and ceased upon restoration of entrainment. Furthermore, the system also delivered fewer pulses compared to an equivalent open‐loop strategy suggesting its potential to reduce pacing burden. These findings demonstrate the technical feasibility of closed‐loop GI pacing and establish a proof‐of‐concept framework for future investigations of chronic performance, safety, therapeutic benefit, and the development of more personalized GI pacing therapies.
Author Contributions
Chaveeka Weerakoon: methodology, software writing – original draft, writing – review and editing. Leo K. Cheng: conceptualization, methodology, formal analysis, writing – review and editing, supervision. Peng Du: conceptualization, methodology, writing – review and editing, supervision. Niranchan Paskaranandavadivel: conceptualization, methodology, writing – review and editing, supervision. Nipuni D. Nagahawatte: conceptualization, methodology, formal analysis, writing – review and editing, supervision. All authors have read and agreed to the published version of the manuscript.
Funding
This work was supported by the Marsden Fund, Auckland Bioengineering Institute, Auckland Medical Research Foundation, European Research Council (ERC‐2024‐COG 101170592), Health Research Council of New Zealand, and Riddet Institute Centre of Research Excellence.
Conflicts of Interest
No commercial support was received for any material presented in this publication. L.K.C., P.D., and N.P. hold intellectual property and/or patent applications on gastrointestinal electrophysiology. L.K.C., P.D., and N.P. are shareholders of FlexiMap Ltd. None of the other authors has any conflicts of interest.
Acknowledgments
As a partner of the Openness Agreement on Animal Research and Teaching in New Zealand, we acknowledge and appreciate the pigs that made this research possible. The authors thank Linley Nisbet for her technical assistance. Open access publishing facilitated by The University of Auckland, as part of the Wiley ‐ The University of Auckland agreement via the Council of Australasian University Librarians.
Data Availability Statement
The data that support the findings of this study are available from the corresponding author upon reasonable request.
References
- 1. Cheng L. K., Du P., and O'Grady G., “Mapping and Modeling Gastrointestinal Bioelectricity: From Engineering Bench to Bedside,” Physiology (Bethesda) 28 (2013): 310–317. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 2. Dickens E. J., Hirst G. D. S., and Tomita T., “Identification of Rhythmically Active Cells in Guinea‐Pig Stomach,” Journal of Physiology 514, no. pt 2 (1999): 515–531. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 3. Hibberd T. and Spencer N. J., “Extracellular Recordings From the Stomach Faithfully Record Slow‐Wave Activity Detected Using Intracellular Microelectrodes,” American Journal of Physiology. Gastrointestinal and Liver Physiology 327 (2024): G483–G484. [DOI] [PubMed] [Google Scholar]
- 4. O'Grady G., Angeli T. R., Du P., et al., “Abnormal Initiation and Conduction of Slow‐Wave Activity in Gastroparesis, Defined by High‐Resolution Electrical Mapping,” Gastroenterology 143 (2012): 589–598.e3. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 5. Gharibans A. A., Coleman T. P., Mousa H., and Kunkel D. C., “Spatial Patterns From High‐Resolution Electrogastrography Correlate With Severity of Symptoms in Patients With Functional Dyspepsia and Gastroparesis,” Clinical Gastroenterology and Hepatology 17 (2019): 2668–2677. [DOI] [PubMed] [Google Scholar]
- 6. Cheng L. K., Nagahawatte N. D., Avci R., Du P., Liu Z., and Paskaranandavadivel N., “Strategies to Refine Gastric Stimulation and Pacing Protocols: Experimental and Modeling Approaches,” Frontiers in Neuroscience 15 (2021): 645472. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 7. Chen J. D. Z., Qian L., Ouyang H., and Yin J., “Gastric Electrical Stimulation With Short Pulses Reduces Vomiting but Not Dysrhythmias in Dogs,” Gastroenterology 124 (2003): 401–409. [DOI] [PubMed] [Google Scholar]
- 8. Ducrotte P., Coffin B., Bonaz B., et al., “Gastric Electrical Stimulation Reduces Refractory Vomiting in a Randomized Crossover Trial,” Gastroenterology 158 (2020): 506–514.e2. [DOI] [PubMed] [Google Scholar]
- 9. Saleem S., Aziz M., Khan A. A., et al., “Gastric Electrical Stimulation for the Treatment of Gastroparesis or Gastroparesis‐Like Symptoms: A Systemic Review and Meta‐Analysis,” Neuromodulation: Technology at the Neural Interface 27 (2024): 221–228. [DOI] [PubMed] [Google Scholar]
- 10. Zhang J. and Chen J. D. Z., “Pacing the Gut in Motility Disorders,” Current Treatment Options in Gastroenterology 9 (2006): 351–360. [DOI] [PubMed] [Google Scholar]
- 11. Nagahawatte N. D., Cheng L. K., Avci R., Angeli‐Gordon T. R., and Paskaranandavadivel N., “Systematic Review of Small Intestine Pacing Parameters for Modulation of Gut Function,” Neurogastroenterology and Motility 35 (2023): e14473. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 12. McCallum R. W., Chen J. D., Lin Z., Schirmer B. D., Williams R. D., and Ross R. A., “Gastric Pacing Improves Emptying and Symptoms in Patients With Gastroparesis,” Gastroenterology 114 (1998): 456–461. [DOI] [PubMed] [Google Scholar]
- 13. Lin Z., Sarosiek I., Forster J., Ross R. A., Chen J. D. Z., and McCallum R. W., “Two‐Channel Gastric Pacing in Patients With Diabetic Gastroparesis,” Neurogastroenterology and Motility 23 (2011): 912. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 14. Gladen H. E. and Kelly K. A., “Enhancing Absorption in the Canine Short Bowel Syndrome by Intesitnal Pacing,” Surgery 88 (1980): 281–286. [PubMed] [Google Scholar]
- 15. Hocking M. P., Vogel S. B., and Sninsky C. A., “Human Gastric Myoelectric Activity and Gastric Emptying Following Gastric Surgery and With Pacing,” Gastroenterology 103 (1992): 1811–1816. [DOI] [PubMed] [Google Scholar]
- 16. Bilgutay A. M., Wingrove R., Griffen W. O., Bonnabeau R. C., and Lillehei W. C., “Gastro‐Intestinal Pacing,” Annals of Surgery 158 (1963): 338–348. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 17. Nagahawatte N. D., Avci R., Paskaranandavadivel N., and Cheng L. K., “Optimization of Pacing Parameters to Entrain Slow Wave Activity in the Pig Jejunum,” Scientific Reports 14 (2024): 6038, 10.1038/s41598-024-56256-2. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 18. Sambelashvili A. T., Nikolski V. P., and Efimov I. R., “Virtual Electrode Theory Explains Pacing Threshold Increase Caused by Cardiac Tissue Damage,” American Journal of Physiology. Heart and Circulatory Physiology 286 (2004): H2183–H2194, 10.1152/ajpheart.00637.2003. [DOI] [PubMed] [Google Scholar]
- 19. Wang L., Malik A., Roop P. S., Cheng L. K., Paskaranandavadivel N., and Ai W., “A Novel Approach for Model‐Based Design of Gastric Pacemakers,” Computers in Biology and Medicine 116 (2020): 103576, 10.1016/j.compbiomed.2019.103576. [DOI] [PubMed] [Google Scholar]
- 20. Gargaro A., Biancalana G., Botto G. L., and Brignole M., “The Clinical Role of Closed Loop Stimulation Pacemakers in the Treatment of Patients With Sinus Node Dysfunction: A Review,” Future Cardiology 21 (2025): 567–578, 10.1080/14796678.2025.2507464. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 21. Rattanawong P., Riangwiwat T., Chongsathidkiet P., et al., “Closed‐Looped Stimulation Cardiac Pacing for Recurrent Vasovagal Syncope: A Systematic Review and Meta‐Analysis,” Journal of Arrhythmia 34 (2018): 556–564, 10.1002/joa3.12102. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 22. Proff J., Merkely B., Papp R., et al., “Closed Loop Stimulation in Patients With Chronic Heart Failure and Severe Chronotropic Incompetence: Responders Versus Non‐Responders,” International Journal of Cardiology 370 (2023): 222–228. [DOI] [PubMed] [Google Scholar]
- 23. Nagahawatte N. D., Paskaranandavadivel N., Bear L. R., Avci R., and Cheng L. K., “A Novel Framework for the Removal of Pacing Artifacts From Bio‐Electrical Recordings,” Computers in Biology and Medicine 155 (2023): 106673, 10.1016/j.compbiomed.2023.106673. [DOI] [PubMed] [Google Scholar]
- 24. Qian X., Chen Y., Feng Y., Ma B., Hao H., and Li L., “A Method for Removal of Deep Brain Stimulation Artifact From Local Field Potentials,” IEEE Transactions on Neural Systems and Rehabilitation Engineering 25 (2017): 2217–2226. [DOI] [PubMed] [Google Scholar]
- 25. Nagahawatte N. D., Avci R., Paskaranandavadivel N., Angeli‐Gordon T. R., and Cheng L. K., “Spatial Response of Jejunal Pacing Defined by a Novel High‐Resolution Multielectrode Array,” American Journal of Physiology. Gastrointestinal and Liver Physiology 324 (2023): G329–G340, 10.1152/ajpgi.00258.2022. [DOI] [PubMed] [Google Scholar]
- 26. Egbuji J. U., O'grady G., Du P., et al., “Origin, Propagation and Regional Characteristics of Porcine Gastric Slow Wave Activity Determined by High‐Resolution Mapping,” Neurogastroenterology and Motility 22 (2010): e292–e300, 10.1111/j.1365-2982.2010.01538.x. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 27. Angeli T. R., O'Grady G., Paskaranandavadivel N., et al., “Experimental and Automated Analysis Techniques for High‐Resolution Electrical Mapping of Small Intestine Slow Wave Activity,” Journal of Neurogastroenterology and Motility 19 (2013): 179–191. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 28. Alighaleh S., Cheng L. K., Angeli‐Gordon T. R., O'Grady G., and Paskaranandavadivel N., “Optimization of Gastric Pacing Parameters Using High‐Resolution Mapping,” IEEE Transactions on Biomedical Engineering 70 (2023): 2964–2971. [DOI] [PubMed] [Google Scholar]
- 29. Yassi R., O'Grady G., Paskaranandavadivel N., et al., “The Gastrointestinal Electrical Mapping Suite (GEMS): Software for Analyzing and Visualizing High‐Resolution (Multi‐Electrode) Recordings in Spatiotemporal Detail,” BMC Gastroenterology 12 (2012): 60, 10.1186/1471-230X-12-60. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 30. Horlbeck F. W., Mellert F., Kreuz J., Nickenig G., and Schwab J. O., “Real‐World Data on the Lifespan of Implantable Cardioverter‐Defibrillators Depending on Manufacturers and the Amount of Ventricular Pacing,” Journal of Cardiovascular Electrophysiology 23 (2012): 1336–1342. [DOI] [PubMed] [Google Scholar]
- 31. Botto G. L., Ricci R. P., Bénézet J. M., et al., “Managed Ventricular Pacing Compared With Conventional Dual‐Chamber Pacing for Elective Replacement in Chronically Paced Patients: Results of the Prefer for Elective Replacement Managed Ventricular Pacing Randomized Study,” Heart Rhythm 11 (2014): 992–1000, 10.1016/j.hrthm.2014.01.011. [DOI] [PubMed] [Google Scholar]
- 32. Layzell T. and Collin J., “Retrograde Electrical Pacing of the Small Intestine—A New Treatment for the Short Bowel Syndrome?,” British Journal of Surgery 68 (1981): 711–713, 10.1002/bjs.1800681012. [DOI] [PubMed] [Google Scholar]
- 33. McCallum R. W., Sarosiek I., Parkman H. P., et al., “Gastric Electrical Stimulation With Enterra Therapy Improves Symptoms of Idiopathic Gastroparesis,” Neurogastroenterology and Motility 25 (2013): 815‐e636, 10.1111/nmo.12185. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 34. Yin J., Abell T. D., McCallum R. W., and Chen J. D. Z., “Gastric Neuromodulation With Enterra System for Nausea and Vomiting in Patients With Gastroparesis,” Neuromodulation: Technology at the Neural Interface 15 (2012): 224–231, 10.1111/j.1525-1403.2012.00429.x. [DOI] [PubMed] [Google Scholar]
- 35. Świerżyńska E., Oręziak A., Główczyńska R., et al., “Rate‐Responsive Cardiac Pacing: Technological Solutions and Their Applications,” Sensors 23 (2023): 23. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 36. Ai W., Patel N. D., Roop P. S., Malik A., and Trew M. L., “Cardiac Electrical Modeling for Closed‐Loop Validation of Implantable Devices,” IEEE Transactions on Biomedical Engineering 67 (2020): 536–544. [DOI] [PubMed] [Google Scholar]
- 37. Lammers W. J. E. P., Al‐Kais A., Singh S., Arafat K., and El‐Sharkawy T. Y., “Multielectrode Mapping of Slow‐Wave Activity in the Isolated Rabbit Duodenum,” Journal of Applied Physiology 74 (1993): 1454–1461, 10.1152/jappl.1993.74.3.1454. [DOI] [PubMed] [Google Scholar]
- 38. Schiemer J. F., Heimann A., Somerlik‐Fuchs K. H., et al., “Five‐Fold Gastrointestinal Electrical Stimulation With Electromyography‐Based Activity Analysis: Towards Multilocular Theranostic Intestinal Implants,” Journal of Neurogastroenterology and Motility 25 (2019): 461–470. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 39. Erickson J. C., O'Grady G., Du P., et al., “Falling‐Edge, Variable Threshold (FEVT) Method for the Automated Detection of Gastric Slow Wave Events in High‐Resolution Serosal Electrode Recordings,” Annals of Biomedical Engineering 38 (2010): 1511–1529, 10.1007/s10439-009-9870-3. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 40. Bull S. H., O'Grady G., Du P., and Cheng L. K., “A System and Method for Online High‐Resolution Mapping of Gastric Slow‐Wave Activity,” IEEE Transactions on Biomedical Engineering 61 (2014): 2679–2687. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 41. Ver Donck L., Lammers W. J. E. P., Moreaux B., et al., “Mapping Slow Waves and Spikes in Chronically Instrumented Conscious Dogs: Implantation Techniques and Recordings,” Medical & Biological Engineering & Computing 44 (2006): 170–178, 10.1007/s11517-005-0018-9. [DOI] [PubMed] [Google Scholar]
- 42. Brandstaeter S., Gizzi A., Fuchs S. L., Gebauer A. M., Aydin R. C., and Cyron C. J., “Computational Model of Gastric Motility With Active‐Strain Electromechanics,” ZAMM ‐ Journal of Applied Mathematics and Mechanics/Zeitschrift für Angewandte Mathematik und Mechanik 98 (2018): 2177–2197, 10.1002/zamm.201800166. [DOI] [Google Scholar]
- 43. Gizzi A., Cherubini C., Migliori S., Alloni R., Portuesi R., and Filippi S., “On the Electrical Intestine Turbulence Induced by Temperature Changes,” Physical Biology 7 (2010): 016011, 10.1088/1478-3975/7/1/016011. [DOI] [PubMed] [Google Scholar]
- 44. Patel B., Gizzi A., Hashemi J., Awakeem Y., Gregersen H., and Kassab G., “Biomechanical Constitutive Modeling of the Gastrointestinal Tissues: A Systematic Review,” Materials & Design 217 (2022): 110576. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 45. Rehan M., Al‐Bahadly I., Thomas D. G., Young W., Cheng L. K., and Avci E., “Smart Capsules for Sensing and Sampling the Gut: Status, Challenges and Prospects,” Gut 73 (2024): 186–202. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 46. Mandsberg N. K., Christfort J. F., Kamguyan K., Boisen A., and Srivastava S. K., “Orally Ingestible Medical Devices for Gut Engineering,” Advanced Drug Delivery Reviews 165–166 (2020): 142–154. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 47. Yao S. K., Ke M. Y., Wang Z. F., Xu D. B., and Zhang Y. L., “Visceral Response to Acute Retrograde Gastric Electrical Stimulation in Healthy Human,” World Journal of Gastroenterology 11 (2005): 4541–4546. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 48. Yao S., Ke M., Wang Z., Xu D., Zhang Y., and Chen J. D. Z., “Retrograde Gastric Pacing Reduces Food Intake and Delays Gastric Emptying in Humans: A Potential Therapy for Obesity?,” Digestive Diseases and Sciences 50 (2005): 1569–1575. [DOI] [PubMed] [Google Scholar]
Associated Data
This section collects any data citations, data availability statements, or supplementary materials included in this article.
Data Availability Statement
The data that support the findings of this study are available from the corresponding author upon reasonable request.
