**OBJECTIVE**—The purpose of this study was to introduce a novel meal detection algorithm (MDA) to be used as part of an artificial β-cell that uses a continuous glucose monitor (CGM).

**RESEARCH DESIGN AND METHODS**—We developed our MDA on a dataset of 26 meal events using records from 19 children aged 1–6 years who used the MiniMed CGMS Gold. We then applied this algorithm to CGM records from a DirecNet pilot study of the FreeStyle Navigator continuous glucose sensor. During a research center admission, breakfast insulin was withheld for 1 h, and discrete glucose levels were obtained every 10 min after the meal.

**RESULTS**—Based on the Navigator readings, the MDA detected a meal at a mean time of 30 min from the onset of eating, at which time the mean serum glucose was 21 mg/dl above baseline (range 2–36 mg/dl), and >90% of meals were detected before the glucose had risen 40 mg/dl from baseline.

**CONCLUSIONS**—The MDA will enable automated insulin dosing in response to meals, facilitating the development of an artificial pancreas.

The development of an artificial β-cell is a challenging task that has drawn together different disciplines within engineering, science, and medicine for the past 30 years (1). In the most likely scenario, the subject is connected to both a continuous subcutaneous insulin infusion system and a continuous glucose monitor (CGM). The loop is “closed” inside a computer/personal data manager by software that regulates the glucose level by changing the insulin infusion rate of the pump. The success of such an artificial β-cell depends on the following: *1*) predictive mathematical models of patients that can mimic glucose absorption secretion and insulin action (e.g., the pharmacokinetic/pharmacodynamic models in refs. 2 and 3); *2*) reliable and accurate sensors that transmit real-time glucose measurements; *3*) automated insulin pumps that can be controlled by software; and *4*) a controller (algorithm) that can regulate glucose by changing the infusion rate based on sensor glucose measurements. A variety of controllers that are capable of regulating glucose can be found in the literature. Several are based on mathematical models and designed as proportional integral derivative or model predictive control (4–7); others are based on fuzzy logic (8). However, as was noted by Hovorka et al. (9), a number of challenges remain to be solved before the artificial β-cell is realized: one of the critical challenges is the regulation of glucose levels after a meal (10). The meal challenge can be met, in principle, by three different approaches. The first one is the feed-forward control approach in which the user of the artificial β-cell will inform the controller that a meal is occurring (or is about to occur) by clicking a button, thus initiating an insulin bolus. The second way is to rely strictly on feedback control, whereby the algorithm will respond only after a sufficiently large rise in glucose has occurred. This particular strategy has proven difficult in practice owing to the tradeoff between the need to respond quickly due to the delay in insulin absorption and the need to have a conservative scheme that does not deliver an overdose of insulin. The third approach is discrete meal detection; this will trigger an insulin bolus as part of an algorithm using continuous feedback from a CGM. One can envision that the first and third schemes could be combined, such that the discrete meal detection algorithm is a failsafe mode for a patient-initiated feed-forward scheme. This article details a reliable meal detection suite of solutions that was validated with historical CGM and can be implemented as part of an artificial β-cell controller.

## RESEARCH DESIGN AND METHODS—

Meal-related glucose excursions were initially assessed using the data from 26 meal events when subjects were wearing a MiniMed Gold CGM (Medtronic Diabetes, Northridge, CA) and had marked the onset of a meal. These records were obtained from 19 children aged 1–7 years (mean age 5 years) who were participating in an outpatient study (11). The data presented here were taken from a DirecNet pilot study (a complete list of the participating centers and investigators can be found in the appendix) of the FreeStyle Navigator real-time continuous subcutaneous glucose sensor (Abbott Diabetes Care, Alameda, CA) (12), which is currently an investigational device. This study of 30 children with type 1 diabetes treated with insulin infusion pump therapy included a clinical research center (CRC) admission. All subjects aged >8 signed an assent, and all parents signed a consent approved by the institutional review board at each participating DirecNet center. Twenty-one of the subjects had their breakfast dose of insulin withheld for 1 h to induce a rapid increase in blood glucose levels. Some children did not undergo this test because of their weight and the amount of previous blood sampling. For those participating in the meal challenge, blood samples were obtained every 10 min for 1 h after completion of breakfast. All subjects had been admitted to the CRC the previous day, and all were wearing a FreeStyle Navigator continuous glucose sensor that was recording interstitial blood glucose levels every minute. The average age of the subjects was 11 ± 4 years (range 4–17 years), and 40% were girls. Mean duration of diabetes was 6 ± 3 years. Mean A1C was 7.1 ± 0.6%.

### Rate of change calculation

The glucose rate of change (ROC) is estimated by two different methods; both are based on real-time glucose measurements sampled at 1-min intervals. The first approach is a calculation of glucose ROC using a three-point (current and two previous samples) backward difference (13):

where *G* is the glucose measurement, *t* is time, Δ*t* is the time difference between two sample intervals, and the subscripts *i*, *i*−1, and *i*−2 are the current and two previous samples, respectively.

The second approach is based on optimal estimation theory, using a Kalman filter (14,15), an established method that has been used as part of different algorithms in the context of glucose management such as the following: hypoglycemic/hyperglycemic prediction (16,17), improved glucose monitoring (18,19), and feedback control (7). This method assumes that the glucose sensor signal varies primarily through two contributions: *1*) real changes to the underlying glucose value (*g*_{k}) and *2*) measurement noise (*v*_{k}). Hence, the glucose can be expressed in terms of its ROC (*d*_{k}):

such that the value at time *k* + 1 is the value at the previous time-step *k* plus the ROC. Similarly, the ROC can be expressed in terms of the rate in the previous time step plus the acceleration or the ROC of the ROC (*f*_{k}):

where the acceleration term is a stochastic signal that is changed by a random amount that can be interpreted as process noise (*w*_{k}):

where *w*_{k} has a mean value of 0 and a covariance of *Q*. The glucose measurement is corrupted by random measurement noise with zero mean and covariance *R*:

Equations 2–5 can be written in matrix-vector form as

Equations 6 and 7 are commonly called discrete state space models, and the following notation is commonly used in the systems and control literature:

where *x* is a vector of states and *y* is the measured output. In this application, the matrices and vectors have the following values:

Because both the measurement and process noise are considered stochastic processes, their unknown covariances can be used as the tuning parameters. Hence, the tuning parameter used is related to the ratio of the expected process to sensor noise variance (*Q*/*R* = 5 × 10^{−6}). The states are estimated using a predictor corrector equation of the form

where *◯* is the estimation of the states; the subscript *k*|*k*−1 indicates the estimation at time step *k* using the previous value; the process model is transformed using the standard notation (Φ, Γ, and *C*); and *L* is the Kalman gain. More details on the use of Kalman estimation in general and in the context of diabetes can be found in refs. 14–16.

The best estimate, at the current sample time, of the states (glucose, ROC of glucose, and ROC of the ROC of glucose) is

In the discussion that follows, we will simply refer to these estimated states as G, G′, and G″; that is, at any sample time

### Detection algorithm

The proposed algorithm for meal detection is divided into five stages as illustrated in the flowchart in Fig. 1 and detailed below (20):

The first stage is data acquisition, in which the last 5-min reading from the CGM is conveyed to the algorithm. These data are processed in parallel by a ROC component and a Kalman filter estimation algorithm.

In the second stage, the ROC estimation can be broken down into

*1*) backward difference ROC calculation based on the raw data,*2*) backward difference estimation based on the glucose estimation from the Kalman filter (backward difference and Kalman),*3*) Kalman filter estimation of glucose (G) and the ROC (G′) (Kalman), and*4*) the Kalman estimate of the ROC of the ROC (G″). Thus, four separate inferences of the actual ROC are generated.The estimated ROC is compared with a threshold value that corresponds to a meal-related rise in glucose and is screened using multiple heuristics to minimize false-positive detections. We have identified four design variables that can be tuned according to individual subjects:

*1*) a glucose ROC threshold (1.8–3 mg/dl-min);*2*) a maximum glucose ROC (2–5 mg/dl-min);*3*) a glucose threshold (150–220 mg/dl); and*4*) an acceleration threshold (0.4–0.8 mg/dl per min^{2}). A secondary screening condition to minimize noise artifacts is the requirement that the glucose values will increase monotonically. As a safety interlock measure, a meal declaration will not be issued if such a declaration is issued 15–20 min earlier, and a night safety condition prevents any meal announcement during the night. This condition can be adjusted for the lifestyle of an individual patient. These safety layers can minimize false detections and lead to a more reliable automated system.A voting algorithm is implemented to minimize the risk of an unnecessary insulin bolus. A meal flag will be sent only if two of three methods or three of four methods consistently detect a meal in the same 5-min time window.

Finally, the controller will receive a meal flag and/or the algorithm will reset for the next data point.

### Statistics

Kruskal-Wallis one-way ANOVA on ranks was used to assess significance of the mean time from onset of the meal and the mean increase in glucose values from baseline when a meal was recognized by the four proposed algorithms (SigmaStat, SYSTAT, San Jose, CA).

## RESULTS—

The results from the 17 subjects admitted to the CRC as part of the DirecNet study (21) are summarized in Table 1. Subjects consumed an average of 56 g of carbohydrate for breakfast (range 22–105 g). The table details, for each meal detection method, the time it took to detect the meal (Δ*T*) and how much the glucose had increased from baseline when the meal was detected (Δ*G*). An example of meal detection is provided in Fig. 2. In this example, the four different methods succeeded in detecting the breakfast meal within <20 min of the onset of that meal, and there was a <22 mg/dl increase of the glucose from the preprandial value. In this figure a false-positive meal detection is seen, where *G*″ detected a meal before breakfast. The voting scheme, however, would have prevented this from being a false-positive event. In Table 1 the meal detection time for each of the voting schemes (three-out-of-four and two-out-of-three methods) is denoted for each of the 17 breakfast meals. Using a voting scheme of three-out-of-four, the overall mean detection time from all datasets was 32 min with a mean increase in the serum glucose of 21 ± 9 mg/dl from the onset of eating. Using a voting scheme of two-out-of-three, the mean detection time was 30 min with a mean increase in the serum glucose of 15 ± 10 mg/dl from the onset of eating.

A summary of the results showing how well the “challenge” breakfast meal was detected in all 17 cases by the four different methods is presented in Table 1 and Fig. 3. The average detection time from the onset of the challenge meal was 29, 35, 31, and 30 min, respectively (Table 1), for the backward difference, Kalman, backward difference and Kalman, and *G*″ algorithms, and the average detection time from the end of the meal was 11, 18, 13, and 12 min, respectively. The glucose only increased by a mean of 2 mg/dl from the onset of the meal to the completion of the meal, despite a mean of 17 min to complete a meal. One can infer from Fig. 3 that the Kalman estimation is more conservative than the other methods. This is a result of how the Kalman filter was tuned and, in our opinion, is beneficial in improving the robustness of the voting scheme and providing an additional layer of safety. A second critical factor is the increase in glucose by the time of meal detection. This information is presented in Fig. 3, which shows that 100, 94, 100, and 94% of meals were detected before a 40 mg/dl increase in the glucose using the backward difference, Kalman, backward difference and Kalman, and *G*′ methods, respectively, and 94, 59, 100, and 94% of meals were detected before a 30 mg/dl increase in the glucose using the respective methods.

## CONCLUSIONS—

Meal detection is a critical and enabling component of a control algorithm for an artificial β-cell. Independent of whether one uses a proportional integral derivative, model predictive control, or another control algorithm, the ability to have an automated meal announcement that does not require patient input is an important factor. In reviewing the literature, we were unable to find another article in the medical or engineering literature that specifically addressed the issue of meal detection by using a continuous glucose sensor. We therefore evaluated meal detection algorithms using a FreeStyle Navigator that measures interstitial glucose. In addition, the insulin bolus for breakfast was delayed by 1 hour, allowing us to evaluate the ROC of glucose values following a meal without the confounding effects of an insulin bolus at the time of the meal. The content of the breakfast meals was decided by the study subject, and these meals varied significantly in their composition and grams of carbohydrate, as would occur in their home environment. These conditions therefore mimic the expected conditions for recognizing a meal in a fully closed-loop artificial β-cell.

A critical element of a meal detection algorithm is minimization of the time between the actual meal and the detection flag. This depends on a variety of factors including the meal composition, the time it took to consume the meal, insulin on board, and the amount of noise in the data. Using our algorithm that employed a voting scheme of two-out-of-three methods to detect a meal, the mean detection time from the onset of the meal was 30 min and the mean increase in the serum glucose was only 15 mg/dl. It is our impression that this algorithm combined with a rapid-acting insulin will provide the means to prevent significant postprandial hyper- and hypoglycemia in a closed-loop system, but this theory remains to be tested.

## APPENDIX

The DirecNet Study Group clinical centers (listed in alphabetical order with clinical center name, city, and state. Personnel are listed as principal investigator [PI], coinvestigator [I], and coordinators [C]). *1*) Barbara Davis Center for Childhood Diabetes, University of Colorado, Denver, CO: Peter Chase (PI), Rosanna Fiallo-Scharer (I), Laurel Messer (C), and Barbara Tallant (C); *2*) Department of Pediatrics, University of Iowa Carver College of Medicine, Iowa City, IA: Eva Tsalikian (PI), Michael J. Tansey (I), Linda F. Larson (C), Julie Coffey (C), and Joanne Cabbage (C); *3*) Nemours Children's Clinic, Jacksonville, FL: Tim Wysocki (PI), Nelly Mauras (I), Larry A. Fox (I), Keisha Bird (C), and Kim Englert (C); *4*) Division of Pediatric Endocrinology and Diabetes, Stanford University, Stanford, CA: Bruce A. Buckingham (PI), Darrel M. Wilson (I), Jennifer M. Block (C), Paula Clinton (C), and Kimberly Caswell; 5) Department of Pediatrics, Yale University School of Medicine, New Haven, CT: Stuart A. Weinzimer (PI), William V.Tamborlane (I), Elizabeth A. Doyle (C), Heather Mokotoff (C), and Amy Steffen (C). *Coordinating center*: Jaeb Center for Health Research, Tampa, FL: Roy W. Beck, Katrina J. Ruedy, Craig Kollman, Dongyuan Xing, Andrea Kalajian, and Cynthia R. Stockdale. *University of Minnesota Central Laboratory*: Michael W. Steffes, Jean M. Bucksa, Maren L. Nowicki, Carol A. Van Hale, and Vicky Makky. *National Institutes of Health*: Gilman D. Grave, Barbara Linder, and Karen K. Winer. *Data and Safety Monitoring Board*: Dorothy M. Becker, Christopher Cox, Christopher M. Ryan, Neil H. White, and Perrin C. White.

**Table 1—**

Subject . | Meal . | . | BD . | . | Kalman . | . | BD + Kalman . | . | G″ . | . | |||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|

. | Time . | G (mg/dl)
. | ΔT (min)^{*}
. | ΔG (mg/dl)^{†}
. | ΔT (min)^{*}
. | ΔG (mg/dl)^{†}
. | ΔT (min)^{*}
. | ΔG (mg/dl)^{†}
. | ΔT (min)^{*}
. | ΔG (mg/dl)^{†}
. | |||||

01 | 7:28 | 134 | 27^{‡}^{§} | 36 | 23 | 26 | 20 | 18 | 11 | 3 | |||||

02 | 8:02 | 63 | 35^{‡} | 9 | 42^{§} | 35 | 21 | 9 | 38 | 19 | |||||

03 | 8:04 | 218 | 30^{‡}^{§} | 30 | 34 | 47 | 30 | 30 | 30 | 30 | |||||

04 | 8:41 | 97 | 22^{‡} | 8 | 27 | 25 | 23^{§} | 11 | 20 | 3 | |||||

06 | 8:31 | 263 | 27^{‡} | 2 | 39 | 24 | 37^{§} | 18 | 27 | 2 | |||||

07 | 8:47 | 173 | 34 | 10 | 43 | 30 | 38^{‡}^{§} | 18 | 38 | 18 | |||||

08 | 8:17 | 88 | 36 | 4 | 50 | 27 | 49 | 24 | 37^{‡} | 5 | |||||

09 | 7:33 | 106 | 10^{‡} | 5 | 19 | 22 | 12^{§} | 12 | 9 | 3 | |||||

10 | 7:52 | 223 | 23 | −4 | 32 | 39 | 28^{‡}^{§} | 9 | 28 | 9 | |||||

11 | 8:05 | 203 | 32 | 7 | 38 | 29 | 34^{§} | 12 | 33^{‡} | 10 | |||||

12 | 7:34 | 105 | 40 | 5 | 47 | 28 | 42^{§} | 10 | 41^{‡} | 7 | |||||

13 | 8:03 | 86 | 38^{‡} | 23 | 41 | 31 | 39^{§} | 25 | 34 | 16 | |||||

14 | 8:14 | 85 | 33^{‡} | 27 | 34^{§} | 29 | 30 | 15 | 52 | 84 | |||||

16 | 7:32 | 182 | 24^{‡} | 22 | 27 | 32 | 25^{§} | 26 | 19 | 11 | |||||

17 | 8:07 | 146 | 18 | 8 | 35^{§} | 34 | 32 | 28 | 30^{‡} | 22 | |||||

18 | 8:10 | 98 | 41 | 11 | 47 | 26 | 42^{§} | 13 | 41^{‡} | 11 | |||||

20 | 9:02 | 175 | 17 | 9 | 24 | 35 | 20^{‡}^{§} | 18 | 20 | 18 | |||||

Average | 29 | 13 | 35 | 30^{‖} | 31 | 18 | 30 | 16 |

Subject . | Meal . | . | BD . | . | Kalman . | . | BD + Kalman . | . | G″ . | . | |||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|

. | Time . | G (mg/dl)
. | ΔT (min)^{*}
. | ΔG (mg/dl)^{†}
. | ΔT (min)^{*}
. | ΔG (mg/dl)^{†}
. | ΔT (min)^{*}
. | ΔG (mg/dl)^{†}
. | ΔT (min)^{*}
. | ΔG (mg/dl)^{†}
. | |||||

01 | 7:28 | 134 | 27^{‡}^{§} | 36 | 23 | 26 | 20 | 18 | 11 | 3 | |||||

02 | 8:02 | 63 | 35^{‡} | 9 | 42^{§} | 35 | 21 | 9 | 38 | 19 | |||||

03 | 8:04 | 218 | 30^{‡}^{§} | 30 | 34 | 47 | 30 | 30 | 30 | 30 | |||||

04 | 8:41 | 97 | 22^{‡} | 8 | 27 | 25 | 23^{§} | 11 | 20 | 3 | |||||

06 | 8:31 | 263 | 27^{‡} | 2 | 39 | 24 | 37^{§} | 18 | 27 | 2 | |||||

07 | 8:47 | 173 | 34 | 10 | 43 | 30 | 38^{‡}^{§} | 18 | 38 | 18 | |||||

08 | 8:17 | 88 | 36 | 4 | 50 | 27 | 49 | 24 | 37^{‡} | 5 | |||||

09 | 7:33 | 106 | 10^{‡} | 5 | 19 | 22 | 12^{§} | 12 | 9 | 3 | |||||

10 | 7:52 | 223 | 23 | −4 | 32 | 39 | 28^{‡}^{§} | 9 | 28 | 9 | |||||

11 | 8:05 | 203 | 32 | 7 | 38 | 29 | 34^{§} | 12 | 33^{‡} | 10 | |||||

12 | 7:34 | 105 | 40 | 5 | 47 | 28 | 42^{§} | 10 | 41^{‡} | 7 | |||||

13 | 8:03 | 86 | 38^{‡} | 23 | 41 | 31 | 39^{§} | 25 | 34 | 16 | |||||

14 | 8:14 | 85 | 33^{‡} | 27 | 34^{§} | 29 | 30 | 15 | 52 | 84 | |||||

16 | 7:32 | 182 | 24^{‡} | 22 | 27 | 32 | 25^{§} | 26 | 19 | 11 | |||||

17 | 8:07 | 146 | 18 | 8 | 35^{§} | 34 | 32 | 28 | 30^{‡} | 22 | |||||

18 | 8:10 | 98 | 41 | 11 | 47 | 26 | 42^{§} | 13 | 41^{‡} | 11 | |||||

20 | 9:02 | 175 | 17 | 9 | 24 | 35 | 20^{‡}^{§} | 18 | 20 | 18 | |||||

Average | 29 | 13 | 35 | 30^{‖} | 31 | 18 | 30 | 16 |

Detection time from the onset of the meal.

Difference between the glucose (*G*) level on detection minus the glucose level at onset of the meal.

Trigger of meal flag by the voting scheme algorithm of three-out-of-four methods, mean detection time of 32 min from the onset of eating, at which time the mean serum glucose was 21 ± 9 mg/dl above baseline.

Trigger of meal flag from the voting scheme algorithm of two-out-of-three (backward difference [BD], BD + Kalman filter estimation [Kalman], and *G*″) mean detection time of 30 min from the onset of eating, at which time the mean serum glucose was 15 ± 10 mg/dl above baseline.

The mean blood glucose using the Kalman algorithm was significantly higher compared with that using the other methods (*P* < 0.001).

## Article Information

This work was supported by the Juvenile Diabetes Research Foundation through the artificial pancreas project (grant 22-2006-1108) and by the National Institutes of Health (grant R21-DK69833).

## References

Published ahead of print at http://care.diabetesjournals.org on 31 October 2007. DOI: 10.2337/dc07-1293.

B.W.B. serves on the Scientific Advisory Board of Ultradian Diagnostics. B.A.B. has received honoraria as a speaker for Abbott Diabetes Care.

The costs of publication of this article were defrayed in part by the payment of page charges. This article must therefore be hereby marked “advertisement” in accordance with 18 U.S.C. Section 1734 solely to indicate this fact.