What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
A slotted photo interrupter lets an Arduino detect when an opaque flag passes through a gap and blocks an infrared beam. For a beginner, a three-pin module is the simplest option: connect its power, ground and signal pins, then read the signal with digitalRead(). Check the markings on your specific board first, because pin order and active signal level can vary.
What a slotted photo interrupter detects
A photo interrupter places an infrared emitter and a detector on opposite sides of a slot. When the path is clear, infrared light reaches the detector; when an opaque object enters the gap, it blocks the beam and changes the output. Arduino can read that change to count passing objects or slots, sense rotation, or detect an end position.
The Electrokit guide describes its module as triggering when light between the sensor’s gap is blocked: Electrokit photo interrupter module guide.
Wire a three-pin module to Arduino
The documented Electrokit module has onboard 1 kΩ and 33 Ω resistors, so it does not need the external resistor arrangement required by a bare optocoupler. Its guide lists a 3.3–5 V operating supply and dimensions of 18.5 mm × 15 mm; those specifications apply to that module, not every board sold as a photo interrupter.
#1 Best Overall
- Adopting a slot type photoelectric sensor, it consists of an infrared light-emitting diode and an NPN photoelectric transistor, with a slot width of 5.9mm.
- As long as a non-transparent object passes through the slot, it can trigger to output a low TTL level.
- Using Schmidt trigger to jitter pulses is very stable and can be used for small car speed measurement, distance measurement, and other applications!
- Install holes with M3 screws at both ends.
- Working voltage: 3.3V-5V, output form: digital switch output (0 and 1)
- Power down the Arduino before making connections.
- Check the labels and orientation on the exact module. For the board orientation shown in the Electrokit guide, connect the middle pin to 5 V (or an allowed 3.3 V supply), the left pin to GND, and the signal pin to digital pin 3.
- Reconnect power and move an opaque flag fully through the slot while monitoring the signal. Determine whether the reading becomes HIGH or LOW when the beam is blocked.
Do not rely on pin position alone: inexpensive modules can use different layouts. Follow the board’s printed labels and documentation before applying power.
Read the signal in a simple Arduino sketch
This example follows the documented behavior of reading pin 3 and turning on the built-in LED when the input reads HIGH. The meaning of HIGH is board-dependent; if your module goes LOW when interrupted, change the comparison accordingly.
Rank #2
- use: 1. +5 +5 is the positive input port of the power supply, which can be connected to a voltage of 3.3V~5V
- 2. GND GND is the negative input port of the power supply. OUT OUT is the signal output port, which is connected to the I/O port of the single-chip microcomputer. Generally, it is connected to an external interrupt.
- For other main control boards or higher-level main control boards (such as Arm), if you need to set the I/O port to input/output mode, you must set it to input mode/receive mode, otherwise it cannot be used. 51 series MCU can be used directly, no need to set input and output mode
- Note: For Arduino players should set the MCU's I/O port to input mode/receive mode, otherwise it cannot be used.
const byte sensorPin = 3;
const byte ledPin = LED_BUILTIN;
void setup() {
pinMode(sensorPin, INPUT);
pinMode(ledPin, OUTPUT);
}
void loop() {
bool interrupted = digitalRead(sensorPin) == HIGH;
digitalWrite(ledPin, interrupted ? HIGH : LOW);
}
If the LED behavior is reversed, first verify the module’s output while the slot is clear and while a flag blocks it. Then set interrupted to test for the observed level, for example digitalRead(sensorPin) == LOW if interruption produces LOW.
Choose polling or interrupts based on event speed
Polling for slow events
Repeatedly reading the input with digitalRead() is suitable when objects pass slowly enough that the main loop will observe each change. It is straightforward, but a short pulse can be missed if other work keeps the loop from checking the pin in time.
Free tools Windows power users keep installed
One-click scans. No signup required.
Rank #3
- Module: Speed Measuring Sensor Infrared detection, eliminating the interferences of external stray light, Schmitt trigger, stable wave form and signals
- Parameters: Operating Voltage: 3.3V to 5V, Output form: digital switch OUT output (0 and 1)
- LED: Signal output indicator (while breaking the beam, outputs low level, the indicator lights up)
- Application: Speed measuring sensor IR infrared slotted optical optocoupler module widely used in motor speed detection, pulse counting, position limit, etc
- Package included: You will get 5 x Speed Measuring Sensor, 5 xEncoders, 1 x 15pin Female to Male Dupont Wire, 1 x 15Pin Female to Female Dupont Wire
Interrupts for faster counting
For fast-moving slots or a rotating encoder wheel, use an interrupt-capable digital input supported by your Arduino board and count transitions in an interrupt routine. Check the board’s pin capabilities before choosing a pin. If rotation speed or timing matters, record edge times as well as counts. Debouncing is usually less important here than verifying polarity, the input’s pull-up configuration, and whether the signal edges are clean and fast enough.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Use a bare ITR8102 with external resistors
A bare ITR8102 is a four-pin component with separate infrared LED and phototransistor connections; it is not wired like a three-pin module with onboard resistors. The ITR8102 section in the Arduino documentation mirror specifies a 220 Ω series resistor on the LED side and a 10 kΩ resistor on the detector side, with the detector node connected to a digital input. It lists 20 mA input/output current limits and a 30 V collector-emitter voltage rating. These are part-specific figures, not universal photo interrupter ratings: Arduino photo interrupter documentation.
Rank #4
- Module: LM393 chip Speed Sensor Module,the use of imported groove coupler sensor, Working Voltage: DC 3.3 - 5V, the comparator output signal clean, good waveform, driving ability, than 15mA
- Size: PCB Board Size: 33 x 14mm / 1.26 x 0.55in (L x W), Slotted Width: 5mm / 0.2in, Hole Size: 3mm / 0.12in
- Pin definition: VCC is connected to the positive pole of the power supply, GND is connected to the negative pole of the power supply, DO TTL switch signal output, AO This module does not work
- Application: This module is widely used in motor speed detection, pulse counting, position limit, etc
- Package included: You will get 10 x Speed Measuring Sensor LM393
Identify the LED and phototransistor pins from the ITR8102 documentation before wiring. Do not assume a different manufacturer’s four-pin device has the same pin order; consult that exact part’s datasheet. A module’s fitted resistors do not provide current limiting for a separate bare component.
Quick Recap
Best Value
- Products include:12Pcs IR Infrared Speed Measuring Sensor Module;10Pcs Connecting Wires
- Size:26*15*14mm
- Voltage:3.3-5V
- Output form: digital switch OUT output (0 and 1)
- Note: for Arduino players should set the MCU's I/O port to input mode/receive mode, otherwise it cannot be used
Troubleshoot a signal that does not change
- Recheck orientation and labels: Confirm GND, VCC or +5V, and S/signal on the specific module, rather than assuming a left-to-right order.
- Check supply and ground: Confirm the module is receiving a voltage allowed by its documentation and shares ground with the Arduino.
- Block the beam completely: Keep the flag centered in the slot so it fully interrupts the path.
- Test both logic states: Observe the input with the slot clear and blocked; the interrupted state may be LOW rather than HIGH.
- For a bare part, verify resistor wiring: Confirm the LED has its required series resistor and the detector side uses the specified circuit. Do not treat bare-component wiring as if it were a resistor-equipped module.
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.
Recommended Free Tools

