Post provided by Yash Sondhi, Hailey Dansby, Angela Nicoletti, Elina Barredo, and Samuel T. Fabian.

Studying animal behaviour or ecology can involve measuring movement patterns of small animals. Observing behaviours like foraging, pollination, circadian activity or predation is laborious because it involves long periods of waiting for the behaviour and triggering a camera or poring over hours of video footage to find the behaviour. Existing automated motion tracking tools for small animals are expensive and unsuitable for field use, or need specific conditions like bright light to work. In this blog post, Yash Sondhi and co-authors discuss their tool “Portable Locomotion Activity Monitor (pLAM)” which enables automated monitoring small animal motion tracking in a cost-effective manner, suitable for lab or field use and can track motion under any light environment.

Patterns of daily circadian activity: diel-niche variation

We often think of butterflies as day-flying and moths as night-flying, but there is a whole range of variation, with some butterflies flying at night, moths flying during the day, and many species active only at dusk or dawn. The motivation for this project was to understand why this variation existed. We needed to measure the exact times and light conditions when each species was active and thus we wanted to design an automated method that could track and quantify when an animal was moving under all light conditions.

Moths fly in the day, in the night, at dawn and dusk. Credit: Yash Sondhi

Open-source automated tracking for insects

The first issue we had to address was that of reliable automatic motion detection. Commercial camera traps and existing methods use motion capture, but they are optimised for larger animals like birds or mammals. They fail to track smaller animals such as insects or spiders. Some commercial solutions do allow tracking smaller animals, but they are expensive, closed-source, bulky and only designed for lab use. We used an open-source software tool called “motion which controls a camera making it constantly take images, saving them temporarily and comparing them. When two consecutive images are sufficiently different, it classifies that as a motion event and can save a video or picture till the motion stops. Motion is customizable and can accommodate varying levels of detection sensitivity. We tested various settings and eventually optimized motion for insect or small animal tracking. 

Motion tracking in the dark

Our next problem was tracking insects in the dark. Camera tracking systems work well in daylight. As it gets darker, humans, cameras and most imaging systems struggle — think of a grainy selfie at night from your phone.
A simple solution is to provide more light, like a bright flash. However, many insects are attracted to light, and it disrupts their natural behaviour. We used infrared light which is often used in wildlife cameras. Infrared light is invisible to most animals, including humans and moths, and is used in many day-to-day gadgets like tv remotes. Camera sensors are usually sensitive to infrared light, but infrared light is a problem for many camera manufactures as it distorts image colour and most manufacturers put an infrared filter to block it out. We used special NOIR cameras that were infrared-sensitive and by illuminating the subjects with bright infrared lights we were able to overcome the problem of tracking in the dark.

Portability and early field tests

The next challenge was doing this in the field. Most existing solutions were bulky, expensive or required a completely controlled lab environment. We decided to use the Raspberry Pi. Created by a non-profit group in the UK that partnered with chip manufacturers to reduce costs, these small devices, about the size of your hand, are essentially fully functional computers that are sold for 40-80 USD (3000-5000 INR). They can do most basic tasks a computer can do, but they are also able to interact with hardware and control lights, cameras, and environmental sensors and have been used often in biological research.

The Pi also has low power consumption and this system can be powered using a portable power bank. Next, was putting these different components together and troubleshooting the device. We conducted early tests in the field in India. After several weeks of testing various lights, motion capture settings and portable power sources, we were able to track a fruit-feeding moth successfully.

We had a prototype of the Portable Locomotion Activity Monitors (pLAM for short).

Benchmarking in the lab and environmental control

COVID put a stop to field testing, but we used that time to benchmark and test the device under a range of conditions. With help from Carlos Ruiz and Pablo Currea we built our own DIY incubator from a beer cooler, and used it to raise moths at a controlled temperature. We used special LED light strips where we could control the brightness and colour of each light using the Raspberry Pis. With this, we could mimic the outdoors and recreate a gradual light environment and then add light pollution to it.

We compared the performance of the pLAM with a 4000 USD commercial infrared beam-based activity detector that fly and mosquito researchers were using to study daily activity. With the help of undergraduate research assistants Nicolas Jo and Brittany Alpizar, and FIU doctoral student Elina Barredo from Matthew DeGennaro’s mosquito lab, we were able to test a range of insects with this commercial infrared beam-based detector and found the data comparable. In some cases the pLAM was even more sensitive than the commercial detector. We also established the size and distance the pLAM could track objects accurately. 

Performance in field tests in Costa Rica

A good season for moths, credit: Akito Kawahara

At this point, COVID cases decreased, and we planned a trip to Costa Rica to test the pLAM. We were lucky enough to collaborate with Pablo Allen at CIEE, Monteverde Costa Rica and test plasms in the field. Our team, my two supervisors Akito Kawahara and Jamie Theobald and two research technicians Hailey Dansby and Amanda Markee, set up 6 activity detectors in the field over 2 weeks at the Estacion Biologica in Monteverde. We faced many challenges: the power kept fluctuating, it was too windy, the trees kept swaying and triggering motion, dealing with too many moths and them flying into our ears; it was a trying but fun experience. After several rounds of troubleshooting and improvisation, we got the devices to work consistently. It was a good season for moths, and we found over 1000 moths at our light screen one night and we were able to measure activity data for about 15 species of moths in 10 days.

Tool development and user-friendly guides

Combining lab and field data, we had more than sufficient evidence that our device worked. However, it took several months to iron out the bugs and with the help of many beta testers across the labs, we improved the device to make it more straightforward for anyone trying to replicate it. The pLAM can be used to take motion-activated videos of animal behaviour, that would otherwise need manual triggering. While such systems exist, most are difficult to use without sufficient programming knowledge or engineering capabilities. We packaged the software and scripts to run the Raspberry Pi as a pre-installed virtual image that has to be cloned onto a micro-Sd card and can be run on a Raspberry Pi with minimal installation. We provide a detailed guide showing users how to install the hardware, software in our publication and created pre-configured setting files for motion so that users could save videos or images for each bout of motion as well as save a text file describing all the motion events. 

The research team at CIEE Monteverde, credit: Hailey Dansby

It is a little sad that in a scientific manuscript paper, we often gloss over all the bits and make science seem linear and straightforward. Science is a lot messier and we often don’t recount the fun and frustrating bits outside of conference talks which makes our papers so much drier and of less interest to more people. We were really happy that MEE had support for blog posts, podcasts, and even multilingual abstracts that could accompany our publication, and hopefully, this story helps reveal the winding path that is science. 

We hope that this method will allow field ecologists to study activity patterns and behaviour more easily and our plans for the device are to use it to study, the effects of light pollution on insects, foraging behaviour and use it for outreach and education to allow students to come up with insect monitoring projects. 

Follow the link below to read the full Methods in Ecology and Evolution article:

Portable Locomotion Activity Monitor (pLAM): A cost-effective setup for robust activity tracking in small animals.