DIY Mouse Odometer: Build a Simple Tracker for Lab Experiments
This guide shows a straightforward, low-cost way to build a mouse odometer to measure movement distance and activity in small-animal lab experiments. It covers materials, assembly, calibration, data collection, and basic analysis so you can start recording reliable locomotion metrics quickly.
Materials (per rig)
- Microcontroller: Arduino Nano or equivalent
- Sensor: Optical flow sensor module (e.g., ADNS-3080/ADNS-9800) or a low-cost optical mouse sensor breakout
- Mounting: 3D-printed or laser-cut holder to fix sensor under arena floor
- Arena floor: Thin, non-reflective surface (cardboard/plastic) with a small window or transparent insert for the sensor
- Power & I/O: USB cable, jumper wires, breadboard or soldered connections
- Storage/Interface: MicroSD breakout or serial connection to PC for logging
- Optional: Real-time clock (RTC) for timestamping, small fan to control temperature, enclosure
How it works (brief)
An optical flow sensor (the same technology used in optical mice) measures surface displacement by analyzing successive images of the surface beneath it. By converting pixel displacement to physical distance (via calibration), you get an odometer reading: cumulative distance traveled by the animal over time.
Assembly steps
- Prepare arena floor: Cut a small window (~10–15 mm) below the center of the arena where the sensor will view the surface. Cover window with thin transparent material if needed to protect the sensor.
- Mount sensor: Secure the optical sensor in a holder so its lens is ~3–10 mm beneath the arena floor (manufacturer specs vary). Ensure the sensor is centered under the arena and fixed to avoid movement artifacts.
- Wire up microcontroller: Connect sensor SPI/MISO/MOSI/SCLK + CS + power + ground to the Arduino Nano. If using a mouse sensor breakout, follow its pinout.
- Add storage/interface: Connect microSD module (SPI) or prepare serial-over-USB logging to your PC. Add RTC if timestamps are required.
- Power and enclosure: Route cables so they don’t restrict animal movement. Enclose electronics to prevent chewing and contamination.
Firmware (core logic)
- Initialize sensor and SPI interface.
- Sample displacement at a fixed frequency (e.g., 50–100 Hz).
- Read delta_x and deltay per sample, convert to pixel units.
- Accumulate displacement: distance += sqrt((dxscale)^2 + (dy * scale)^2).
- Log timestamped cumulative distance to SD or stream to PC.
Example Arduino pseudocode:
cpp
// Initialize sensor // loop: // read dx, dy // float dx_mm = dx * mm_per_pixel; // float dy_mm = dy * mm_per_pixel; // total += sqrt(dx_mm*dx_mm + dy_mm*dy_mm); // log(time, total);
Calibration
- Determine mm per pixel: Move the sensor or a printed grid under the arena a known distance (e.g., 10 mm) and count total pixels reported by the sensor. mm_per_pixel = known_mm / pixels_moved.
- Surface consistency: Use a uniform, matte surface—variations change sensor readings. Print a high-contrast textured pattern if natural bedding is too variable.
- Test linearity: Move known distances across multiple ranges (1–100 mm) to confirm linear scaling; compute correction factor if needed.
- Temperature/humidity checks: Run calibration at conditions similar to experiments.
Data collection protocol
- Start logging after a short warm-up period (sensor stabilization).
- Record at fixed sampling rate and store raw dx/dy plus cumulative distance.
- Include metadata: animal ID, trial ID, arena surface, sensor height, calibration factor, sampling rate.
- Run control trials (empty arena) to measure baseline noise.
Basic analysis
- Compute total distance, average speed, path tortuosity, and bout detection (movement vs rest).
- Smooth noisy dx/dy with a short moving average before integrating.
- Detect artifacts: sudden large jumps may indicate sensor slip or obstruction—exclude or correct.
- Visualize tracks by integrating dx/dy into x,y positions and plotting trajectory heatmaps or line traces.
Troubleshooting
- No movement detected: Check sensor height, wiring, and lighting. Optical sensors require adequate texture/contrast.
- Excessive noise: Lower sampling rate, add smoothing, ensure secure mounting, and avoid reflective surfaces.
- Drift: Reset cumulative integration periodically and use control trials to characterize drift; consider hardware with motion compensation.
Validation & ethics
- Validate odometer readings against a ground-truth method (video tracking with calibrated scale) before using for experimental conclusions.
- Ensure animal welfare: avoid obstructing movement, prevent chewing access to electronics, and follow institutional animal care protocols.
Cost and scalability
- Estimated cost per rig: \(25–\)120 depending on sensor quality and storage options.
- For multiple arenas, replicate sensors and use a single PC to collect serial streams or swap microSD cards between trials.
Leave a Reply