Skip to main content

Thank you for visiting You are using a browser version with limited support for CSS. To obtain the best experience, we recommend you use a more up to date browser (or turn off compatibility mode in Internet Explorer). In the meantime, to ensure continued support, we are displaying the site without styles and JavaScript.

Video tracking and analysis of sleep in Drosophila melanogaster


In the past decade, Drosophila has emerged as an ideal model organism for studying the genetic components of sleep as well as its regulation and functions. In fruit flies, sleep can be conveniently estimated by measuring the locomotor activity of the flies using techniques and instruments adapted from the field of circadian behavior. However, proper analysis of sleep requires degrees of spatial and temporal resolution higher than is needed by circadian scientists, as well as different algorithms and software for data analysis. Here I describe how to perform sleep experiments in flies using techniques and software (pySolo and pySolo-Video) previously developed in my laboratory. I focus on computer-assisted video tracking to monitor fly activity. I explain how to plan a sleep analysis experiment that covers the basic aspects of sleep, how to prepare the necessary equipment and how to analyze the data. By using this protocol, a typical sleep analysis experiment can be completed in 5–7 d.

Your institute does not have access to this article

Relevant articles

Open Access articles citing this article.

Access options

Buy article

Get time limited or full article access on ReadCube.


All prices are NET prices.

Figure 1: Principles of locomotor detection.
Figure 2: Experimental workflow.
Figure 3: Translating motor activity to sleep.
Figure 4: Components of Drosophila sleep.


  1. Roberts, S.K. 'Clock' controlled activity rhythms in the fruit fly. Science 124, 172 (1956).

    CAS  Article  Google Scholar 

  2. Campbell, S.S. & Tobler, I. Animal sleep: a review of sleep duration across phylogeny. Neurosci. Biobehav. Rev. 8, 269–300 (1984).

    CAS  Article  Google Scholar 

  3. Hendricks, J.C. et al. Rest in Drosophila is a sleep-like state. Neuron 25, 129–138 (2000).

    CAS  Article  Google Scholar 

  4. Shaw, P.J., Cirelli, C., Greenspan, R.J. & Tononi, G. Correlates of sleep and waking in Drosophila melanogaster. Science 287, 1834–1837 (2000).

    CAS  Article  Google Scholar 

  5. Graves, L.A., Heller, E.A., Pack, A.I. & Abel, T. Sleep deprivation selectively impairs memory consolidation for contextual fear conditioning. Learn. Mem. 10, 168–176 (2003).

    Article  Google Scholar 

  6. Li, X., Yu, F. & Guo, A. Sleep deprivation specifically impairs short-term olfactory memory in Drosophila. Sleep 32, 1417–1424 (2009).

    Article  Google Scholar 

  7. Gilestro, G.F., Tononi, G. & Cirelli, C. Widespread changes in synaptic markers as a function of sleep and wakefulness in Drosophila. Science 324, 109–112 (2009).

    CAS  Article  Google Scholar 

  8. Ganguly-Fitzgerald, I., Donlea, J. & Shaw, P.J. Waking experience affects sleep need in Drosophila. Science 313, 1775–1781 (2006).

    CAS  Article  Google Scholar 

  9. Nitz, D.A., van Swinderen, B., Tononi, G. & Greenspan, R.J. Electrophysiological correlates of rest and activity in Drosophila melanogaster. Curr. Biol. 12, 1934–1940 (2002).

    CAS  Article  Google Scholar 

  10. Pfeiffenberger, C., Lear, B.C., Keegan, K.P. & Allada, R. Locomotor activity level monitoring using the Drosophila Activity Monitoring (DAM) system. Cold Spring Harb. Protoc. published online, doi:10.1101/pdb.prot5518 (1 November 2010).

  11. Konopka, R.J. & Benzer, S. Clock mutants of Drosophila melanogaster. Proc. Natl. Acad. Sci. USA 68, 2112–2116 (1971).

    CAS  Article  Google Scholar 

  12. Rosato, E. & Kyriacou, C.P. Analysis of locomotor activity rhythms in Drosophila. Nat. Protoc. 1, 559–568 (2006).

    Article  Google Scholar 

  13. Zimmerman, J.E., Raizen, D.M., Maycock, M.H., Maislin, G. & Pack, A.I. A video method to study Drosophila sleep. Sleep 31, 1587–1598 (2008).

    Article  Google Scholar 

  14. Gilestro, G.F. & Cirelli, C. pySolo: a complete suite for sleep analysis in Drosophila. Bioinformatics 25, 1466–1467 (2009).

    CAS  Article  Google Scholar 

  15. Chiu, J.C., Low, K.H., Pike, D.H., Yildirim, E. & Edery, I. Assaying locomotor activity to study circadian rhythms and sleep parameters in Drosophila. J. Vis. Exp. published online, doi:10.3791/2157 (28 September 2010).

  16. Huber, R. et al. Sleep homeostasis in Drosophila melanogaster. Sleep 27, 628–639 (2004).

    Article  Google Scholar 

  17. Keene, A.C. et al. Clock and cycle limit starvation-induced sleep loss in Drosophila. Curr. Biol. 20, 1209–1215 (2010).

    CAS  Article  Google Scholar 

  18. Shaw, P.J., Tononi, G., Greenspan, R.J. & Robinson, D.F. Stress response genes protect against lethal effects of sleep deprivation in Drosophila. Nature 417, 287–291 (2002).

    CAS  Article  Google Scholar 

  19. Shimizu, H. et al. Drosophila ATF-2 regulates sleep and locomotor activity in pacemaker neurons. Mol. Cell Biol. 28, 6278–6289 (2008).

    CAS  Article  Google Scholar 

  20. Branson, K., Robie, A.A., Bender, J., Perona, P. & Dickinson, M.H. High-throughput ethomics in large groups of Drosophila. Nat. Methods 6, 451–457 (2009).

    CAS  Article  Google Scholar 

  21. Straw, A.D. & Dickinson, M.H. Motmot, an open-source toolkit for realtime video acquisition and analysis. Source Code Biol. Med. 4, 5 (2009).

    Article  Google Scholar 

  22. Catterson, J.H. et al. Dietary modulation of Drosophila sleep-wake behaviour. PLoS ONE 5, e12062 (2010).

    Article  Google Scholar 

  23. Crocker, A. & Sehgal, A. Octopamine regulates sleep in Drosophila through protein kinase A-dependent mechanisms. J. Neurosci. 28, 9377–9385 (2008).

    CAS  Article  Google Scholar 

  24. Hendricks, J.C. et al. Gender dimorphism in the role of cycle (BMAL1) in rest, rest regulation, and longevity in Drosophila melanogaster. J. Biol. Rhythms 18, 12–25 (2003).

    CAS  Article  Google Scholar 

  25. Koh, K., Evans, J.M., Hendricks, J.C. & Sehgal, A. A Drosophila model for age-associated changes in sleep:wake cycles. Proc. Natl. Acad. Sci. USA 103, 13843–13847 (2006).

    CAS  Article  Google Scholar 

  26. Andretic, R. & Shaw, P.J. Essentials of sleep recordings in Drosophila: moving beyond sleep time. Methods Enzymol. 393, 759–772 (2005).

    Article  Google Scholar 

  27. Andretic, R., van Swinderen, B. & Greenspan, R.J. Dopaminergic modulation of arousal in Drosophila. Curr. Biol. 15, 1165–1175 (2005).

    CAS  Article  Google Scholar 

  28. Andretic, R., Kim, Y., Jones, F.S., Han, K. & Greenspan, R.J. Drosophila D1 dopamine receptor mediates caffeine-induced arousal. Proc. Natl. Acad. Sci. USA 105, 20392–20397 (2008).

    CAS  Article  Google Scholar 

  29. Wu, M.N. et al. The effects of caffeine on sleep in Drosophila require PKA activity, but not the adenosine receptor. J. Neurosci. 29, 11029–11037 (2009).

    CAS  Article  Google Scholar 

  30. Lebestky, T. et al. Two different forms of arousal in Drosophila are oppositely regulated by the dopamine D1 receptor ortholog DopR via distinct neural circuits. Neuron 64, 522–536 (2009).

    CAS  Article  Google Scholar 

  31. Hendricks, J.C., Kirk, D., Panckeri, K., Miller, M.S. & Pack, A.I. Modafinil maintains waking in the fruit fly Drosophila melanogaster. Sleep 26, 139–146 (2003).

    Article  Google Scholar 

  32. Agosto, J. et al. Modulation of GABAA receptor desensitization uncouples sleep onset and maintenance in Drosophila. Nat. Neurosci. 11, 354–359 (2008).

    CAS  Article  Google Scholar 

  33. Yuan, Q., Joiner, W.J. & Sehgal, A. A sleep-promoting role for the Drosophila serotonin receptor 1A. Curr. Biol. 16, 1051–1062 (2006).

    CAS  Article  Google Scholar 

Download references


I am deeply indebted to A. Keene for his help with a first version of this manuscript. I would like to thank the open source community for creating and sharing valuable software. The work described here was partly funded by a Royal Society Research grant (RG110197) to G.F.G.

Author information

Authors and Affiliations


Corresponding author

Correspondence to Giorgio F Gilestro.

Ethics declarations

Competing interests

The author declares no competing financial interests.

Supplementary information

Supplementary Fig. 1

A. The recording monitor. B. A printed arena. The transparent lid is secured using a rubber band. The middle chamber is filled with food. C. A3D printed arena compared to a glass tube traditionally used for infrared beam-split analysis. The size of the walking chamber is almost identical. (EPS 9269 kb)

Supplementary Table 1

Specialised software for computer assisted behavioural analysis. (DOC 28 kb)

Supplementary Table 2

Comparing costs of video tracking and infrared beam-split. (DOC 18 kb)

Supplementary Video 1

Installing pySolo and pySolo video repositories in Ubuntu Linux A brief screencast guiding the user through the steps required to install the pySolo suite in Ubuntu linux adding custom repositories. The repositories will take automatic care of future updates. (MP4 8097 kb)

Supplementary Video 2

How to build a recording monitor This video shows the basic components of a recording monitor and the criteria for building one of your own. (MP4 36799 kb)

Supplementary Video 3

Preparing the arena for recording How to prepare an arena for recording: from transferring the food to placing the flies. (MP4 50524 kb)

Supplementary Video 4

Configuring the datafetcher script Configuring the datafetcher for automatic fetching and formatting of data. Can be used for pySolo Video or for the original TriKinetics Software. (MP4 21499 kb)

Supplementary Video 5

An introduction to pySolo Video A brief introduction showing how to configure and use pySolo Video. (MP4 18455 kb)

Supplementary Video 6

Using pySolo for data analysis A detailed guide with complete instructions on how to use pySolo for data analysis. (MP4 42015 kb)

Supplementary Data

The zip file contains an electronic drawing of a complete arena, as shown in Supplementary Figure 1b-c. The unzipped file, provided here in STL format, was created using the free software Blender ( and can be opened and viewed using the free STL viewer meshlab ( (ZIP 64 kb)

Supplementary Manual

Installing, configuring and using PySolo for sleep analysis. (PDF 601 kb)

Rights and permissions

Reprints and Permissions

About this article

Cite this article

Gilestro, G. Video tracking and analysis of sleep in Drosophila melanogaster. Nat Protoc 7, 995–1007 (2012).

Download citation

  • Published:

  • Issue Date:

  • DOI:

Further reading


By submitting a comment you agree to abide by our Terms and Community Guidelines. If you find something abusive or that does not comply with our terms or guidelines please flag it as inappropriate.


Quick links

Nature Briefing

Sign up for the Nature Briefing newsletter — what matters in science, free to your inbox daily.

Get the most important science stories of the day, free in your inbox. Sign up for Nature Briefing