Defecation in the nematode worm Caenorhabditis elegans is a highly rhythmic behavior that is regulated by a Ca(2+) wave generated in the 20 epithelial cells of the intestine, in part through activation of the inositol 1,4,5-trisphosphate receptor. Execution of the defecation motor program (DMP) can be modified by external cues such as nutrient availability or mechanical stimulation. To address the likelihood that environmental regulation of the DMP requires integrating distinct cellular and organismal processes, we have developed a method for studying coordinate Ca(2+) oscillations and defecation behavior in intact, freely behaving animals. We tested this technique by examining how mutations in genes known to alter Ca(2+) handling [including egl-8/phospholipase C (PLC)-beta, kqt-3/KCNQ1, sca-1/sarco(endo)plasmic reticulum Ca(2+) ATPase, and unc-43/Ca(2+)-CaMKII] contribute to shaping the Ca(2+) wave and asked how Ca(2+) wave dynamics in the mutant backgrounds altered execution of the DMP. Notably, we find that Ca(2+) waves in the absence of PLCbeta initiate ectopically, often traveling in reverse, and fail to trigger a complete DMP. These results suggest that the normal supremacy of the posterior intestinal cells is not obligatory for Ca(2+) wave occurrence but instead helps to coordinate the DMP. Furthermore, we present evidence suggesting that an underlying pacemaker appears to oscillate at a faster frequency than the defecation cycle and that arrhythmia may result from uncoupling the pacemaker from the DMP rather than from disrupting the pacemaker itself. We also show that chronic elevations in Ca(2+) have limited influence on the defecation period but instead alter the interval between successive steps of the DMP. Finally, our results demonstrate that it is possible to assess Ca(2+) dynamics and muscular contractions in a completely unrestrained model organism.