1 Introduction

Wireless capsule endoscopy (WCE) has been widely used in clinical practices since its emergence in the early 2000s [1, 2]. WCE is particularly an appealing option in contrast to conventional endoscopy, as it offers painless endoscopic imaging of the gastrointestinal tract (GI). While the pre-cleanse of the gastrointestinal tract is required via dietary means, similar to a colonoscopy procedure, to provide an optimal environment for WCE, the need for sedatives is eliminated [3]. WCE is further capable of imaging the entire GI tract, which is difficult to accomplish with conventional colonoscopy or endoscopy, making this procedure especially appealing to detect small bowel diseases [4].

While commercial imaging capsules (PillCam™, EndoCapsule™, MiroCam™) are already being used in clinics as imaging tools, numerous literary studies have focused on expanding the functionality of WCE [5]. For example, capsules have been equipped with navigation and/or locomotion hardware such as magnet–solenoid systems [6,7,8], robotic arms [9,10,11], fish-like motion [12,13,14], spiral-type mechanism [15,16,17], and inchworm-like mechanism [18,19,20] in an effort to provide additional motion control to the operator. Also, methods to apply treatment directly into the GI tract by WCE have been explored in some studies by developing magnetic [21,22,23,24] and micromotor-based [25] drug delivery mechanisms. To increase the diagnostic capabilities of WCE, tactile sensing methods were added onto capsules [26, 27] to read the physical properties of the GI tract to detect diseases. Biopsy has been another crucial trait to study diseased tissue pathology, which has been explored in multiple studies, such as releasing and recollecting microgrippers as in [28] or using a rotational tissue cutting razor with a torsion spring as in [29,30,31].

A typical WCE has 26–28 mm length and 10–12 mm diameter in pill shape to make the swallowing process comfortable for the patient. Acknowledging the potential of alternative uses of capsule endoscopes, several studies [32, 33] have envisioned a Swiss knife-like capsule to cover as many tasks as possible. While such a fully equipped robotic capsule is desirable, there are many hurdles in being able to miniaturize such a device into a typical capsule endoscope volume. Due to dimensional restrictions, it has not been possible to apply complex or multiple functions on WCE, which have been developed in various studies that are presented above. To overcome the size limitation and increase the number of available toolsets and functionalities, multiple capsules can be utilized one after the other with a contactless connection, as illustrated in Fig. 1a. Numerous research groups have proposed using modular capsule strategies to increase the final overall function of the capsule. In such a scenario, the diagnostic and therapeutic needs of the patient will determine which capsule robot(s) to be swallowed as an additional functional module. Several approaches have been sought in the quest of assembly or synchronization of capsules within the body. Among these approaches, Nagy et al. [34] proposed assembly with magnetic connection allowing rotation between the capsules as the degree of freedom, yet the connection between capsules cannot be restored upon a misaligned connection. Another valuable approach involved a modular capsule robot with controllable separation and combination features based on spiral rib propulsion [35]. An inter-capsule connection method utilizing a combination of permanent and soft magnets was presented as well [36]. Through changing the direction of the applied external magnetic field, the magnetization direction of the soft magnet alters, resulting in either an attractive or repulsive force. In our earlier study [37], we demonstrated distance control between multiple capsules via permanent cylindrical magnets placed on capsule domes, to achieve preset distance in-between consecutive capsules. While the use of magnets enabled distance control without power consumption, our demonstration was rather limited to straight conduit phantoms in which the capsules were tightly fit.

Fig. 1
figure 1

a Conceptualization of the multi-capsule endoscopy scheme, showing three capsules dedicated to imaging, biopsy, and drug delivery; b designs of the capsules along with the dimensional labels; c closed loop control scheme of our model

In this study, in an effort to achieve a well-established distance control in challenging environments, we elaborate on the connection between multiple capsules with an active control loop. Our control strategy involves a passive magnet placed on one of the capsules and a current-driven solenoid and Hall effect sensors on the other capsule to control the gap. The proposed study offers advantages in the areas of ease of implementation (hardware simplicity), the lack of need for an external magnetic field, and its realistic implementation on ex vivo bovine tissue.

This paper is organized as follows: “Sect. 2” summarizes the modeling of the control loop, Simulink and COMSOL simulations, 3D CAD modeling, and physical manufacturing. “Sect. 3” gives details of the assembly of the experimental setup, sensor calibration and distance control in plastic, and ex vivo phantoms. Finally, the outcomes of the studies are discussed in “Sect. 4.”

2 Methods

2.1 Modeling and FEM simulation

The general control model is depicted in Fig. 1b, where capsule 2 (C2) follows capsule 1 (C1) with a previously set gap in-between. We employ a neodymium sphere permanent magnet in the C2 and a solenoid coil on the C1 to actively control the force between capsules to achieve and preserve the desired in-between gap. Table 1 tabulates symbols, dimensions, and assumptions (e.g., solenoid windings, diameter) for modeling and experiments. The general control loop is further sketched in Fig. 1c.

Table 1 Parameters, symbols, and set values

The force generated in-between is directly related to the positioning between the sphere magnet and the solenoid. Position feedback can be acquired by Hall effect sensors that are integrated in C1, which read magnetic field magnitude due to a sphere permanent magnet on C2. The use of multiple Hall effect sensors enables differential magnetic field readouts to determine the angle between capsules to achieve control in curvature paths such as the gastrointestinal tract. Since the magnet position in C2 and hall sensor positions in C1 are fixed, we can estimate the positions of two capsules related to each other after an initial calibration.

The theoretical calculation of force between two magnetic dipoles is calculated based on [38, 39] and rearranged for our model as in (15). Here, \({F}_{r}\) and \({F}_{\phi }\) represent forces acting on two axes, and \({m}_{1}\) and \({m}_{2}\) are magnet dipole moments. \(\theta\) is the angle between the magnet dipole moments, \(r\) is the distance between these moments, \(M\) is the magnetization value, \(V\) is the volume of the magnet, and \({B}_{0}\) is the flux density at the magnet tip. To calculate the magnetic field emerging from a solenoid, one can use Ampere’s law to calculate \({B}_{0}\) using (5), where \(N\) is the winding count, \(I\) is the current, \(L\) is the coil length, \(k\) is the relative permeability of the core (relative permeability is unity for an air core solenoid), and \({\mu }_{0}\) is the permeability constant as \(4\pi \times {10}^{-7}\). \(f\) is the dynamic friction force, \(\rho\) is the friction constant, \(g\) is the gravitational acceleration as \(9.8067 {\text{m}}/{{\text{s}}}^{2}\), and \(m\) is the capsule weigth.

$${F}_{x}\left(r, \theta \right)=-\frac{3{\mu }_{0}}{4\pi {r}^{4}}{m}_{1}{m}_{2}{\text{cos}}\left(\theta \right)$$
(1)
$${F}_{y}\left(r, \theta \right)=-\frac{3{\mu }_{0}}{4\pi {r}^{4}}{m}_{1}{m}_{2}{\text{sin}}\left(\theta \right)$$
(2)
$$m=MV$$
(3)
$$M=\frac{2{B}_{0}}{{\mu }_{0}}$$
(4)
$${B}_{0}=\frac{{\text{k}}{\mu }_{0}{\text{NI}}}{L}$$
(5)
$$f=\mathrm{\rho mg}$$
(6)

Using the provided analytical formulation, we developed a Simulink model to simulate the interaction between magnet and coil using (15) to calculate the force in-between capsules to achieve distance control with a PID controller block as given in Fig. 2a. This model calculates the error value as the difference between the desired distance and the actual distance between capsules and feeds this error into a PID controller block to determine a current output to generate the appropriate force between capsules. We note that the provided formulation is most accurate for distances that are longer than the solenoid and magnet dimensions. The five main blocks of the model can be explained as follows:

  • C1 position source: This block generates the motion of the C1 due to the peristalsis forces present in the GI tract. The peristalsis is modeled as a sinusoidal force onto C1 with a length period of ~ 10 cm, where the typical capsule speed in the human bowel as 1 cm/min is established [40]. By using the capsule weight, this block calculates the C1 position by using Newton’s second law with the initial position being 2 mm. Also, a hypothetical force disturbance of 10 times that of the maximum peristalsis force is applied onto C1 (by using step disturbance blocks) to observe the system response against an unexpected force input within the GI tract. In the GI tract, such a disturbance could possibly occur due to the presence of sphincters (circular muscles that regulate flow). Details of this block are given in Fig. 2b.

  • PID controller: An Error signal due to the desired distance and the actual distance is used in this block to determine the current output that generates the appropriate force in-between capsules. We have used the PID block of the Simulink library and determined PID constants with the “PID Tuner” application embedded into this block. The Output of the block is limited to ± 10 mA (solenoid current) for an energy efficient operation.

  • Force calculation: To calculate the net force in-between, this block uses the coil current determined by the PID block, distance, and angle between capsules to calculate the magnetically generated force with (15). Also, the speed of the C2 is used to calculate the static or dynamic friction force depending on the presence of the movement by using the friction coefficient of the typical bowel environment [41] with (6). Then, the net force is calculated by differentiating these two force components and adding the peristalsis force. Inside of this block is given in Fig. 2c. where the Eqs. (15) are used in the .m code of the “Magnetic Force Calc.” block and (6) is used in the .m code of the “Friction Calc.” block.

  • C2 position calculation: Here, we calculate the position of the C2 due to the net force determined by the “Force Calculation” block. Similar to C1, Newton’s second law is used with the initial position of 0 mm.

  • Angle between capsules: To observe the effect of the angle between capsules, a pre-determined curvature path is defined where the capsule angles change due to their distances from the initial positions. Up to 60°of angle between capsules is defined in this path to reach a relatively high angle since the force magnitude directly depends on this value.

Fig. 2
figure 2

a Simulink model of the control loop; b C1 position source block details; c force calculation block details; d 30-s simulation of the loop where an inter-capsule distance of 1 cm is preserved in the presence of peristaltic waves (with a period of 10 s) and a disturbance mimicking the passing of the first capsule through a sphincter

In the Simulink model, the desired distance between the solenoid and the magnet is set at 1 cm, and an initial state of 2 cm is imposed as given in the “C1 Position Source” block. As peristalsis acts upon the capsules, the controlled force establishes a 1 cm distance between capsules in ~ 1 s with tuned PID controller output. Note that the control can achieve millisecond level response times if the input current limit is removed. As the capsules move together, a disturbance force is applied onto C1. The disturbance acts in the same way with the overall motion of the C1; therefore, the speed of the system increases while the control is preserved successfully. Also, the angle between capsules is changing in this timespan up to 60° as given in the “Angle Between Capsule” block without any issues with distance control. We observed a standard deviation of 0.221 mm in the distance between both capsules within the simulated time. Our Simulink model and initial simulations verify the feasibility of actively controlling the inter-capsule distance with power dissipation at the microwatts level.

Before realizing the proposed multi-capsule control scheme, we conducted a COMSOL simulation to inspect the force between capsules with higher accuracy (for inter-capsule distance in the range of millimeters) than the utilized equations. The values given in Table 1 are used in this simulation. In this simulation, we measured the force in-between the coil and the sphere permanent magnet by sweeping the distance from 0 to 10 mm. As expected, the force value decreases exponentially from ~ 0.055 N to ~ 0.002 N with increasing distance.

In an effort to estimate the maximum distance to achieve a connection between capsules, we have calculated the friction force between the capsule and surface with (6) by using typical GI tract friction coefficient values that were measured in literature [41] and the capsule weight given in Table 1. We calculated a ~ 0.012 N force to be overcome by the inter-capsular force, corresponding to ~ 4.2 mm in our simulations. Considering the shell thickness of capsules (0.5–0.7 mm range is used in our models later on), we estimate the maximum controllable distance to be slightly over 3 mm based on the outcome of FEM simulations as given in Fig. 3.

Fig. 3
figure 3

0 to 10 mm force vs. distance sweep plot of the FEM simulation with screenshots for 0, 5, and 10 mm with field lines. The dashed blue line indicates the friction force to be overcome in the typical GI tract and the corresponding distance value

2.2 Hardware

To realize our proposed system, we 3D modeled and printed C1 and C2 with polylactic acid (PLA) material via fused-deposition-modeling (FDM) where Hall effect sensors, solenoid, and sphere magnet are placed. As the Hall effect sensor, we have used the Allegro UGN3503 model and placed 2 sensors onto C1. To implement the solenoid, we wrapped insulated copper wire with a 0.1 mm diameter on C1 with ~ 400 turns. To complete C1, we soldered non-magnetic jumpers onto the solenoid and sensors and placed the cap. Lastly, we inserted the neodymium sphere magnet into the C2 base and fixed its cap. Figure 4 presents both 3D models and assembly steps for C1.

Fig. 4
figure 4

a Core of the C1 where 2 Hall sensors and coil are placed in, b shell of the C1, c cross-section view of C1 assembly, de 3D-printed core with Hall sensors and solenoid coil, and f complete C1 with its shell

To imitate the GI tract, we 3D modeled and printed paths with pre-determined radius of curvature (ROC) values, such as 500, 250, 100, 50, and 25 mm, along with a straight path as shown in Fig. 5a. The diameter of these conduits is chosen as 15 mm, in accordance with typical small bowl dimensions. The tops of the curved conduits were intentionally left open to observe capsule movement with a camera.

Fig. 5
figure 5

a 3D-printed PLA phantoms; b, c, d paving incised bovine bowel into the path with 250 mm ROC to form an ex vivo phantom

The second set of phantoms was formed by paving bovine bowel onto 3D-printed curved conduits. The absence of surrounding muscles in the excised bowel necessitated a sturdy surrounding medium to hold the ex vivo tissue. The preparation steps of the ex vivo tissue are illustrated in Fig. 5b–c.

3 Results

The general plan of our experimental setup is given in Fig. 6a. C1 is placed on a tube phantom and our step motor pulls C1 with a thread. Motor speed is controlled by the Arduino controller as 1 cm/min in accordance with the speed of a peristaltic wave [40]. Two analog read inputs are dedicated to Hall sensor outputs, and an analog voltage output is used to drive the coil. The implemented controller in Arduino code calculates the analog output voltage to be applied to the solenoid. Hall sensor and PID output values are sent to the PC via serial port for plotting and post-processing. Figure 6b–c shows the realized state of the experimental setup.

Fig. 6
figure 6

a Experimental setup plan, bc realized setup

Before implementing the control, an initial calibration was performed through monitoring Hall sensor outputs for different inter-capsule distances at tubes having different ROCs. Figure 7a–b plots the difference and mean of both sensors for all the tested phantoms up to a 10-mm distance. As expected, we observe a larger difference between Hall sensor outputs for curved tubes with low ROC. We set the desired inter-capsule gap as 2 mm to be able to overcome the friction force (in accordance with previously FEM simulation values). Figure 7c provides a plot of the average vs. difference of Hall sensor outputs as a function of ROC for a 2-mm distance between capsules. A linear fit between the average (μS) and difference (ΔS) sensor outputs was found using the below equation:

Fig. 7
figure 7

a Sensor output difference vs. distance, b sensor output average vs. distance, and c average vs. distance behavior measured for each ROC phantom at a 2-mm inter-capsule distance. Error bars represent the standard deviation of 10 measurements

$${\mu }_{S}=343.24+0.9{\Delta }_{S}$$
(7)

Using (7), we calculate our targeted average value to achieve a 2-mm distance, which we utilize to set the coil current in our PID controller. Implementing the relationship between the average and difference of sensor outputs in our controller ensures the set gap, irrespective of the ROC of the path.

Following the calibration routine, we continued testing the control between capsules on all 3D-printed PLA tube phantoms. Note that we utilized pull forces (due to the single-sided output provided by our microcontroller) and were able to establish distance control for the majority of the tubes, except the tube having 50 mm ROC, where we could control the 1 mm gap due to an increase in friction on lower ROC values.

Figure 8a, b, c, and d shows distance vs. time (for 60 s) on each tube with a 15-mm diameter. We have used these fit tubes for our initial experiments to test a more controllable case. Higher variation from the desired distance is observed for the tube having 500 mm ROC, which we attribute to having less constrained movement (low friction) along the tube as opposed to lower ROC values. On the other hand, a variation of 50 mm ROC occurs due to significantly increased friction of the tube surface. Average distances and standard deviation values are observed as 1.9090 ± 0.1733 mm, 1.9331 ± 0.0690 mm, 1.9832 ± 0.0486 mm, and 0.9618 ± 0.1171 mm for ROC values of 500 mm, 250 mm, 100 mm, and 50 mm, respectively.

Fig. 8
figure 8

a A 2-mm control at ROC 500 mm, b 2-mm control at ROC 250 mm, c 2-mm control at ROC 100 mm, d and 1-mm control at 50 mm ROC for 60 s each on plain PLA phantoms

Additionally, we repeated the same experiments on wider PLA phantoms with 25 mm diameter, which is similar to the human small bowel dimensions [42]. Due to their large path diameter, capsules vibrate more freely as they move, thus having more deviation from desired distance compared to 15-mm phantoms, but control is still achievable. We also tried to compare plain and wet surfaces on these phantoms. Figure 9a shows the control comparison between the plain and wet surfaces on the 250 ROC PLA phantom. Due to the damping effect of the water, the control has less deviations with the same PID parameters. Root mean square (RMS) values are 0.3552 mm on the plain phantom and 0.0975 mm on the wet phantom, which indicates that the control on the real GI tract would be smoother than the plain phantoms.

Fig. 9
figure 9

a Control comparison between plain and wet surfaces on PLA phantom with 250 ROC; b a 1-mm distance control at ROC 250 mm on ex vivo phantom (bovine bowel); c, d, e capsule positions; f and close-up view of capsules while traversing together

Next, we performed ex vivo experiments with bovine bowel paved tubes, as shown in Fig. 5c. As the capsules sink into the tissue surface, unlike the phantom experiments, we targeted control for an inter-capsule distance of 1 mm for tubes having a ROC of 250 mm and 500 mm, as in Fig. 8b. Implementing the control scheme, we measured an average and standard deviation of 0.9665 mm ± 0.2759 mm and 0.9666 ± 0.1659 mm for ROC values of 250 and 500 mm, showcasing a relatively higher standard deviation with respect to plastic phantom experiments. Figure 9c, d, e, f illustrate snapshots of the movement of the capsules along the bovine bowel.

The average and standard deviation of power dissipations for the implementation of the proposed inter-capsule distance control were measured as 6.4 ± 3 mW for all 3D-printed phantoms having different ROC, and 11.2 mW and 5.5 mW on 250 mm and 500 mm ROC on bovine tissue, respectively. Note that we have used a 40 mA maximum Arduino current output to achieve stronger force, rather than the 10 mA set in Simulink simulations, since we could not achieve enough force by limiting this current at 10 mA due to the high friction force and restraints of rigid phantom walls. Even with the higher maximum current, we still achieved low power dissipation values due to switching off the current when pull force is not needed.

4 Discussion

In this study, we modeled and demonstrated a control mechanism to be used in the recently proposed mWCE, which aims to extend the functionality of conventional CE beyond imaging. Our concept is a control loop that consists of a permanent magnet on C2 and a controllable magnetic field generated by a solenoid on C1. Once assembling C1, C2, and test phantoms, we realized our experimental setup where we pull C1 with a stepper motor while C2 follows C1 in the test phantom. On the experimental setup, we used test phantoms with different ROC values since the ultimate goal of mWCE is to work in the GI tract, where ROC changes continuously. We achieved a 2-mm constant distance control in the majority of the 3D-printed phantoms, both in plain and wet states. Also, we repeated our experiments on bovine bowel, where we achieved successful control with 250 mm and higher ROC values.

Inter-capsule distance and ROC constraints would be improved if the control were established using a higher-grade magnet and/or a solenoid coil to overcome friction at greater distances. While the proposed method also takes up capsule volume, with device-specific manufacturing, we can possibly fit this distance control mechanism only on capsule domes that are already not used in commercial capsules with cameras [43, 44]. For a mWCE with more than two capsules, both domes of a capsule can be used to hold magnet and solenoid sections.

Thanks to the mWCE, new and effective GI treatment methods can be developed and applied by clinicians for each patient uniquely, depending on the treatment scope. Also, after mWCE hardware adoption becomes mainstream and becomes modular, engineers and clinicians can design their devices as mWCE oriented and compatible with each other to develop a treatment ecosystem that is flexible to adapt for any patient or case.

One of the primary benefits of capsule endoscopy is its ability to access the small intestine, a region that is often challenging to reach with traditional endoscopy or colonoscopy. Nevertheless, it is essential to address the system's behavior within the stomach and colon segments. The colon’s diameter is notably larger than that of the small intestine. Consequently, the capsules will navigate with broader radii of curvature. This is a dimension we have explored through conducting our experiments with phantoms of different diameters (i.e., 15 mm, 20 mm, and 25 mm). Our observations indicate that our methodology is consistently effective across various diameters, suggesting its potential applicability in the colon.

The stomach, due to its expansive volume, necessitates distinct navigation strategies compared to the small intestine and colon. Some potential approaches are (i) equipping the capsule with micromotor-based propellers to navigate within large, liquid-filled spaces such as the stomach [45]. Alternatively, using external coils positioned both beneath and above the patient’s bed to maneuver the magnet-fitted capsule is another viable method. Our recent work [46] has focused on an external coil array featuring four coils and a 2-axis stage, offering 4 degrees of freedom.

5 Conclusion

Our experiments successfully demonstrated active distance control in mWCE in both plastic and ex vivo phantoms as an initial presentation of a new paradigm for GI treatment approaches. Future studies on this subject will focus on the clinical applicability of mWCE along with more robust control methods and/or hardware. Also, we are planning on demonstrating the combination of multiple functions (imaging, tactile sensing, biopsy) within a mWCE by focusing on the specific diseases to present effective utilization, along with the proposed control strategy.