
Building an Infrared Distance Sensor
Measure distance with light. A Sharp infrared sensor bounces a beam off an object and reports, as a voltage, the angle it returns at — closer objects give a higher reading. The Arduino turns that into an approximate distance and lights an LED when something comes near: a touchless switch, a hand-wave trigger, or a robot's eyes. Unlike the ultrasonic sensor, this uses infrared light, works at short range, and makes no sound.
คำแนะนำ
Wire the sensor and LED
Wire the sensor and LED
The Sharp sensor has a 3-wire cable: VCC (red) to Arduino 5V, GND (black) to GND, and signal (white or yellow) to A0. On the breadboard, wire an LED from pin 7 through a 330 Ω resistor to GND (long leg to the pin).
วัสดุสำหรับขั้นตอนนี้:
Arduino Uno R31 ชิ้น
Infrared Proximity Sensor - Sharp GP2Y0A21YK1 ชิ้น
LED - Basic 5mm1 ชิ้น
Resistor 330 Ohm 1/6 Watt PTH - 20 pack1 แพ็ค
Breadboard1 ชิ้น
Jumper Wires (Male-to-Male)1 แพ็คConnect and open the IDE
Connect and open the IDE
Plug the Arduino into your computer with the USB cable, open the Arduino IDE, and select Arduino Uno and its serial port.
วัสดุสำหรับขั้นตอนนี้:
USB-B Cable1 ชิ้นเครื่องมือที่ต้องใช้:
Computer with Arduino IDEUpload the distance sketch
Upload the distance sketch
Paste this sketch and upload, then open the Serial Monitor. It reads the sensor, estimates the distance, and lights the LED when something is within 20 cm.
Test and understand the curve
Test and understand the curve
Open the Serial Monitor and move your hand between about 10 and 80 cm — the printed distance should track it, and the LED lights inside 20 cm. Two things to know: below ~10 cm the reading becomes ambiguous (the sensor's curve folds back), and the output is non-linear, so for real accuracy note the raw value at a few known distances and fit your own curve.
Put it to work
Put it to work
Use it as a touchless switch (wave to trigger), a shelf or drawer 'is-it-open' sensor, or an obstacle detector for a small robot. Change NEAR_CM to set the trigger distance, or swap in the short-range (4–30 cm) or long-range (20–150 cm) Sharp sensor for a different span.
วัสดุ
7- 1 ชิ้น$27.00
- $13.00
- 1 ชิ้น$1.00
- $2.00
- 1 ชิ้น$10.00
- $6.00
เครื่องมือที่จำเป็น
1- ตัวยึดตำแหน่ง
บลูพริ้นท์ที่เกี่ยวข้อง
บลูพริ้นท์เหล่านี้แบ่งปันความรู้ — เทคนิค วัสดุ หรือหลักการ
Related blueprints
Other builds that share materials, tools, or techniques with this one.
CC0 สาธารณสมบัติ
พิมพ์เขียวนี้เผยแพร่ภายใต้ CC0 คุณสามารถคัดลอก แก้ไข แจกจ่าย และใช้งานผลงานนี้เพื่อวัตถุประสงค์ใดก็ได้ โดยไม่ต้องขออนุญาต
สนับสนุนเมกเกอร์โดยซื้อสินค้าผ่านพิมพ์เขียวของพวกเขา ซึ่งพวกเขาจะได้รับ ค่าคอมมิชชันเมกเกอร์ ที่ผู้ขายกำหนด หรือสร้างเวอร์ชันใหม่ของพิมพ์เขียวนี้และรวมเป็นการเชื่อมต่อในพิมพ์เขียวของคุณเพื่อแบ่งรายได้





