IR Sensor (Proximity / Obstacle)

An Infrared (IR) Proximity Sensor detects obstacles and surface reflectivity.

Sensors11 blocksMicroPythonC++
IR Sensor

At a glance

Pins and properties exactly as the circuit editor and simulator define this part. The text below explains how to use them.

Pinout

Pinout of the IR Sensor, drawn as in the circuit editor. Select a label to see that pin in the table below.

Pins

Pins of this part
PinLabelType
DOOUTSignal out
GNDGNDGround
VCCVCCPower in
AOAOAnalog out

Properties

What you can change in the Property Inspector.

Properties of this part
PropertyRange or choicesDefault
Sensitivity0 to 1023512
Distance2 to 30 cm15 cm

An Infrared (IR) Proximity Sensor detects obstacles and surface reflectivity. It features an IR emitter LED (transmits light) and an IR photodiode receiver (reads reflected light). In Open Maker Studio, this sensor is used for collision detection, line-following robots, and non-contact limit switches.


1. Hardware Specifications & Pinout

  • Operating Voltage: 3.3V to 5.0V.
  • Detection Cone: 44° total (22° half-angle), from 2cm to 30cm depending on Sensitivity.
  • Output Signal:
    • Digital Out (DO): Active-LOW (outputs LOW when an obstacle is detected, HIGH when clear).
    • Analog Out (AO): Outputs a variable voltage corresponding to proximity — lower voltage means the object is closer.
  • Pin Configuration:
    • VCC: Connect to 3.3V or 5V.
    • GND: Common Ground.
    • DO: Connect to digital input.
    • AO: Connect to ADC pin.

2. How it Works (Theory & Calibration)

  • Active Reflection: The IR emitter constantly outputs infrared light. When an object comes close, it reflects the IR light back to the photodiode. The photodiode's resistance drops, causing the AO voltage to shift.
  • Line Following (Surface Contrast) — real-world background, not simulated by OMS: on real hardware, a bright/white surface reflects more IR than a dark/black one at the same distance, which is how line-following robots use this sensor. OMS only models distance and detection angle — there's no surface-color/reflectivity property in the simulated component, so you can't demonstrate the bright-vs-dark-surface difference in the Circuit Canvas today, only the distance-based obstacle-detection behavior.
  • Onboard Potentiometer: Adjusts the comparator threshold for the digital output trigger distance (2cm to 30cm) — modeled in OMS as the real sensitivity property (Section 3).

3. Component Properties (Property Inspector)

When you select the IR Sensor on the canvas, you can modify the following parameters in the Property Inspector panel:

  • Sensitivity (sensitivity): Sets the detection range.
    • Default: 512
    • Range: 0 to 1023 (maps to 2cm–30cm of real detection distance)
  • Distance (distance): How far the obstacle currently is from the sensor face.
    • Default: 15 cm
    • Range: 2 cm to 30 cm

There's no "Obstacle Proximity %" or "Threshold Voltage" property — the real interaction is dragging an obstacle ("wall") object on the canvas to a real distance within a real 44° cone (Section 6), not setting an abstract percentage or a fixed comparator voltage.


4. Supported Blockly Blocks

Drawing the blocks…

5. Simulator Behavior

  • Drag the Obstacle, Not a Slider: OMS models this with real geometry — drag the "wall" object drawn on the canvas into or out of the visible 44° detection cone. Real distance/angle math decides whether it's actually within range (using the Sensitivity-derived max range, 2cm–30cm), the same interaction pattern as the PIR Motion Sensor (Section 5.5).
  • Analog Output Modeling: AO's voltage divider is modeled so that a closer object gives a lower voltage (more reflected light conducts the phototransistor harder, pulling AO toward GND) — matching the polarity every Blockly analog block above already assumes.
IR Sensor (Proximity / Obstacle) — OMS Parts