Feeding is an essential component of an animal’s behavioural repertoire and forms a mechanistic link between physiology and behaviour1. Fruit flies (Drosophila melanogaster) have emerged as a powerful model to study the neuronal and molecular mechanisms underlying feeding behaviour2 3 4 5 6 7 8, but it remains challenging to quantify feeding in these tiny insects, due to the minute quantities of food they ingest. Most current methods rely either on manual scoring of proboscis extensions9, post hoc quantification of the ingested food using colourants10 or radioactive substances11 or measurement of the volumetric change of food ingested from a capillary5. Although widely employed, these methods have several limitations. For example, they do not provide the sensitivity to monitor food intake by individual animals over time, they force the animals to feed from specialized devices in restricted positions, or they require the addition of dyes or radioactive labels. These drawbacks limit the feasibility of high throughput, unbiased studies of feeding as well as the identification of important behavioural parameters controlling food selection and intake. In rodents12 13, humans14 and insects15, the microstructure of ‘meals’ has been very valuable in providing insights into how hunger and satiation regulate homeostasis. Advancing our understanding of homeostasis in flies would benefit from a method that provides sufficient sensitivity and temporal resolution to quantify each ingestion event. In recent years, several automated and quantitative approaches have emerged to monitor and analyse behaviour based on machine vision16 17. Because of the limitations of digital cameras, it is difficult to resolve the fine details of an animal’s physical interactions with small objects, such as morsels of food, especially if the system is optimized to track the animal over many body lengths. An alternative strategy for detecting fine-scale interactions between an animal and other objects is to measure changes in capacitance or resistance. Such methods have been used previously to quantify feeding behaviour in immobilized aphids18 19 and larger insects20, but advances in digital electronics now permit this approach to be modified in a way that is compatible with greater temporal resolution, higher throughput and freely behaving animals, thereby leveraging the advantages of a genetic model organisms. We have developed an automated, high-resolution behavioural monitoring system called flyPAD (fly Proboscis and Activity Detector), that uses capacitive-based measurements to detect the physical interaction of individual Drosophila with food. To validate the accuracy of the flyPAD system, we adapted bioluminescent techniques to measure the intake of very small amounts of food as well as the dynamics of food absorption in single flies. We show that feeding from a non-liquid food induces a pattern of highly stereotyped rhythmic proboscis extensions and retractions that is suggestive of an underlying central pattern generator (CPG) controlling the feeding motor programme. The analysis of ingestion dynamics and the microstructure of meals allowed us to dissect the behavioural elements mediating the homeostatic response of the fly to starvation and satiation. These results uncover several similarities with rodents and humans, highlighting a potential conservation of strategies that regulate food intake across phyla. Results Hardware overview To overcome the challenge of reliably detecting and measuring physical interactions of Drosophila with substrates such as food, we developed a method based on capacitive proximity sensors. Such sensors are based on the principle of measuring the capacitance across two electrodes. We designed a sensor so that an animal standing on one electrode (electrode 1) would be in close proximity to food placed on the other electrode (electrode 2; Fig. 1a). Whenever a fly touches the food with its proboscis or leg, it alters the dielectric constant between the two electrodes creating a change in capacitance that is large enough to be detected. We designed our system using the AD7150 (Analog Devices) ultra-low power capacitance-to-digital converter. This device allows two-channel recording at 100 Hz with a sensitivity of 1 fF. To make the measurement system compact, reproducible and scalable, we designed a printed circuit board (PCB) containing the capacitance-to-digital converter and a connector that carries the digitized capacitance signal via an I2C interface (Fig. 1b). Both the arena enclosing the fly as well as a lid were fabricated from acrylic sheets using a laser cutter and fixed on the PCB. The result is a modular arena equipped with two touch sensors, permitting experiments using a single fly with two different food sources. To allow for high-throughput recordings, we implemented an I2C multiplexing board on a Field Programmable Gate Array (FPGA). The resulting system can simultaneously acquire the data from 32 independent behavioural arenas and stream the data to a computer via USB interface (Fig. 1c). Multiple systems can be connected to a single computer, further increasing the throughput of the system. To ground truth, the electrical signals from our device, we simultaneously monitored the behaviour of flies in the arena using a digital video camera in a series of preliminary experiments (for an example, see Supplementary Video 1). The contact of the fly with the food elicited an immediate increase in the capacitance signal, several orders of magnitude above the background noise of the sensor (Fig. 1d). The signal displayed multiple features such as rhythmic changes that appeared to be related to the interaction of the fly with the food. Automatic annotation of feeding behaviour Direct comparisons with videos suggested that whenever a fly came into contact with the food we could detect rapid changes in the amplitude of the signal for as long as the fly was active (Figs 1d and 2a, top graph). To extract these periods of activity, we calculated the root mean square (RMS) of the signal in consecutive 500 ms windows (Fig. 2a, middle graph). By simply thresholding this signal, it was possible to reliably extract the bouts of activity, during which the fly was interacting with the food (Fig. 2a, grey shading in bottom graph). Furthermore, on closer inspection of the videos, we noticed that flies rhythmically extended and retracted their proboscis on the food. This behaviour was reflected in a highly rhythmic, square wave-like pattern in the capacitance signal (Figs 1d and 2b and Supplementary Video 1). On the basis of the hypothesis that this motor pattern might correspond to rhythmic feeding, we designed an algorithm to extract putative ‘sips’ based on the shape of the signal (Fig. 2b, for further details see Methods). The algorithm identifies the exact moments when a sip begins (contact of the proboscis with the food) and ends (detachment of the proboscis from the food), as well as inter-sip intervals (ISIs; Fig. 2b, lower graph). To validate the accuracy of our feeding detection algorithm, we captured and manually annotated high-resolution videos from flies interacting with the food on the capacitance sensor. The number of proboscis contacts detected by manual annotation was significantly correlated with the number of sips detected by our algorithm (Fig. 2c). A comparison of the ethograms generated by manual annotation with the results of our automated method further confirmed the accuracy of our approach. The algorithm detected 92.5% of the sips tabulated via manual scoring, while missing 7.5% and generating 7.5% false sips (Fig. 2d). These data demonstrate that our method for detecting sips is sufficiently accurate to be used for automatic monitoring of feeding behaviour. Sips mediate food ingestion Although our method can reliably detect individual proboscis interactions with food (sips), it may not accurately report the actual volume that flies consume, because some proboscis extension events might represent non-ingestive sampling of the food. To test whether the automatically detected sips were correlated with actual ingestion, we developed a method for monitoring food intake in individual flies while they fed on the flyPAD. Because existing methods do not have the sensitivity required to measure food intake in real time in individual flies4, we exploited the capacity of the firefly enzyme luciferase to emit photons (bioluminescence) on its reconstitution with its cofactor D-luciferin21. It has been previously demonstrated that D-luciferin can be fed to flies and is subsequently absorbed by the nervous system22. Thus, photon counts generated by neuronally expressed luciferase should be temporally correlated with the intake of food mixed with D-luciferin (Fig. 3a). To be able to detect photons in intact flies, we used the strong pan-neuronal Gal4 line nSyb-Gal4 to drive high levels of luciferase expression in the nervous system. On each bout of sips, we observed an increase in photon counts suggestive of food intake (Fig. 3b,c). Furthermore, we observed that the photon count starts increasing as quickly as 10–20 s after the first sip (Fig. 3c). This short delay might underlie the brief latencies previously reported for the action of metabolically active sugars in flies in appetitive conditioning23 as well as classic flight studies24. This method, therefore, offers new opportunities for measuring the dynamics of nutrient absorption and nutrient availability in various tissues or cell types in the fly. Despite the advantages provided by this luciferase method, we found it difficult to quantify the exact volume of food consumed by the fly during each sip. Hence, we developed an additional assay to measure small volumes of food ingested by single flies feeding on the flyPAD. In this protocol, single flies are allowed to feed in the flyPAD from food containing D-luciferin. After the flyPAD measurement, flies are homogenized and, on addition of recombinant luciferase, the amount of light emitted is measured using a luminometer (Fig. 3d). The advantages of this method are that it does not require the use of luciferase-expressing transgenic animals and that the high signal-to-noise ratio of the bioluminescent signal permits the detection of very small quantities of ingested food. Comparing three different features of the capacitive signal extracted using the flyPAD (number of activity bouts, total duration of activity bouts, and number of sips) with the measured food intake allowed us to define the extent to which they correlate (Fig. 3e). All three behavioural metrics were correlated with ingestion; however, the degree of correlation varied. Whereas the number of activity bouts, which represent how often an animal approaches the food (Fig. 2a), has a significant but weak correlation with the ingested volume (Fig. 3e, left graph), the total duration of all activity bouts (Fig. 3e, middle graph) correlates much more strongly with food intake, as does the number of sips (Fig. 3e, right graph). The sensitivity of this method allowed us to estimate the median volume of food that flies consume per sip to be 1.05 nl (0.72 to 1.35, 95% confidence interval). These results validate the use of the flyPAD to extract the dynamics of feeding and food intake in single flies. To demonstrate the potential applications of the flyPAD device, we next provide several examples of its use to analyse food choice, feeding motor programs and nutritional homeostasis. flyPAD allows the study of the dynamics of food choice The ability of flies to choose among foods of different qualities underlies nutrient balancing2 and is an important experimental paradigm for uncovering the molecular and neuronal basis of gustation in Drosophila 10 25 26 27. When given the choice between 1 and 5 mM sucrose in the flyPAD arena, flies strongly preferred to feed from the 5 mM sucrose source (Fig. 4a), as had been observed previously using the colour assay25. The ability to calculate the preference index for individual flies (Fig. 4a, right side) permits the use of clonal genetic manipulations to study food choice28. Another parameter that strongly affects the throughput of behavioural assays is the length of each trial. Standard food choice assays are normally performed over 2 h (ref. 2). The cumulative plot of the preference index shows that after 10 min, the preference index plateaus at the level observed at the end of a 50 min assay (Fig. 4b). This suggests that using flyPAD makes it possible to drastically shorten the trial length required to make meaningful measurement of food preference. In addition, the dynamic readout of feeding provided by flyPAD permits investigation of the behavioural mechanisms underlying feeding decisions. In the case of the high- versus low-sucrose paradigm, flies continued visiting the food with the lower sucrose concentration, as visualized by a steady increase in the sip count (Fig. 4c). This indicates that flies did not focus exclusively on one resource, but rather continued to sample from both. The flyPAD is therefore well suited to study food choice, opening new possibilities for studying feeding decisions at a mechanistic level in Drosophila. Feeding is mediated by a stable, rhythmic motor programme In humans and rodents, motor programmes underlying food ingestion such as licking, mastication and swallowing are highly rhythmic and are controlled by CPGs located in the brainstem29 30 31. The high temporal resolution of our system allowed us to closely analyse the structure of feeding motor patterns in flies. Similar to rodents and humans, feeding flies exhibited a highly rhythmic motor pattern, with most sips having a length of 0.13 s and an ISI of 0.08 s when eating yeast (Fig. 5a,b). We then tested whether either the pattern or durations of sips were modulated by the content of the food or by the internal metabolic state of the animal. We starved flies for different periods of time (0, 4 and 8 h) and then tested them on the flyPAD with a 10% sucrose gel. The durations of sips were slightly, but significantly, longer on sucrose when compared with yeast (0.16 versus 0.13 s, P=0.019, Wilcoxon Rank-Sum test) (Fig. 5a,c). Furthermore, the sip durations on sucrose were more variable than on yeast as evidenced by the broader distribution of the histogram. ISIs, however, were not significantly altered by the content of the food (0.07 versus 0.08 s, P=0.18, Wilcoxon Rank-Sum test) (Fig. 5b,d). Animals homeostatically compensate for a lack of energy by increasing their food intake following starvation. However, flies might alter their feeding motor programme in two basic ways to increase food consumption: they could increase the duration of sips (corresponding to an increase in food intake per sip) or shorten the ISIs (corresponding to an increase in the feeding rate or vigour of eating). Similar to licks in rodents32, we found that flies maintain both the duration of sips (Fig. 5c) and the ISIs (Fig. 5d) constant on deprivation (P=0.078 for sip duration and P=0.35 for ISI, Kruskal–Wallis one way analysis of variance). Therefore, the feeding motor programme of Drosophila consists of a highly rhythmic proboscis extension and retraction cycle suggestive of an underlying CPG. This pattern is not altered substantially by changes in the internal hunger state of the animal, but does partially adapt to the nature of the food. The microstructure of feeding reveals homeostatic strategies If the motor programme underlying feeding is not modified following starvation, how does a hungry fly modify feeding to achieve homeostasis? In rodents, meals are organized in ‘bursts’ of licking13, and an increase in feeding following starvation is achieved mainly by reducing the interval between bursts33 34. To dissect the behavioural strategies leading to increases in food intake following starvation in Drosophila, we analysed changes in the microstructure of meals. On the basis of criteria established for rat licking behaviour13, we defined a feeding burst as three or more consecutive sips separated by inter-burst intervals (IBIs) smaller than double the median ISI (Fig. 6a). In fully fed flies, sips were organized into bursts consisting of an average of 5.8 sips (Fig. 6b). Whereas the length of the feeding bursts was not significantly altered after 4 h of starvation, 8 h of starvation led to a significant increase in the number of sips per feeding burst (average of 8.3 sips). In contrast to feeding bursts, just 4 h of starvation led to a significant shortening of the IBI from 78 to 29 s (Fig. 6c). Additional starvation (8 h) did not cause a further decrease in IBI. The dissociable effects of starvation time on the duration of feeding bursts and IBI suggest that flies use distinct strategies to adapt to short and medium lengths of starvation. After a short period of starvation, the fly is active on the food for longer periods (Fig. 6d) and shortens the intervals between feeding bursts (Fig. 6c). On longer starvation times, the fly also increases the length of the feeding bursts (Fig. 6b,k). Whereas hunger increases food intake to compensate for the lack of nutrients, satiation regulates the length of a meal by inducing its termination. The effect of satiation is reflected in the reduction of the slope in the cumulative number of sips (Fig. 6e). To quantify how the three microstructure parameters change as the animal becomes satiated, we calculated how each changed during a meal (Fig. 6f–h). We performed these calculations for the flies starved for 8 h, because the satiation effect is the strongest (Fig. 6e). As expected, over the duration of the meal all parameters reverted to values approximating the situation in fully fed flies. The number of sips per burst only significantly changed at the end of the meal, from 8.5 sips per burst at the beginning to 5.2 sips per burst at the end of the experiment (Fig. 6f). A significant change in the length of the IBI and the duration of activity bouts is already detected within about 10 min after the start of a trial (Fig. 6g,h). The modulation of these feeding parameters during the meal ultimately leads to its termination (Fig. 6e). The initial rate of feeding can be used as a bona fide measurement of the motivation to feed. The deceleration of food intake, on the other hand, can be used as readout for the strength of the satiation signal leading to the termination of a meal14 35. Satiation is difficult to measure in Drosophila, so we used an approach employed in human feeding research and fitted a quadratic equation35 to the cumulative feeding curves of every individual fly and extracted the linear and the quadratic coefficients from the fitted curves (Supplementary Fig. 1). As expected, the linear coefficients (which in vertebrates is a proxy for the motivation to feed) increases following starvation (Fig. 6i)14. Likewise, the quadratic coefficient (which is thought to represent the strength of the satiation signal) decreases significantly following starvation (Fig. 6j)14. These results indicate that in flies, as in humans, the linear and the quadratic coefficients are good readouts for the drive-to-eat and the satiation signals. Discussion We use a new device based on capacitive sensing to study the interaction of Drosophila melanogaster with food. This has allowed us to study feeding behaviour at a temporal resolution of 100 samples per second and with