In this example we take a look at the KY-010 Photo Interrupter Module and connect this to a Raspberry Pi.
The sensor uses a beam of light between the emitter and the detector to check if the path between both is being blocked by an object
|Raspberry Pi 4||Aliexpress product link|
|37 sensor kit||AliExpress Product link|
|connecting wire||Aliexpress product link|
We use pin 40 (GPIO 21) in this example, you can use another GPIO pin.
|KY-010 module||Raspberry Pi|
|S (right)||Pin 40|