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.
Parameter Specification #
Parameters | Value/Description |
Operating voltage | 3.3V~5V |
Operating temperature | -40°C~+70°C |
Input signal | Digital signal |
Size | 3.16cm*2.38cm |
Wiring Diagram #
Note: Expansion board is attached to esp32 controller board.
Infrared Obstacle Avoidance Sensor | ESP32 |
VCC | 5V |
GND | GND |
Sign | Digital Pin 23 |
Sample Code #
#define PE 23 //Define the pins of the infrared obstacle avoidance sensor
void setup() {
pinMode(PE, INPUT); //Set the infrared obstacle avoidance sensor pin to input mode
Serial.begin(115200); //Initialize baud rate
}
void loop() {
if (digitalRead(PE) == 0) { // Determine whether the infrared obstacle avoidance sensor detects an obstacle
Serial.println("Obstacle detected!");
delay(1000);
}
}
Note: If you are using an Arduino board, then change the pin in the program to PIN7, set the baud rate to 9600, and then connect the hardware pin to PIN7 and upload the program.
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.
Related Resources #
Get One Now #
B2B Business: info@acebott.com