Digital IR Proximity Sensor(0-200cm) Wiki - DFRobot

Introduction

This is a digital IR Proximity Sensor with on-board button and indicator. It provides adjustable detection distance within 0 to 200cm and comes with real-time status feedback. Press down the button, then the indicator starts to flash, this time the detection distance can be adjusted. The sensor will auto detect and save the distance between it and obstacle ahead. In addition, this sensor is equipped with 3PIN data cable (digital signal output) that can be directly plugged into Arduino IO expansion board. The product can be widely used in applications like smart home, house security, intelligent detection and control, robot obstacle, and so on.
The sensor is based on the principle of diffuse reflection of IR light on objects. When a person or object enters the sensing range in front of the sensor, the sensor immediately determines that there is induction, so as to control the output signal; after the person or object leaves the sensing range, it will judge that there is no induction, and stop signal output, by which intelligent control can be achieved.

Specification

Board Overview

Board Overview

Num Label Description
1 Output Sensor Singal Output
2 VCC Positive
3 GND Negative

Dimensional Drawing

Dimensional

Tutorial

Requirements

Connection Diagram

Connection Diagram

Sensor Detection Distance Adjustment

The sensor will start to work when powered on. Place an object of size 80x60cm at the 80cm(or smaller) in front of the sensor, adjust its detection distance as shown below:

Press down the button, the red LED indicator begins to flash, then it enters auto detection distance adjustment mode.

Detection Distance Adjustment

Sample Code

/*!
 * @File  infraredApproachSensor.ino
 * @brief  Detect the status of IO4 and print it in serial port
 * @copyright  Copyright (c) 2010 DFRobot Co.Ltd (http://www.dfrobot.com)
 * @licence  The MIT License (MIT)
 * @author  [liunian](nian.liu@dfrobot.com)
 * @version  V1.0
 * @date  2020-08-20
 */
int  OUT = 4;
int  i = 0;
void setup()
{
  Serial.begin(9600);
  pinMode(OUT, INPUT);
}
void loop()
{
   i = digitalRead (OUT);
   Serial.println(i);
   delay(5);
}

Expected Results

Read the status of IO4. When the sensor detected an object, serial print 1, otherwise, print 0.

Result

FAQ

For any questions, advice or cool ideas to share, please visit the DFRobot Forum.

More Documents