Close

Validating the PIR sensor for detecting movement inside of a mouse cage

A project log for RAD (Rodent Activity Detector)

Using a passive infrared sensor and a datalogger to record activity patterns from rodent home cages

Lex KravitzLex Kravitz 09/09/2018 at 17:110 Comments

We used a low--power PIR sensor to detect animal movement.  This sensor returns nice looking data when mounted in a mouse cage, for example we can see a nice circadian rhythm in daily activity.  See 1 month of activity data here - note the cyclical rhythm that shows more activity each night, and less during the daytime (mice are nocturnal):

While this data showed us that the PIR was detecting biological variance in activity, we wanted to calibrate what exactly was being detected by the sensor. We set up an experiment where we put the PIR next to a video camera, and recorded 4 mice this way for 24 hours.  We then ran the video through a commercial motion tracking software (Noldus Ethovision) to understand what the sensor was correlated with.  

We evaluated the data in 1 second, 10 second, 30 second, and 5-minute bins, and learned that the PIR correlated extremely well with total distance moved (as assayed by video analysis) at long bin widths, but not so much at the 1 second bin width.  Our conclusion is that the PIR is very useful for measuring gross changes in movement, such as those that occur across minutes, but is not so great at returning second-by-second changes in movement.  This is fine for our purposes, and good to know.

We then used a machine learning classifier (also part of Ethovision) to classify movement into Walking, Resting, Grooming, Rearing, Sniffing, and Digging.  At a 10 second bin width, the time identified as "Walking" correlated well with how long the PIR was on (R2=0.61), while all other R2 were below 0.2. This indicates that the PIR captures locomotion from place to place, but not "in place" actions such as grooming and digging.  

To more explicitly test this idea, we bought a small robot from Adafruit and programmed it to move back and forth at a constant speed (~6inches/sec), but make movements of different lengths between 0.1 and 1.0 inches.  We mounted an IR LED on top of the robot to make sure it activated the PIR sensor.

With this test, we confirmed that only movements that displaced the robot >0.3inches triggered the PIR.  Small vigorous movements in place did not.  This test was consistent with our results from video analysis of mice, in which locomotion triggered the sensor, grooming did not.


Discussions