KY-010 Photo Interrupter Module

The KY-010 Photo Interrupter module is a switch that will trigger a signal when light between the sensor’s gap is blocked.

This module is suitable for various electronics platforms like Arduino, Raspberry Pi, ESP32 and others.

KY-010 Fritzing custom part image
KEYES KY-010 Photo interrupter module for arduino

KY-010 Specifications

This module consists of an optical emitter/detector and 3 male header pins on the front. On the back there are two resistors of 1kΩ and 33Ω.

The sensor uses a beam of light between the emitter and detector to check if the path between both is being blocked by an opaque object.

Operating Voltage3.3V ~ 5V
Board Dimensions 18.5mm x 15mm [0.728in x 0.591in]

Connection Diagram

Connect the power line (middle) and ground (left) to +5V and GND respectively. Connect signal (S) to pin 3 on the Arduino.

KY-010Arduino
– (left)GND
middle+5V
S (right)Pin 3
Arduino KY-010 connection diagram

KY-010 Arduino Code

The following sketch will light up the LED (pin 13) on the Arduino when there’s an object blocking the path between the sensor’s gap.

int Led = 13; // define LED pin
int buttonpin = 3; // define photo interrupter signal pin
int val; //define a numeric variable
void setup()
{
	pinMode(Led, OUTPUT); // LED pin as output
	pinMode(buttonpin, INPUT); //photo interrupter pin as input
}
void loop()
{
	val=digitalRead(buttonpin); //read the value of the sensor 
	if(val == HIGH) // turn on LED when sensor is blocked 
	{
		digitalWrite(Led,HIGH);
	}
	else
	{
		digitalWrite(Led,LOW);
	}
}

Downloads

KY-010 Related Products

Hot Deals from AliExpress

Leave a Comment


1 thought on “KY-010 Photo Interrupter Module”