Our old locomotor tracking
One of my projects is investigating a population of neurones that controls mouse locomotor activity and food intake. In the past I have used either implantable telemetry or IR beam break cages to quantify the mice’s movement. But the telemeters, even when they’re functioning well, don’t give particularly good quantification of mouse locomotor activity, which leaves the beam break cages.
For anyone that doesn’t know, these cages are set up to have a couple of IR beams that cross the cage. Whenever the beam is broken (ie. the mouse gets in the way), this is registered by the computer. It’s quite an effective (although crude) method to quantify mouse activity. And it does so completely non-invasively. However, our current IR beam break cages have a number of drawbacks that make them unattractive:
- They only work with some of the older open cages, and don’t work at all if the mice have any bedding in the cage (it blocks the beams)
- The beam break cages we have available in the facility, which actually belong to one of the other lecturers (although she is happy for us to use them), are a decade or two old and were built by a previous postdoc – as such they have suffered some degradation over the years and only have partial functionality left
Anyone who reads my blog will already know what I’m about to say – with these issues I’ve raised, I decided to try and build my own set of beam break cages.
Setting up beam breaks
Right, so first step was to find some IR LED’s and sensors that I could pair across 20-30 cm of a mouse’s cage. I’ve used things like this in the past, so I know you can detect an IR signal using an LED in the ~900 nm range and a phototransistor (Figure 1A).
Luckily, I had some sat around, so I hooked them up to an Arduino, but could only detect the IR signal up to around 5 cm distance. This is obviously not enough, so after some detective work, I found some “IR Beam Break Sensors” from PiHut (Figure 1B). If those didn’t work, it would require some more complex electrical engineering to make it work. Apparently you need to use modulated signals to be sensitive enough to work over multiple metres.

Fortunately, the IR sensors from PiHut worked a treat, up to about 40 cm, which is more than enough for my purposes. The next issue was how to fix the sensors in a way that they would remain aligned in a pairing across the cage.
Aligning the sensors
For this I turned to my trusted 3D printer. After borrowing an IVC from the animal facility, I figured I could make hanging holders that would hook onto the side ridges (Figure 2).

These worked great, with the only issue that the mice tended to move their bedding around and block the direct beams. A very simple solution to this problem was to use strong neodymium magnets to “pin” the tube/bedding at one end of the cage, out of the way of the sensor beams.
Right, so now I had 2 pairs of sensors successfully attached to each mouse cage, next I needed to actually track the data in some way.
Tracking data using Arduino
It turns out that tallying IR beam crosses is easy peasy using an Arduino. The only annoyance being having to duplicate the code 24 times (ie. 2 sensors each for 12 cages). But, I still need to get the data out of the Arduino. I figured I could either hook up an SD card reader and write the data to a removable card, or hook up to a PC and download the data directly.
As I was already connecting the Arduino to my laptop, I tried that first. A little Google sleuthing found me an open source (ie. free) “terminal” program, that will happily log data that comes in over a “COM” port, such as is used by the Arduino. It was actually really easy to set up, and will log the IR beam break data in a CSV (comma separated values) format, that can be directly opened by Excel.
For ease of later data analysis, I made the program log the data in 10 second intervals. However, it will be easy to change that depending on the experimental paradigm eg. 1 or even 10 minute intervals for longer term studies over days or weeks.
Just to prove how well the system works, you can see a massive increase in activity following injection of caffeine (Figure 3A). You also get fantastic circadian activity if you record for longer time periods (Figure 3B).

Where to get it from
As always, I am making this system available on my shop, far cheaper than any commercially available system. Obviously I’ll include a copy of the data logging software with instructions of how to use it. Anyone who wants to measure mouse locomotor activity easily and cheaply, check it out.
Edit 5/5/22: I have now uploaded details of how to make this kit to Hackaday, so head over there if you want to try and build it yourself.