ArduinoStudio

Proximity Sensor

Measures distance to nearby objects using infrared or ultrasonic sensing.

Overview

Proximity sensors detect how far an object is from the sensor. ArduinoStudio supports two main types: infrared (Sharp GP2Y0A21YK) and ultrasonic (HC-SR04, MB1000). They emit sensor-data events with distance readings and can trigger actions when an object crosses a configurable threshold distance.

Supported Sensors

SensorTypeRangeInterface
GP2Y0A21YKInfrared10 – 80cmAnalog
HC-SR04Ultrasonic2 – 400cmDigital (Trig/Echo)
MB1000Ultrasonic20 – 765cmAnalog / PWM

Wiring Guide

GP2Y0A21YK (Infrared)

Sensor PinArduino Pin
VCC (red)5V
GND (black)GND
Vo (yellow)Analog pin (A0–A5)

HC-SR04 (Ultrasonic)

Sensor PinArduino Pin
VCC5V
GNDGND
TrigAny digital pin
EchoAny digital pin

Usage in ArduinoStudio

Drag the Proximity component onto the canvas. Select the sensor model and assign the appropriate pins. The component continuously reads distance and emits sensor-data events. You can set a threshold distance to trigger actions — for example, stop a robot when it gets within 15cm of a wall.

← Back to Components