First, the previous figure:
Accessories used:
1. Main Character: Raspberry Pi
2. secondary role: Infrared Detection
3. Miscellaneous: bread, DuPont wire, buzzer, led, resistor
The infrared detection has three pins. The power supply at both ends and the signal output in the middle directly connect the signal to a gpio of Raspberry Pi.
Note that the infrared detection has two adjusting knob, one adjusting the sensing distance and the other adjusting the sensing time:
Adjust the clockwise rotation of the distance potentiometer to increase the induction distance (about 7 meters). Conversely, the induction distance is reduced (about 3 meters ).
The adjustable delay potentiometer rotates clockwise and the induction delay is prolonged (about 300 s). Conversely, the induction delay is shortened (about 5 S ). Circuit diagram: In order to test, I connected an LED on Raspberry Pi and mounted a buzzer. I detected that the output of the infrared output port was high. Then, the LED was lit and the buzzer simultaneously tweeted. Okay, so that we can turn on the warning light when people are approaching, send a warning, and close it when they leave. The code is very simple, so it will not be able to go. If there is input, it will be output.
Raspberry Pi tossing-Infrared Detection