Arduino Photo Interrupter Module

by Utsource in Circuits > Arduino

948 Views, 0 Favorites, 0 Comments

Arduino Photo Interrupter Module

Screenshot_20191122-084254__01.jpg
Hi guys in this instructables we will learn how to use Photo Interrupter module with Arduino.

Photo Interrupter Module Keyes KY-010 for Arduino, will trigger a signal when light between the sensor's gap is blocked.




THe KY-010 Photo Interrupter module consists of an optical emitter/detector in the front and two resistors (1 kΩ and 33 Ω) in the back. The sensor uses a beam of light between de emitter an detector to check if the path between both is being blocked by an opaque object.

Things You Need

Km5Zu-2RIncAUweU7uG7IhyWPySZ0SqIgAI0-vk9w7767_IkthCPCcsirj2GGmXF4IdQDg8UVpHVLVM6CXnzFsG1hnAdSkK7BIhIOtEldXoZiDsvzsPo-6o0rD6Mda7UyOE=w456-h323-nc.png
images(109).jpg

For this instructables we will need following things :

Arduino uno

Photo Interrupter module

Jumper wires

Breadboard (optional)

Schmatics

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

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

Code

20191121_193959.jpg
Please copy the following code and upload it to your arduino Board :

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);
}
}

Testing Photo Interrupter Module

Screenshot_20191122-084242__01.jpg
Screenshot_20191122-084303__01.jpg
Screenshot_20191122-084321__01.jpg
The arduino will light up the LED (pin 13) on the Arduino when there's an object blocking the beam of light between the sensor's gap.