Close
0%
0%

Rodent Arena Tracker (RAT)

A low-cost system to track and report mouse activity while they are contained in simple arenas.

Similar projects worth following
RAT is a low-cost system to track and report mouse activity while they are contained in a simple arena. The system uses an OpenMV M7 microcontroller to acquire images of the arena and process them in real-time to report mouse centroid data to a text file. This data can be used as a measure of mouse movement (i.e speed and distance traveled) for various activity studies. This project is currently ongoing as we test and perfect the prototypes.

Project Goals:

  • Low-cost rodent monitoring system
  • Tolerance for different room lighting conditions
  • Centroid tracking
  • Standalone device (i.e. does not require additional dedicated hardware)
  • Battery powered option (for up to 1 day)

Constraints:

  • Currently supports tracking for only a single rodent
  • Designed for rodents with black fur
  • White or light colored arena floor/bedding to provide adequate contrast with rodent
  • Requires mounting solution if used with an arena other than the one RAT was designed for
  • Currently supports image acquisition and real-time processing at a rate of 15 fps

Hardware:

RAT is designed to be used with simple open arenas. A separate mounting solution may be required if the device is used with an arena other than the one it was designed for. The device attaches to the lid of the arena using a custom 3d printed bracket. The unit can be powered either with a 5V wired power adapter (via the micro usb port on the OpenMV Cam M7) or with a 5V rechargeable battery via the battery port on the expansion board. 

Methods:

RAT acquires and processes images in real-time using an OpenMV Cam M7 microcontroller. Data is exported to a text file on an attached SD card and real-time feedback is provided via a LCD screen. Near-IR LED illumination is used for experiments and rooms without adequate lighting. Segmentation and centroid processing is accomplished using a combination of thresholds, size filtering, and connected component analysis. The processing for each frame follows the below procedure:

  1. An image is acquired and saved to a frame buffer
  2. The current image is segmented using a set of predefined thresholds
  3. Detected blobs in the image are filtered based on a maximum size threshold and the centroid information for the largest valid blob is retained as mouse data
  4. A mouse speed value is computed using the difference in position between the current and previous image
  5. A feedback image is displayed on the LCD screen including:
    1. A yellow cross painted on the mouse centroid
    2. Mouse centroid and speed values at the bottom of the screen
    3. The name of the text file at the top of the screen
  6. Mouse centroid data is outputted to a text file including a timestamp, centroid values, and computed speed value


Team:

This project was developed by John Krynitsky (coding and hardware) and Lex Kravitz (testing) with input from Ghadi Salem, Marcial Garmendia-Cedillos, and Tom Pohida.

Funding and Terms:

This project was conceived by a team of researchers at the National Institutes of Health (NIH)  and funded by the NIH Intramural Research Program (NIDDK and CIT).

This project is released under the terms of the Creative Commons - Attribution - ShareAlike 3.0 license: 

Human readable: https://creativecommons.org/licenses/by-sa/3.0/ 

Legal wording: https://creativecommons.org/licenses/by-sa/3.0/legalcode

This project uses the excellent OpenMV Cam M7 hardware and screen shield:

py - 386.00 bytes - 04/29/2019 at 17:40

Download

RAT_main.py

RAT main function for OpenMV IDE

py - 3.53 kB - 04/26/2019 at 19:58

Download

RAT_breakout.sch

RAT PCB Eagle schematic

sch - 18.74 kB - 03/21/2019 at 20:01

See BOM
Download

RAT_breakout.brd

RAT PCB Eagle board design file

brd - 20.11 kB - 03/21/2019 at 20:01

Download

RAT_enclosure_bot_withMount.STL

RAT Enclosure Base with camera tripod mount (1/4-20 thread size)

Standard Tesselated Geometry - 8.46 MB - 03/21/2019 at 19:58

Download

View all 6 files

  • 1 × OpenMV Cam M7 Small, low power, microcontroller board containing GPIO pins, RGB LED, micro SD card slot, and OV7725 image sensor.
  • 1 × LCD Shield A small LCD screen that pairs with the OpenMV Cam M7
  • 1 × 3D Printed Enclosure
  • 1 × Breakout PCB
  • 1 × JST Right-Angle Connector

View all 10 components

  • Validation using Bonsai for video tracking

    Lex Kravitz04/12/2019 at 23:00 0 comments

    We validated RAT's video tracking ability with an amazing piece of software called Bonsai.  Bonsai is a visual programming language that can do many things, including fast video manipulations and object tracking.  If you haven't seen Bonsai yet you should check it out!

    Our setup recorded the mouse with both a webcam (streaming into Bonsai) and the RAT:

    We exported the X and Y position of the mouse from both systems and looked at how the data lined up (spoiler: incredibly well).  Shown below are correlations of X and Y position from the two systems, plus 3 minutes of X and Y tracking data.  

    Conclusion?  The RAT is good for mice!  

  • Video assembly and instructions

    Lex Kravitz03/29/2019 at 21:01 0 comments

    We recorded a quick video showing how to assemble and use the RAT:

  • PCB!

    Lex Kravitz03/20/2019 at 03:00 0 comments

    We made a simple PCB that includes a LiPo battery connector, a button for resetting the RAT, and a programmable BNC output that can be set to export speed, test pulses, or even when the animal enters a specific part of the arena, for a real-time-place-preference experiment:

  • Updated the camera housing

    Lex Kravitz03/20/2019 at 02:58 0 comments

    We made a new housing for the camera, complete with a 3D printed tripod thread.  It works great!

  • Hello Tracking World!

    Lex Kravitz11/29/2018 at 23:50 0 comments

    Jonathan finished the first version of the code and we were able to test with a mouse.  The OpenMV cam does a great job in this application.  We are easily able to track mice in both light and dark (thanks to the onboard IR LEDs), and calculate X, Y, and speed in realtime.  Currently these are written to the screen, and to a log file on the SD card, but we are designing a shield for the OpenMV cam that will allow them to be recorded as voltage signals in near-real time.

    Video of RAMS in action:

View all 5 project logs

  • 1
    Assemble Breakout PCB

    Assemble the breakout PCB by soldering the tactile button, right-angle BNC connector, JST right-angle connector, and both 8 pin headers to the top of the board. Both sets of right-angle connectors should face away from the center of the PCB. 

  • 2
    ​Assemble the OpenMV Cam M7

    Assemble the OpenMV Cam M7 by soldering the included headers to the device such that the female end faces away from the side with the lens. The male end of the headers should be trimmed using wire cutters so that they do not exceed the height of other components on the OpenMV Cam M7’s PCB. 

  • 3
    Mount OpenMV Cam M7

    Begin the RAT assembly by mounting the OpenMV Cam M7 in the bottom of the 3D printed enclosure. The lens will fit through the square opening at the bottom of the enclosure and the two mounting holes on either side of the OpenMV Cam M7 will align with their counterparts on the 3D printed enclosure. 

View all 12 instructions

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates