1.Product Introduction
The infrared obstacle avoidance sensor transmits infrared light through a transmitter, and detects the change in the amount of light reflected by the detection object or blocked by the receiver to obtain an output signal.
The working principle of infrared obstacle avoidance sensor is based on the photoelectric effect, which converts photon energy into electron energy. Infrared obstacle avoidance sensor mainly includes light source, receiver, signal processing circuit and other parts. Among them, the light source is mainly used to irradiate the object to be detected with a certain light intensity, and the receiver receives the light signal reflected, transmitted, scattered or emitted from the object to be detected through the photosensitive element, and converts it into an electrical signal. Finally, the signal processing circuit amplifies, filters, compares and counts the electrical signal to realize the detection and control of the object.
Application reference: Automatic doors, elevators, security systems, etc.
2.Parameter Specification
Parameter | Value/Representation |
---|---|
Operating voltage | 3.3~5V |
Operating temperature | -40°C~+70°C |
Input signal | Digital signal |
Size | 3.16cm*2.38cm |
3.Wiring Diagram
Hint
Expansion board is attached to esp32 controller board.
Infrared Obstacle Avoidance Sensor | ESP32 |
---|---|
VCC | 5V |
GND | GND |
Sign | Digital Pin 23 |
4.Sample Code
1#define PE 23 //Define the pins of the infrared obstacle avoidance sensor
2
3void setup() {
4
5 pinMode(PE, INPUT); //Set the infrared obstacle avoidance sensor pin to input mode
6 Serial.begin(115200); //Initialize baud rate
7}
8
9void loop() {
10 if (digitalRead(PE) == 0) { // Detects whether the infrared obstacle avoidance sensor detects an obstacle
11 Serial.println("Obstacle detected!");
12 delay(1000);
13 }
14
15}
5.Test Result
After you have successfully connected the circuits according to the wiring diagram and successfully uploaded the correct program, the serial monitor will output “Obstacle detected!” when it detects a person or obstacle approaching.
6.Related Resources
7.Get One Now
B2B Business: info@acebott.com