Skip to content
Kravitz Lab edited this page Jan 26, 2026 · 1 revision

FED4 Prox (Proximity) Sensor Functionality

The FED4 uses a VL53L1X time-of-flight (ToF) distance sensor on the primary I2C bus (XSHUT on MCP pin 1). Measures approach distance to the nose port.

API

  • initializeToF() — init ToF sensor (called from begin()). Returns true on success.
  • prox() — take a single distance reading. Returns distance in mm (0–150), or -1 on error/timeout.

Details

  • Raw reading is offset by a 20 mm calibration (configurable in code). Values < 0 are clamped to 0; > 150 mm are capped at 150.
  • Used for approach detection (e.g. Pavlovian_Prox) and to exercise the primary I2C bus before secondary use (e.g. in pollSensors()).

See FED4_Prox.cpp. Hardware: SparkFun VL53L1X, SparkFun Arduino library.

Clone this wiki locally