KY-010 Photo Interrupter Module and Raspberry Pi

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

 

Parts List

Namelink
Raspberry Pi3Raspberry Pi 3 Model B With WiFi & Bluetooth
37 sensor kit37 IN 1 SENSOR KITS FOR ARDUINO HIGH-QUALITY FREE SHIPPING (Works with Official for Arduino Boards)
connecting wireFree shipping Dupont line 120pcs 20cm male to male + male to female and female to female jumper wire

 

Layout

We use pin 40 (GPIO 21) in this example, you can use another GPIO pin.

KY-010 moduleRaspberry Pi
– (left)GND
middle+3v3
S (right)Pin 40
pi and ky-010 layout
pi and ky-010 layout

 

pi and ky-010 schematic
pi and ky-010 schematic

 

Code Examples

Download

code on github