Our laboratory aims to understand how neural circuits create behavior, using the roundworm Caenorhabditis elegans as a model. Experimental advantages of this 1-mm-long nematode include a compact, well-mapped nervous system, genetic manipulability, and optical transparency. We have developed optical methods for monitoring and perturbing neural circuits and behavior with single-cell resolution. We describe our efforts to apply these and other tools to understand two rhythmic behaviours, locomotion and feeding.