Introduction
This proximity sensor measures reflected infrared(IR) energy to detect the presence of an object within a distance of 10±5mm to 80±20mm. It outputs high/low and has the advantages of strong anti-interference ability, quick response and small size. So this module can be easily embedded in various detection devices like automatic hand washers, smart taps, smart toilets, smart restrooms, and object proximity switches.
In addition, the sensor includes a housing with mounting holes, which allows users to design proper installation for it to ensure waterproofing when applied to scenarios in which it's likely to contact water, such as smart taps and automatic hand washers.
Specification
Operating Voltage: 5V
Operating Current: <30mA within the sensing range; <25mA outside the sensing range
Power: <100mW within the sensing range; <75mW outside the sensing range
Sensing Time: 100µs Ta=25℃
Sensing Range: 10±5 - 80±20mm
Operating Temperature: -20℃ - 75℃
Storage Temperature: -20℃ - 85℃
Service Life: 50000h
Operating Humidity: less than 70%
Pinout
Color | Name | Description |
---|---|---|
Red | VCC | Power + |
Black | GND | Power - |
Green | OUT | Signal Output |
Dimension Diagram
Tutorial
Requirements
Hardware
- DFRduino UNO R3 (or similar) × 1
- Infrared Proximity Sensor × 1
- Wires
Software
Connection Diagram
Sample Code
int led = 13; // Pin 13 has an LED connected on most Arduino boards.
int sensor = 8;
void setup() {
pinMode(led, OUTPUT); // Initialize the digital pin as an output.
pinMode(sensor, INPUT);
digitalWrite(led, LOW);
}
void loop() {
int val = digitalRead(sensor);
if (val)
{
digitalWrite(led, HIGH);
}
else
{
digitalWrite(led, LOW);
}
}
Result
When the detected object is in the detection range of the sensor, the LED corresponding to pin 13 of the UNO board lights up; when it's outside the detection range, the LED goes out.
FAQ
For any questions, advice or cool ideas to share, please visit the DFRobot Forum.