# Measuring distance/proximity

#### If you need to quantify distance:

<details id="bkmrk-sharp-2y0a02%2C-ir-sen"><summary>SHARP 2Y0A02, IR sensor (λ = 850 ± 70nm)</summary>

##### At-a-glance useful details:

- Sensing range: 20 - 150 cm
- Power requirements: 4.5 - 5.5 V (typ current consumption = 33mA)
- ##### [link to datasheet](https://mm.digikey.com/Volume0/opasdata/d220001/medias/docus/1/GP2Y0A02YK0F.pdf)
- Output voltage ***is not linear with distance; see plot below (from datasheet, linked above)***
- [![{8D5D58AC-AA88-469C-8E14-8B48FF36A4EF}.png](https://itll-wiki.colorado.edu/bookstack/uploads/images/gallery/2025-12/scaled-1680-/KhBLI110GKIugMh2-8d5d58ac-aa88-469c-8e14-8b48ff36a4ef.png)](https://itll-wiki.colorado.edu/bookstack/uploads/images/gallery/2025-12/KhBLI110GKIugMh2-8d5d58ac-aa88-469c-8e14-8b48ff36a4ef.png)

[![{54C81708-A400-4B9E-AF00-ADA567605335}.png](https://itll-wiki.colorado.edu/bookstack/uploads/images/gallery/2025-12/scaled-1680-/RHFMUCY2xDDhYmj6-54c81708-a400-4b9e-af00-ada567605335.png)](https://itll-wiki.colorado.edu/bookstack/uploads/images/gallery/2025-12/RHFMUCY2xDDhYmj6-54c81708-a400-4b9e-af00-ada567605335.png)

[![{71064E72-9B44-41D5-8E68-45F4EB5E22A0}.png](https://itll-wiki.colorado.edu/bookstack/uploads/images/gallery/2025-12/scaled-1680-/YqyR5GH4g6DBPeoB-71064e72-9b44-41d5-8e68-45f4eb5e22a0.png)](https://itll-wiki.colorado.edu/bookstack/uploads/images/gallery/2025-12/YqyR5GH4g6DBPeoB-71064e72-9b44-41d5-8e68-45f4eb5e22a0.png)

</details><details id="bkmrk-ultrasonic-sensor-%28h"><summary>Ultrasonic Sensor (HC-SR04)</summary>

[![image.png](https://itll-wiki.colorado.edu/bookstack/uploads/images/gallery/2026-04/scaled-1680-/AHOe22zi3F5TGZV5-image.png)](https://itll-wiki.colorado.edu/bookstack/uploads/images/gallery/2026-04/AHOe22zi3F5TGZV5-image.png)

These sensors can detect objects within a range of 2 cm - 4 m with a ranging accuracy of up to 3mm. One thing to note is that they have a measure angle of 15 degrees, so they do well at measuring objects directly in front of the sensor. For most applications, this is favorable.

Helpful resource from Sparkfun with example code, and wiring diagram: [https://www.sparkfun.com/ultrasonic-distance-sensor-hc-sr04.html](https://www.sparkfun.com/ultrasonic-distance-sensor-hc-sr04.html)

</details>####  

#### If you just need to know if an object is present or not:

#####  (e.g., detecting fan speed, motion detector, etc.)

<details id="bkmrk-hall-sensor-%28ah1815%2C"><summary>Hall Sensor (AH1815, from Treston)</summary>

</details>