E18-D80NK IR proximity switch
An infrared proximity switch with an NPN open-collector output: it pulls OUT low while something is within its range, 3 to 80 cm.
The E18-D80NK: a threaded plastic barrel with an infrared emitter and receiver in its nose, a range screw and a lamp in its tail, and three wires. Aliases: IR proximity switch, photoelectric switch, E18 sensor.
The beam is modulated and the receiver looks for the modulation, so unlike the FC-51 it is not fooled by room light. Something within its range reflects the beam back and it switches.
Pins
| Pin | Wire | What it does |
|---|---|---|
VCC |
brown (or red) | 5 V, under 25 mA. |
GND |
blue (or black) | Ground. |
OUT |
black (or yellow) | NPN open collector: pulled low while something is in range, not driven otherwise. |
Wire colors vary between batches; the brown, blue and black set is the industrial convention.
Properties
range is the screw in the tail, 3 to 80 cm by the listings, 40 cm by default, for a
white target. pullup adds the 10 k pull-up some batches have inside; it is off by
default because the listings tell you to add your own.
While it runs
Drag the target in front of it, 1 to 100 cm (100 is nothing there). The lamp in the tail lights while it detects.
What the model gets right
Open collector. With nothing in front, the output transistor is off and OUT is not
driven at all. With no pull-up, digitalRead on it reads noise on a real board. Use
INPUT_PULLUP or a 10 k to 5 V, and LOW means something is there. The output sinks
up to 100 mA, enough for a small relay.
What it does not model
A dark target, which has to come closer by an amount no listing gives. The beam's angle, the 2 ms response, and the lack of reverse-polarity protection the listings warn about. There is no hysteresis: none is given.
Common mistakes
Reading OUT with pinMode(pin, INPUT) and no resistor. Add the pull-up.
Powering it from 3.3 V. It is a 5 V sensor.
See it in action
KY comparator boards and an IR switch has one on pin 6 with INPUT_PULLUP, printing
"something there" while the target is within range. Open it at /templates.
The Object counter with an E18-D80NK counts each object once on an I2C LCD, with a beep.