Introduction
The photo interrupter is a device that operates by blocking light with an object. Its main components include a light emitter and a light receiver, both arranged face-to-face within the same enclosure. When an object passes through the light path between the emitter and receiver, the receiver's light is obstructed, triggering the operation of the photoelectric sensor. The Gravity Photo Interrupter Module integrates a high-performance ITR9608 photoelectric switch, featuring a compact design and easy operation, making it the ideal choice for your electronic projects and applications. Whether it's for robotics, automation equipment, or counting systems, this module provides precise photoelectric detection and efficient signal processing for your projects.
Feature
- High Sensitivity and Precision: Utilizing the ITR9608 slotted photoelectric switch, it provides high-precision detection under various lighting conditions.
- Wide Photonic Gap: With a 5.0mm wide photonic gap design, it is suitable for detecting objects of various sizes, enhancing flexibility and accuracy in detection.
- Fast Response: With rapid response time, it quickly detects the entry or exit of objects.
- Simple and Easy to Use: Designed with a standard Gravity interface, it offers easy operation and strong compatibility, making connections hassle-free.
- Strong Compatibility: It seamlessly integrates with various control boards such as Arduino, Micro:bit, and UNIHIKER, enhancing versatility.
- Versatile Applications: Widely used in various applications such like smart card switch, automatic sensors, energy-saving switches, vending machines, small household appliances, scanners, fax machines, etc., meeting diverse application needs.
Typical Applications
- Counter: Enables object counting, such as product counting on production lines.
- Speed Detection and Measurement: Outputs pulse signals by detecting intermittent obstruction of rotating components, allowing calculation of rotation speed and frequency.
- Smart Card Switch: Used for detecting the insertion and removal of cards, such as in hotel rooms for power control.
- Printer and Copier Paper Detection: Detects paper position to control printing and transmission operations.
Specification
- Operating Voltage: 3.3~5V
- Output Type: Digital Signal
- Light Source Wavelength: 940nm (Infrared)
- Photonic Gap: 5.0mm
- Interface Type: PH2.0-3P
- Product Dimensions: 27x32mm
- Product Weight: 4.0g(total weight including packaging and sensor wire is 12g)
Pin Description
No. | Silkscreen | Function Description |
---|---|---|
1 | D | Output Signal |
2 | VCC | Power Supply (Positive) |
3 | GND | Power Supply (Negative) |
micro:bit Usage Tutorial
Preparation
Hardware
- 1 x micro:bit
- 1 x IO Extender for micro:bit
- 1 x photo interrupter
- 1 x LED Light
- 1 x Digital Connection Cable
Software
Project Description - MakeCode
Use a Photo Interrupter for detection and display the detected digital value on the micro:bit's LED matrix.
Hardware Connection - MakeCode
Connect the Photo Interrupter to the P2 pin on the IO Extender for micro:bit, as shown in the diagram below.
Example Program - MakeCode
Result
When the program is successfully downloaded, block the Photo Interrupter with an object. The indicator light on the sensor will turn on, and the micro:bit LED matrix will display 1. When the object is removed, the indicator light on the sensor will turn off, and the micro:bit LED matrix will display 0.
Project Description - MindPlus
Control the LED light using the Photo Interrupter. When the Photo Interrupter is blocked, the LED light will turn on; otherwise, the LED light will turn off.
Hardware Connection - MindPlus
Connect the Photo Interrupter to the P1 pin on the IO Extender for micro:bit, and connect the LED light to the P2 pin.
Example Program - MindPlus
Result
After the program is successfully downloaded, the LED light will turn on when the Photo Interrupter is blocked; otherwise, the LED light will turn off.
Arduino Usage Tutorial
Preparation
Hardware
- 1 x Arduino UNO
- 1 x I/O Expansion Shield V7.1
- 1 x photo interrupter
- 1 x LED Light
- 1 x Digital Connection Cable
Software
- MakeCode
- MindPlus
Project Description
Control the LED light with the Photo Interrupter. The LED light will turn on when the Photo Interrupter is blocked; otherwise, it will turn off.
Hardware Connection
Connect the Photo Interrupter to the P7 pin on the I/O Expansion Shield, and connect the LED light to the P4 pin.
Example Program - MindPlus
Example Program - Arduino IED
#define led 4
#define PI 7
void setup() {
pinMode(led, OUTPUT); // Set LED pin as output
pinMode(PI, INPUT); // Set Photo Interrupter pin as input
}
void loop() {
int P = digitalRead(PI); // Read the digital value of the Photo Interrupter
if (P == 1) { // Check if the Photo Interrupter is blocked
digitalWrite(led, HIGH); // If yes (blocked), turn on the LED
} else {
digitalWrite(led, LOW); // If not (not blocked), turn off the LED
}
}
Result
After the program is successfully downloaded, the LED light will turn on when the Photo Interrupter is blocked; otherwise, the LED light will turn off.
UNIHIKER Usage Tutorial
Preparation
Hardware
- 1 x UNIHIKER
- 1 x photo interrupter
- 1 x Two-end PH2.0-3P White Silicone Twisted Wire
Software
- MindPlus
Usage Tutorial
Project Description - Graphical Programming
Using a photo interrupter for counting and displaying the accumulated quantity on the UNIHIKER screen.
Hardware Connection - Graphical Programming
Connect the photo interrupter to pin P24 on the UNIHIKER, as shown in the diagram below.
Example Program - Graphical Programming
Result
After the program runs successfully, when an object blocks the photo interrupter, the indicator light on the sensor will illuminate. When the object is removed, the count on the UNIHIKER will increment by 1.
Project Description - Python Code
Control the LED light using the photo interrupter. The LED light will turn on when the photo sensor is blocked; otherwise, it will turn off.
Hardware Connection - Python Code
Connect the photo interrupter to pin P23 on the UNIHIKER, and connect the LED light to pin P24.
Example Program - Python Code
from pinpong.extension.unihiker import *
from pinpong.board import Board, Pin
# Initialize the board
Board().begin()
# Set up the input pin for the photo interrupter
p_p23_in = Pin(Pin.P23, Pin.IN)
# Main loop
while True:
# Check if the photo interrupter is blocked
if p_p23_in.read_digital():
# If blocked, turn on the LED
p_p24_out = Pin(Pin.P24, Pin.OUT)
p_p24_out.write_digital(1) # Turn on the LED
else:
# If not blocked, turn off the LED
p_p24_out = Pin(Pin.P24, Pin.OUT)
p_p24_out.write_digital(0) # Turn off the LED
Note: You can refer to the MindPlus Code Programming Tutorial for a better understanding of how to use Python code mode in MindPlus.
Result
After the program runs successfully, cover the photo interrupter with an object, and the LED light will turn on. When the object is removed, the LED light will turn off.
FAQ
More questions and cool idea, please visit DFRobot Forum
More Documents
Get Gravity: Infrared Light Photo Interrupter Module from DFRobot Store or DFRobot Distributor.