Component guide · Beginner · 3 min read
Photointerrupters and Slot Sensors
Wiring, Resistors and Counting Projects
By Geekobot Learning Team · Updated 29 Oct 2026
On this page
A photointerrupter has an infrared LED and a phototransistor facing each other across a slot. When something passes through the slot, the beam is blocked and the output changes. Use it for end-stops, speed counting with a slotted disc and object counting. Power the LED through a resistor and use a pull-up on the phototransistor, or buy a ready module with an LM393.
Key specs at a glance
- Types
- Transmissive (slot) and reflective
- Slot width
- About 3 to 6 mm on common parts
- LED current
- 10 to 20 mA with a series resistor
- Output
- Open-collector phototransistor or digital module
- Response
- Fast enough for kHz-level counting
- Parts
- Omron EE-SX series, Sharp GP1A, HS-S59, DFRobot modules
How it works
The LED lights the phototransistor across the gap. With the beam clear, the transistor conducts and the output is pulled low (or high, depending on the circuit); when an object blocks it, the output flips. See photodiodes and phototransistors for the basic physics.
Wiring a bare sensor
- 1Connect the LED anode through a resistor to 5 V; for 20 mA from 5 V and a 1.2 V LED, use about 180 to 220 Ω (use the LED resistor tool).
- 2Connect the LED cathode to ground.
- 3Connect the phototransistor collector to the input pin with a 10 kΩ pull-up to the logic voltage.
- 4Connect the emitter to ground.
- 5Use a Schmitt trigger or a comparator if the edges are slow; see comparators.
Ready modules
Modules add an LM393 comparator and a potentiometer so you get a clean digital output with an LED indicator, and often a 3-pin header. Connect VCC, GND and OUT, then read the pin or use an interrupt. For PNP or NPN open-collector sensors with a 5 mm slot (such as the Omron EE-SX672P or the Panasonic PM-L44), check the datasheet for voltage and output type.
Typical uses
- End-stops for 3D printers and CNC axes. - RPM: put a slotted disc in the slot and count pulses; see encoder resolution and rotary encoders. - Object and coin counting on conveyors. - Paper or tape detection in printers. For wider gaps use a photoelectric sensor, and for presence at a distance see IR sensor modules.
Tips
- Mount the sensor rigidly so the slot lines up with the disc.
- Shield it from strong ambient light and sunlight.
- Debounce in software for slow-moving objects.
- Use a slot narrower than the disc slits to get sharp edges.
Try it: Led resistor calculator
Change the values and the diagram and results update as you type.
Common mistakes to avoid
- Connecting the LED without a resistor.
- Using a reflective sensor where a slot sensor is needed.
- Leaving the output floating with no pull-up.
- Mounting loosely so the disc rubs the sensor.
- Using it in sunlight without a shield.
Frequently asked questions
What is a photointerrupter?
A slot-shaped optical switch with an IR LED and phototransistor.
Which resistor for the LED?
About 180 to 220 Ω from 5 V for 15 to 20 mA.
Can I use it to measure RPM?
Yes, with a slotted disc and a pulse counter.
Active low or high?
It depends on the module. Check the datasheet or test.
Does it work in sunlight?
It can, but strong IR light may disturb it. Use a shield.
Parts for this guide
Calculators
Terms in this guide
Projects that use it
Put this into practice: 1 step-by-step build in our project library uses parts from this guide.
Keep learning
Sources
Written by the Geekobot team from manufacturer datasheets. Always check the datasheet for the exact part and variant you buy.






