Automation of simple behavioral patterns, such as locomotor activity, is fundamental for pharmacological and genetic screening studies. Recently, circadian behaviors in locomotor activity and stress responses were reported in the nematode Caenorhabditis elegans, a well-known model in genetics and developmental studies. Here we present a new method for long-term recordings of C. elegans (as well as other similar-sized animals) locomotor activity based on an infrared microbeam scattering. Individual nematodes were cultured in a 96-well microtiter plate; we tested L15, CeMM and E. coli liquid cultures in long-term activity tracking experiments, and found CeMM to be the optimal medium. Treatment with 0.2% azide caused an immediate decrease in locomotor activity as recorded with our system. In addition to the validation of the method (including hardware and software details), we report its application in chronobiological studies. Circadian rhythms in animals entrained to light-dark and constant dark conditions (n=48 and 96 worms, respectively) at 16 degrees C, were analyzed by LS periodograms. We obtained a 24.2+/-0.44 h period (52% of significantly rhythmic animals) in LD, and a 23.1+/-0.40 h period (37.5% of significantly rhythmic animals) under DD. The system is automateable using microcontrollers, of low-cost construction and highly reproducible.