# Distance Sensor (am-5637)

![](https://content.gitbook.com/content/cQgnvayQud3Xf5sZi0wz/blobs/8kzEomgTGukiAsoPNJwb/image)

### Overview

The AndyMark **Time-of-Flight (ToF) Distance Sensor** is a compact, 3.3 V I2C device that measures the distance to nearby objects using precise laser-based time-of-flight technology. It’s designed for short- to mid-range detection where consistent accuracy is important, even with varying surface colors or lighting conditions.

This page covers what the sensor is best suited for and how to get started. For electrical limits, pinout, and mechanical details, see **Specifications**. For sample code in Java and Blocks, along with setup instructions, see **Examples**.

***

#### When to use this sensor

* **Accurate distance measurement** to objects up to \~2 m away.
* **Positioning or alignment** tasks where reliable range feedback is needed.
* Detecting approach or presence with more range than a proximity-only sensor.
* Applications that need consistent readings under different lighting conditions.

***

#### What this sensor is not

* It’s not intended for **long-range scanning** beyond 2 m.
* It does not provide color or shape data—pair with a color sensor if you need object classification.

***

#### Highlights (at a glance)

* **Laser-based time-of-flight** measurement for accuracy and repeatability.
* **Standard I²C interface** (see **Specifications** for address and bus speed).
* Works with 3.3 V robot controllers and microcontrollers.
* **Keyed 4-pin** connector for simple wiring (see **Specifications → Wiring**).
* Example code for fast integration with FTC control systems (see **Examples**).

***

#### Typical integrations

* Position an intake or arm relative to a target object.
* Detect when a game piece is within a shooter or feeder.
* Maintain consistent spacing in autonomous driving.
* Monitor travel distance of moving mechanisms in real time.

***

#### Best-practice tips

* **Mind the minimum range:** Objects closer than \~30 mm may not give valid readings.
* **Mount steadily:** Movement or vibration of the sensor can cause noise in measurements.
* **Avoid obstructions:** Keep the laser path clear for reliable results.
* **Test in the field:** Surfaces with high reflectivity or extreme darkness may require threshold adjustments.
