This method provides a way to couple optogenetics and genetically encoded calcium sensors to image baseline cytosolic calcium levels and changes in evoked calcium transients in the body wall muscles of the model organism C. elegans.