KY-010 Photo Interrupter module Arduino Circuit



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

This module is capable of interfacing with popular electronic platforms like Arduino, ESP32, Raspberry Pi, and other microcontrollers. that will activate when the sensor is interrupted.

Hardware Required

You will require the following Hardware Components for the Interfacing of the KY-010 Photo Interrupter module with arduino.

Components#Buy From Amazon
Arduino UNO1Buy Link
KY-010 Photo Interrupter module1Buy Link
Jumper WiresBuy Link
Breadboard1Buy Link

What is a KY-010 Photo Interrupter module?

A KY-010 Photo Interrupter module is an optical sensor that is used to detect the presence or absence of an object. It consists of an infrared LED and a phototransistor that are positioned opposite each other in a small package. The LED emits infrared light and the phototransistor detects this light. When an object passes between the LED and the phototransistor, the light is blocked, and the phototransistor’s output changes, indicating that an object has been detected.



This module contains 3 male header pins and an optical emitter/detector on the front side. and on the back side a 1kΩ resistor and 33Ω resistor.

The sensor uses a ray of light between the emitter and detector to scan if the way between both is existing intercepted by an opaque object.

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



Pin Configuration

Pin NamePin Type
S (right)Signal Pin
middle PinVcc (+5)
– (left)Ground

Circuit Diagram

The following circuit shows you the connection of the KY-010 Photo Interrupter module with Arduino Please make the connection carefully


Circuit Connections

Place the module on the BreadBoard then connect the ground (left) pin and power line (middle) pin of the module to the GND pin and +5V pin of the arduino and the signal (S) of the module to pin 3 of the arduino respectively.

Pin 3S (right)
GND– (left)

Installing Arduino IDE Software

First, you will require to Download the updated version of Arduino IDE Software and Install it on your PC or laptop. if you Learn How to install the Arduino step-by-step guide then click on how to install Arduino Button given Blow


The following arduino code will turn on the LED placed on the (pin 13) of the Arduino when there is an object intercepting the path between the sensor’s hole.

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 


Applications of the KY-010 Photo Interrupter module include:

  1. Object detection: The KY-010 Photo Interrupter can be used to detect the presence of an object in a certain area, such as a conveyor belt or a printing press.
  2. Counting objects: By using multiple KY-010 Photo Interrupters in a row, it is possible to count the number of objects that pass through a particular area.
  3. Speed measurement: By measuring the time it takes for an object to pass through a KY-010 Photo Interrupter, the speed of the object can be determined.
  4. Position detection: By measuring the position of an object with respect to the KY-010 Photo Interrupter, the position of the object can be determined.
  5. Optical switching: The KY-010 Photo Interrupter can be used as a switch, with the LED and phototransistor being connected in a switch configuration. When an object is present, the switch is closed, and when it is absent, the switch is open.

Downloads Files

  • The KY-010 Photo Interrupter module Fritzing Part:
  • Optical emitter/detector Datasheet:

Leave a Comment