Ingestible Osmotic Pill for In-vivo Sampling of Gut Microbiome

Technologies capable of non-invasively sampling different locations in the gut upstream of the colon will enable new insights into the role of organ-specific microbiota in human health. We present an ingestible, biocompatible, battery-less, 3D-printed micro-engineered pill with integrated osmotic sampler and microfluidic channels for in vivo sampling of the gut lumen and its microbiome upstream of the colon. The pill’s sampling performance was characterized using realistic in vitro models and validated in vivo in pigs and primates. Our results show that the bacterial populations recovered from the pills’ microfluidic channels closely resemble the bacterial population demographics of the microenvironment to which the pill was exposed. We believe such lab-on-a-pill devices will revolutionize our understanding of the spatial diversity of the gut microbiome and its response to medical conditions and treatments.


Introduction
The gut microbiota represents trillions of bacteria belonging to around one thousand species. [1] Among the various microbial communities associated within the human body, the gut microbiome is noted for its diversity, its elevated concentration [2,3] and its many beneficial functions. Dysbiosis (microbial imbalance) has been associated with conditions such as inflammation, recurrent infections and increased susceptibility to enteric pathogen. [4][5][6][7][8] Most studies infer the condition of the gut microbiome from the analysis of fecal DNA and fecal metabolites. [1] Because the gut environment changes as the gut content moves down the gastrointestinal (GI) tract, analyses of feces are inadequate to identify abnormal conditions upstream of the distal colon. Whereas the analysis of complex bacterial populations has benefitted from new DNA sequencing techniques, our capacity to precisely and non-invasively sample different organs has not improved.
Consequently, medical research is often based on easily accessible samples, like feces, in spite of the inherent limitations of the conclusions, which can be drawn from the analysis of such samples.
For instance, samples important for understanding the interaction between enteric pathogens and the host remain out of reach, unless invasive sampling techniques are used. To gain new insights into the many beneficial functions of the gut microbiota, it is essential to sample in vivo different locations in the gut, particularly organs located upstream of the colon.
Here, we describe the development and testing of an innovative non-invasive technology to sample the intestinal lumen in vivo. We created an ingestible, biocompatible, 3D-printed microengineered pill with integrated osmotic sampler that requires no battery for its operation. Stereolithography (SLA) based 3D printing was used to fabricate the miniaturized ingestible device with sophisticated microfluidic functions for spatial sampling of the gut lumen. The pill is covered with a pH sensitive enteric coating to delay sampling until the pill has entered the small intestine, where the coating dissolves in the higher pH environment. A magnetic holding mechanism was designed to enable the pill to sample more time from a targeted region of the gut. Natural peristaltic motion endows mobility to the pill through the GI tract without any active parts. The sampling function of the pill has been extensively validated in vitro and in vivo in pigs and primates. The magnetic hold for spatial targeting has been validated in vitro.

Osmotic pill sampler design
The overall design of the pill is shown in Figure 1a. The osmotic pill sampler consists of three main parts -a top sampling head, a semi-permeable membrane in the middle and a bottom salt chamber. The head comprises four inlets, a stilling basin connected to four helical channels, all of them leading to one small chamber. The salt chamber consists of a cavity that contains dry calcium chloride salt powder, a second cavity to hold a small neodymium magnet, two tube-like reservoirs to hold fluorescent dye, and a horn-shaped exit nozzle at the bottom. The pill works on the principle of osmosis where pressure differential is created across the semipermeable membrane, which creates a passive pumping action (see Figure 1a). This mechanism facilitates the flow of water across the membrane from the helical channels towards the salt chamber. The porosity of the membrane blocks the flow of larger particles (e.g., microorganisms), leaving them trapped in the helical channels ( Figure 1a).
The fabrication of this pill is explained in detail in the Materials and Methods section.
Briefly, the pill sampling head and the bottom salt chamber are 3D printed using a stereolithography 3D printer. A semipermeable membrane is used to construct the osmotic pump. The membrane itself is made of woven 5 µm thick cellulose acetate fibers commonly used in reverse osmosis based water filters (Figure 1e

Priming the pill
The pill is primed by injecting approximately 200 µL water into the salt chamber through the exit nozzle using a syringe with a 36-gauge needle. Similarly, the helical channels are filled with water from a marked inlet, which is connected to one of the helical channels (see Figure 1a, and supplementary video 1). By aspirating water through the marked inlet, the water flows first through the corresponding channel and then fills the chamber at the bottom of the sampling head, and finally fills all the other helical channels and the stilling chamber on the top of the pill in this sequence. The head can hold approximately 120 µL of sample.

Sampling strategy
After priming, the pill is ready for oral administration. To avoid sampling the stomach lumen and limit the sampling to the small and large intestine, we placed the pill in a commercially available size 0 enteric coating capsule. The enteric coating resists the acidic environment of the stomach and only dissolves in the neutral/basic environment of the intestine. The dissolution profile for the enteric coating can be controlled by an appropriate choice of polymer(s). Testing of different enteric coatings was not the focus of this study. The osmotic pill sampler moves down the GI tract primarily due to natural peristalsis. The pill, however, can be held at a specific location inside the GI tract using an external magnet. This is made possible by a small neodymium magnet embedded in the pill (Figure 1a). Immobilizing the pill enables preferential sampling of specific regions of the gut, so that more of the collected sample originates from this region. Without this magnet, the pill would sample more or less uniformly along the entire length of the GI tract. We have added two fluorescent marks on the pill to facilitate detection following excretion ( Figure   1d). The details of our sampling strategy are shown in Figure 1g. Microscope (SEM) images of the osmotic membrane used in the pill, f) marked inlet at the top chamber is designed for initiating the pill (priming), g) overall working principle of the osmotic pill sampler in an enteric capsule.

Physical characterization of the pill
Osmosis is a net movement of a solvent through a semi-permeable membrane towards a region of high solute concentration. Once the pill is primed, the process of osmosis causes solvent (water) to flow across the membrane from the helical channels into the salt chamber ( Figure 1f).
The flow rate depends on the properties of this membrane (e.g. thickness, porosity, area) and the salt gradient across it. The fluid sampler consists of such an osmotic pump that continuously pulls the fluid from the gut into the narrow microfluidic collection channels (<1 mm diameter) at a flow rate of 2 ~ 20 µL/hr. We characterized the flow created by osmosis across the semipermeable membrane, which drives the sampling function of the pill (see Supplementary section 1a). The flow rate through the membrane assembled in the pill was also measured over time ( Supplementary   Figure 1b). Initially, the flow rate was ~2.5 µL/hr and remained approximately constant for almost 48 hr. The flow rate fell to around ~0.5 µL/hr after four days.
The design of the exit nozzle in the salt chamber is important because it facilitates the discharge of water being accumulated in the salt chamber as a result of the osmotic action.
Numerical simulations were carried out to study flow through the discharge hole for two different hole diameters, 100 µm and 50 µm (see supplementary Figure 2). The maximum fluid velocity for the 50 µm hole is 0.6 mm/s, which is 4.28 times higher than for hole of 100 µm size. A higher continuous flow rate at the discharge point has two advantages: first, it reduces the diffusion from the environment into the salt chamber, essentially acting as a one-way valve; second, a high flow rate reduces the chance of blockage of the discharge hole by solid debris present in the gut.

In vitro sampling
The gut microbiome comprises prokaryotic and eukaryotic cells that may have no active motility or may be able to swim propelled by flagella or other mechanisms. We validated whether the osmotic pump can sample microorganisms regardless of their motion by testing the pill in vitro with non-motile solid particulates as well as with highly motile bacteria. The first environment included polystyrene micro-particles of 10µm diameter in a highly viscous liquid (160 mPa.s) to mimic the gut environment. These particles exhibit negligible diffusion, especially in the highly viscous solution of 50% w/v polyethylene glycol hydrogel. Since these particles are neutrally buoyant in this solution, the effect of gravity on their motion is insignificant. The second environment included highly motile bacteria, wild-type Bacillus subtilis, in an aqueous solution.
These bacteria perform a run-and-tumble motion, [9] meaning they swim in a certain direction for a short time (~1 s) and then change their swimming direction at random. This results in a highly diffusive transport of the bacteria over long times with effective diffusion coefficients comparable to small gas molecules in water.

In vitro sampling of non-motile micro-particles
We tested the pill in highly viscous environments similar to the GI tract using solutions of 50% (w/v) of polyethylene glycol (PEG), with a molecular mass of 10,000, in two different aqueous buffers of pH 4 and pH 8. Different pH conditions help model the fact that pH varies along the GI tract. The measured viscosity of the solution was 160 ±5 mPa.s at 25°C (USS-DVT4 Rotary Viscometer Viscosity Meter, U.S. Solid Inc., Cleveland, OH, USA). Next, polystyrene particles 10 µm in diameter were added to these solutions to mimic partially digested food particles in the GI tract. These micro-particles are large enough so that the Brownian motion can be ignored.
Therefore, any micro-particles captured by the pill would have entered the helical channels mainly be due to the osmotic flow. Initially, pills were primed with deionized water without PEG. Then, a group of three primed pills were placed in each of the pH 4 and pH 8 solutions described earlier.
At different time points, a pill was taken out of the solution, and the sample was extracted from the pill using a pipette. On average 120 ± 6 µL sample was recovered from each pill. The extracted sample was weighed and imaged using an optical microscope and finally dried on a hotplate at 40⁰C and weighed again. The samples were weighed before and after drying to evaluate the amount of hydrogel aspirated by the pill. The number of micro-particles acquired by the pill at two different time steps was also quantified (see Materials and Methods section for details). To exclude the effect of background fluid motion on the sampling capability of the pill, the tests were performed in static condition with no agitation. To justify exclusion of the uptake in the pill by diffusion, we calculate the diffusion coefficient, , for micro-particles in the viscous medium through the Stokes-Einstein relation, where is Boltzmann's constant, is the absolute temperature, is the diameter of the particle, and is the dynamic viscosity of the medium. The diffusion coefficient of a 10 µm diameter spherical particle at 37°C in a fluid with viscosity of 160 mPa.s is = 2.8 × 10 −4 μm 2 s ⁄ . To diffuse one particle diameter under such conditions would require a time ≈ 2 /2 = 2.1 days.
Thus, on time scales relevant to our experiments, diffusion is ineffective in generating any appreciable uptake of particles into the pill. which validates that the osmotic pill can indeed sample non-motile micro-particles in a highly viscous environment. We also evaluated the amount of PEG aspirated into the pill's helical channels over time. Initially, the channels contain only pure water used for priming. Over time, the PEG from the surrounding environment is sampled by the pill along with micro-particles, causing the concentration of the PEG in the pill to increase. Figure 2b shows a quantitative comparison of the hydrogel concentration in the pill over time in acidic (pH 4) and basic (pH 8) conditions. The hydrogel concentration increases almost linearly with time. However, in basic conditions, a higher sampling rate was noticed, as was a higher hydrogel concentration inside the pill, exceeding the concentration in the surrounding environment. We believe this is because the pH protonates and deprotonates the functional groups of the membrane itself and of the molecules in solution. This effect will change the effective charge on the membrane and alter the size of the pores, which will impact the membrane's nanofiltration properties and affect the flux of water. [10,11] The zeta potential (ζ) of a cellulose acetate membrane is negative for pH 3 or higher and becomes more negative as the pH increases. [12] Therefore, the membrane is more negatively charged at pH

In vitro sampling of motile bacteria
In the second in vitro test, we aimed to evaluate the sampling performance of the osmotic pills with motile bacteria. Wild-type B. subtilis was chosen as the test bacterium, which is ubiquitous in the GI tract of ruminants and humans. We used a fluorescent strain to facilitate imaging. B. subtilis is a multiflagellated bacterium that swims with an average speed of 52 μm. s −1 at room temperature (25˚C) when the flagella rotate in synchrony to form a bundle. [13] Fluctuations in flagellar rotation can cause the flagella to unbundle and generate a random reorientation of the cells. Subsequently, the bundle reforms resulting in the canonical run-andtumble motion of the bacteria, which is characterized by an effective diffusion coefficient, [14] ≈ 2 (2) where, is the swimming speed of the cells and is the persistence time of the cell orientation, which is approximately ~1 s for B. subtilis. [15] Therefore, the effective diffusion coefficient is 2700 μm 2 ⁄ , which is 10 7 larger than the polystyrene beads used in the previous experiment.

Pill mobility in the gut (ex-vivo study)
To study how the pill moves inside the GI tract, we conducted ex-vivo experiments using intestines freshly dissected from pigs (Supplementary Figure 3). At a flow rate of 4 mL/min and 8 mL/min the pills moved with an average speed of ~10 cm/min and ~13 cm/min, respectively. The pill, however, moves with much higher velocity (~22 cm/min) when the flow rate is increased to 10 mL/min, demonstrating nonlinear behavior attributed to the viscoelastic nature of the intestine which expands under increased peristaltic pressure. The natural peristaltic flow rate of fluid through the proximal small intestine varies widely from an average of 2.5 mL/min in fasting subjects to as high as 20 mL/min after meals. [16][17][18][19] The ex vivo observation indicates that the pill readily moves inside the GI tract under realistic flow conditions.

In vitro and in vivo studies
To further investigate the performance the pill, three experiments were performed in vitro  Table 1 are thus proportional to the number of bacteria in the sample. These data indicate that bacteria sampled in the latter part of each experiment tend to be over-represented. This conclusion is based on the observation that L. rhamnosus sequences (order Lactobacillales) are more abundant than expected based on the duration of immersion in L. rhamnosus culture. The three rightmost columns of Table   1 show that the vast majority (>90%) of 16S sequences obtained from pure cultures of each bacterium are correctly classified.   slurry. Figure 4 shows that the samples recovered from the collection channels, designated with a circle in the figure and labeled "in" in the key, indeed originated from the fecal slurry in which the pills were immersed for 24 hr. (triangles; "out"), and that the slurry from the opposite species did not contaminate the sample to a detectable extent. This is apparent from the tight clustering of the red (mouse) triangle with the circle of the same color, and the green (cat) triangle with the green circles. The 16S sequence data show that the pills operate as intended and are capable of actively collecting sample from the surrounding matrix. PCoA of 16S sequences from pills excreted by the (primates), as well as from matching fecal samples are shown in Figure 5. The position on the plot of the samples recovered from the pills' collection channels is clearly distinct from the feces collected directly from the ground or from feces adhering to the outside of the pills. These results indicate that the pills channels contained sample collected from more proximal organs, consistent with the pills' ability to sample the entire GI tract.
We used Linear Discriminant Analysis to identify Operational Taxonomic Units (OTUs), which differ significantly in abundance between the pill's collection channels and the feces. [20] The 3 samples collected by the pills were highly enriched in Firmicutes belonging to the class Clostridia, order Clostridiales (Supplementary Table 2). Out of 32 OTUs significantly enriched in the pill samples, 21 (65.6%) belonged to this order, whereas in the fecal samples collected from the ground or adhering to the outside of the pills only 1/9 OTUs (11.1%) belonged to this taxon.
The association between Clostridia classification and samples origin is statistically significant (Fisher exact test, p=0.003). Because the small intestine is difficult to access, little information is available on microbial populations residing in more proximal sections of the GI tract. However, the genus Clostridium is known to be more abundant in the small intestine than in the colon. [21,22] The high abundance of Clostridiales OTUs in samples collected by the pills is consistent with active sampling as the pills travels through the macaques' GI tract. The complete taxonomic profile of the samples recovered from the pills, from the feces and from fecal material adhering to the outside of the pills is shown in Supplementary Table 3.

Figure 5.
Principal Coordinate Analysis of bacterial microbiome sampled by pills orally administered to 3 macaques. Samples were extracted from the pills as described in Materials and Methods. In addition, DNA extracted from the feces and from feces adhering to the outside of the pills were sequenced to assess to what extent the material sampled by the pills differed from the feces. The colors represent the animal as indicated in the key with a 6-digit alphanumeric code. Symbol indicates origin of sample; square, pill's collection channels, circle, feces; triangles, feces adhering to the outside of the pill. Identical symbols of the same color are technical replicates obtained by amplifying, barcoding and sequencing a sample twice. The distance between replicates is a measure of technical variation, i.e., variation introduced by sample processing and by sequencing.

Towards spatially selective sampling
The in vivo and in vitro studies validated the pills functionality in sampling the gut environment with different anatomy and conditions. Our results show that the bacterial populations recovered from the pills' microfluidic channels closely resemble the bacterial population demographics of the microenvironment to which the pill was exposed. Most importantly, it showed the ability of the pill to sample the regions of the gut upstream of the colon with quite distinct microbiome population compared to the feces. For a more spatially targeted sampling, one can immobilize the pills using an external magnet where more of the sample can be collected from a targeted region. We performed in vitro studies to validate the magnetic hold functionality for spatially selective sampling using colored dye as a model of GI fluid. The results reported in supplementary successfully validate our hypothesis (see supplementary Figure 4 and Supplementary Table 4). In vivo animal studies with magnetic hold for spatially selective sampling will require large magnets, in vivo imaging and visualization and other infrastructure -this is the basis for future work.

Ingestible osmotic pill fabrication
The pill sampling head and the bottom salt chamber are 3D printed with The salt chamber was filled with calcium chloride powder before the salt chamber and the sampling head were assembled together. The fabricated osmotic pill is shown in Figure 1b.

Sample extraction
The inlet port that allows priming and extracting the collected sample after recovery from the feces was marked with a black dot. This port is directly connected to one of the helical channels.
The four helical channels are connected at the bottom to the collection chamber. Sample recovery is achieved by applying suction at this port, or by centrifugation of the pill in a head-down position.
Either method extracts the sample out of the corresponding helical channel, the collection chamber and then the other 3 helical channels in that sequence. A 100 µL pipette tip that easily fits into this marked inlet is used for this task Extraction is achieved using a pipette or a syringe. The process is shown in supplementary video 1. The centrifugation procedure is described below (section In Vitro Experiments)

Motile bacteria culture
Fluorescent wild-type Bacillus subtilis (strain SG67 GFP) bacteria were cultured by inoculating 5 mL of Cap Assay Minimal (CAM) motility medium with cells obtained from a frozen glycerol stock solution. [13] Cells were grown overnight at 37°C while shaking at 250 rpm until the optical density reached 600 = 0.1. These cells have 1 µm×3 µm elongated bodies and swim at a speed of U = 40 -65 µm.s -1 . [13] Imaging and analysis

Epiluorescence imaging was performed on an inverted microscope (Nikon Ti-E) with a 10
× objective to take snapshots of the cells in the samples with a Zyla sCMOS camera (Andor Technology). Image analysis was performed to enumerate the bacteria by intensity thresholding in ImageJ. [23] Particle and bacterial concentration measurement To quantify the concentration of the bacteria/particles collected by the pill over time, these steps were followed: 100 µL of the sample extracted from the pill using a pipette were dispensed on a glass slide; two spacers of 100 µm height where placed on either edges of the glass slide; another glass slide were placed on the top of the sample to confine the liquid; the sample was then imaged and the number of bacteria/particles on the surface were counted using the ImageJ software in the field of view. Three such images were taken over the entire glass slide. The average number of bacteria/particles per field divided by the visible area for the view, and the particle concentration expressed as number per mm 2 . A second in vitro experiment was conducted to confirm that uptake of sample requires the action of the osmotic pump. Standard pills with CaCl2 in the salt chamber as shown in Figure 1b and pills lacking salt were immersed in parallel in fecal slurry. No enteric coating was used. The pills were kept in motion on a magnetic stirrer in 200 mL glass beakers containing fecal slurry.

In vitro experiments with live bacteria and fecal slurries
The experiment was conducted at room temperature.
A third in vitro experiment was undertaken to further assess the function of the pill when it is immersed in fecal slurry. Specifically, we investigated the level of contamination of the sample recovered from the collection channels with material adhering to the outside of the pills. Fecal slurry was prepared as described above for the second experiment. Two pills were immersed in each of the two slurries (cat or mouse) and retrieved after 24 hr. Thereafter each pill was briefly immersed in the opposite slurry (mouse or cat), rinsed with distilled water and dried.

Experiments in pigs and macaques
Weaned pigs approximately 3 weeks of age were be purchased from the Cummings Veterinary School campus and housed in pens according to IACUC guidelines (protocol number G2018-03 Tufts University). The pills' osmotic pump was activated with distilled water and the collection channels primed with water. The pills were enclosed in an enteric capsule (Size 00 white empty enteric coated capsules from CapsulCN International CO., Ltd, China) immediately prior to oral administration. The pill was inserted into a pill "gun" to introduce the pill directly into the pig's esophagus, preventing regurgitation (see Supplementary Figure 5). Two experiments were conducted in pigs. In experiment 1, two pills were recovered from the stomach of the pig posteuthanasia. In experiment 2 one pill was recovered from the feces (see Supplementary Figure 6).
Experiments in non-human primates (see supplementary Figure S7 was collected and checked, but no pills were found. The animals from which no pills were recovered were euthanized after 2 months as part of the scientific project for which they were assigned. During the necropsy, no pills were found and the gastro-intestinal tract showed no significant findings. Also an additional CT scan of one of the animals just before necropsy did not show any evidence of the remains of a pill. It can be assumed that the unrecovered pills were passed by the animals, but were missed in the check of the fecal matter.

Molecular biology methods
Following recovery of the content of the collection channels, DNA was extracted in a QiaCube instrument using the QIAamp PowerFecal DNA kit (QIAGEN, cat. 12830-50) according to the manufacturer's protocol. DNA was eluted in 50µL elution buffer and stored at -20 o C. A previously described PCR protocol was used to prepare 16S V1V2 amplicons libraries for 16S amplicon sequencing. [24] The quality of the 16S amplicons was assessed by agarose gel electrophoresis. Amplicons were pooled in approximately equal molar ratio, size-selected with a Pippin Prep instrument (Sage Science, Beverly, Mass.) and sequenced in an Illumina MiSeq sequencer at the Tufts University Genomics core (tucf.org) using single-end, 300-nucleotide strategy. To control for technical variation introduced during library preparation and sequencing, each library included two replicates of two randomly chosen samples. Replication involved processing duplicate fecal samples, amplified and barcoded individually.
which was used for converting Ct to DNA concentration (C).

Bioinformatics analysis
Bioinformatics analysis of 16S sequences was performed in mother essentially as describe. [24][25][26] Briefly, random subsamples of 5000 sequences per sample were processed using a sequence processing pipeline designed to generate pairwise weighted UniFrac distances between samples. [27] Distance values were entered into a distance matrix and visualized by PCoA. PCoA plot were computed in GenAlEx. [28] Sequences were taxonomically classified using the method described by Wang et al [29] in mothur (same ref as [25]). The minimum bootstrap value for taxonomic assignment was set at 70%.
To convert relative 16S sequence abundance value for each bacterial species obtained in In vitro experiment 1 to relative abundance of bacteria, relative sequence abundance data were

Pill mobility in the gut (ex-vivo study)
A 1 m portion of small intestine was used to carry out the test. The setup used for the ex-vivo test is shown in Supplementary Figure 3 Supplementary Figure 3. Ex-vivo test of pill mobility inside the pig intestine. A simulated gut media was pushed through the intestine with an external peristaltic pump to mimic natural peristalsis.

Diffusion coefficient of micro-particles
To validate that the diffusion effects can be neglected, we calculated the diffusion coefficient for micro-particles in the stated conditions using the Einstein-Smoluchowski relation, where is the mobility coefficient expressed as the ratio of the particle's terminal drift velocity to an applied force, = ⁄ ), is Boltzmann's constant and is the temperature in Kelvin scale.
At low Reynolds number, the Stokes-Einstein relation for spherical particles of diameter d is, where is the dynamic viscosity of the medium. Thus the Einstein-Smoluchowski relation simplifies to the Stokes-Einstein relation, Based on the Stokes-Einstein relation, the diffusion coefficient of a spherical particle of 10 µm in diameter at the test temperature of 37°C in a fluid with the viscosity of 160 mPa.s is 2.8 × 10 −4 μm 2 s ⁄ , which is very small and can be neglected in our study.

Taxonomic classification of samples from pigs and primates
Supplementary Table 1.
Taxonomic classification of 16S sequences from 7 samples extracted from two pills recovered from pig feces and from 3 GI tract organs. Sequences were classified using program classify.seqs in mothur [25]. The headers are color-coded to indicate the origin of the sample as indicated in  Table 2.
Bacterial OTUs significantly differing in relative abundance in samples originating from the pills' collection helical channels (square symbols in Figure 5) as compared to samples collected directly from the macaques' feces or adhering to the outside of the pills (circle and triangle symbols, respectively, in Figure 5). OTUs enriched in sample collected by the pills are indicated with red font. OTUs enriched in the feces are indicated with green font.
Taxonomic classification of 11 primate experiment samples. Column headers are color-coded as in Figure 5. Samples "Feces" and "Adhering Feces" in columns E, F and G, H, respectively, are replicates to control for technical variation.

Magnetic hold test
The pill has a micro-magnet that serves two purposes: first, to hold the pill in place at a desired section of the GI tract to acquire more sample from a specific location; second, to facilitate recovery of the pill following excretion in the feces. An in vitro test was designed to validate the local sampling capability of the pill in three different environments. Instead of creating three different chambers each with a different environment, we created an equivalent setup where there is just one chamber and we pump in three different test solutions mimicking three different in vivo environments (see Supplementary Figure 4). The setup is shown in Supplementary Figure 4a.
Initially, the absorption spectrum of each individual dye and a mixture of the three dyes, was captured to ensure that the interaction between dyes is negligible (see Supplementary Figure 4b).
In the first test, we filled the feeding reservoir with yellow dye test solution and applied a flow rate of 2 mL/sec (same for all tests) to move the solution in the testing chamber for 90 min. The chamber was then filled with red dye for 30 min and then with blue dye for another 30 min. After finishing all three steps, the pill was recovered and 100µL sample extracted from the pill's collection channels using a pipette. The sample was then mixed with 2 mL of distilled water and analyzed with a UV-Visible spectrophotometer. The resulting spectrum in Supplementary Figure   4c shows that the absorption of the yellow dye is higher relative to the red and blue dyes. We also decomposed the spectrum response to find the individual components from individual dyes in the sample (Supplementary Figure 4c). In test 2, we put the pill in yellow dye test solution for 30 minutes, red dye for 90 minutes and blue dye for 30 minutes. As we could expect from the previous experiment, the red dye has higher peak than the yellow and blue dyes as seen in Supplementary  Table S1.
The purpose of the test was to validate the hypothesis that the pill can be held in a desired place using an external magnet, even in moving fluid, and that the pill will collect more sample from a region it is immersed in for more time. The experiment was performed in a plastic tube with an internal diameter of 2 cm and a thickness of 1.5 mm (see Supplementary Figure 4). An external neodymium magnet was used to hold the pill in place. Peristaltic flow was induced in this chamber using an external peristaltic pump. To mimic sampling in three different areas of the GI tract, we pumped three different aqueous test solutions. The time the pill is exposed to each of the test solution dictates how much of that solution is aspirated into the helical channels. Dyes were used to visually identify the three different test solutions in which the pills were suspended. In this setup, we pumped two of three test solutions for 30 min which mimics the transit regions of the GI tract, and the remaining third for 90 min which mimics the "hold time" in the desired location of the GI tract (see Table S1). The absorption spectrum of the sampled contents recovered from the pill following the experiment was analyzed using a UV-Vis spectrum analyzer.
The setup for this in vitro test is shown in Supplementary Figure 4a showing peaks at 403 nm, 499 nm and 629 nm for the yellow, red and blue dye, respectively. Note that the dyes have a broad spectrum around their peak absorption wavelength. We also mixed 100 µL of each dye with 2mL distilled water and extracted the spectrum of the mixed solution as seen in Supplementary Figure 4b. This analysis validated that the dyes have negligible interaction and that the superposition assumption is valid.  Figure 4. Validation of "trap and hold" sampling using a magnet. a) Experimental setup, b) spectrum of three different dye solutions and their mixture, c) test1 d) test2, a) test3 results. Results indicate that the content of the pill strongly correlates with the solution it is exposed to.

In vivo test -oral administration
Supplementary Figure 5. Oral administration of the pill for In-vivo test. The pill was inserted into a pill "gun" to introduce the pill directly into the pig's esophagus, preventing regurgitation Supplementary Figure 6. Extracted pill from pig feces in the in vivo experiment.