Component guide · Beginner · 3 min read
E18-D80NK Adjustable Infrared Proximity Switch

3 to 80 cm) and DFRobot Gravity Version
By Geekobot Learning Team · Updated 29 Oct 2026
On this page
The E18-D80NK is a cylindrical infrared proximity switch that detects an object between about 3 and 80 cm. It sends modulated IR, so it works far better in daylight than cheap IR obstacle boards. You set the range with a screw at the back. The output is NPN, pulling low when an object is seen, which makes it easy to count items, detect hands or stop a robot.
Key specs at a glance
- Supply
- 5 V DC
- Range
- About 3 to 80 cm, adjustable
- Output
- NPN, low when an object is detected
- Current
- About 25 to 100 mA
- Housing
- 18 mm threaded barrel
- Indicator
- Red LED on detection
Models in this guide
These are alternatives. Pick the one that fits your project; you only need one.
Option 1E18-D80NK Adjustable Infrared Proximity Sensor Switch 3–80cm – Diffuse Reflective, Digital Output, 1m Cable₹146
Option 2E18-D80NK Mini Adjustable Infrared Sensor Switch 3-80cm – Diffuse Reflective, Digital Output, 70cm Wire₹169
Option 3DFRobot Gravity Digital Adjustable Infrared Proximity Sensor – 3-80cm Range, 5V₹829
What the E18-D80NK adjustable IR proximity switch is
The E18-D80NK is an infrared proximity switch in an 18 mm barrel that switches its output when an object comes within an adjustable distance of 3 to 80 cm.
Range depends on the target: white and shiny surfaces are seen further than black or matte ones.
The output is open collector: add a pull-up (the Arduino INPUT_PULLUP is enough) and it reads LOW on detection.
E18-D80NK adjustable IR proximity switch pinout
The pins on the E18-D80NK adjustable IR proximity switch and what each one does.
| Pin | Function |
|---|---|
| Brown | +5 V |
| Blue | GND |
| Black | Signal (NPN) |
- Brown
- +5 V
- Blue
- GND
- Black
- Signal (NPN)
Wiring the E18-D80NK adjustable IR proximity switch
With the pull-up to 3.3 V the signal is safe for an ESP32 even though the sensor runs on 5 V.
| E18-D80NK adjustable IR proximity switch pin | Arduino Uno | ESP32 |
|---|---|---|
| Brown | 5 V | 5 V (VIN) |
| Blue | GND | GND |
| Black | D2 (INPUT_PULLUP) | GPIO 27 with 10 k pull-up to 3.3 V |
- Brown
- Arduino Uno:
- 5 V
- ESP32:
- 5 V (VIN)
- Blue
- Arduino Uno:
- GND
- ESP32:
- GND
- Black
- Arduino Uno:
- D2 (INPUT_PULLUP)
- ESP32:
- GPIO 27 with 10 k pull-up to 3.3 V
Example code
A minimal sketch to check the part works.
const int SENS = 2;
int count = 0;
bool was = false;
void setup() { Serial.begin(115200); pinMode(SENS, INPUT_PULLUP); }
void loop() {
bool seen = digitalRead(SENS) == LOW;
if (seen && !was) { count++; Serial.println(count); }
was = seen;
delay(5);
}Setup and tuning
brown to 5 V, blue to GND, black to a digital pin.
the output is NPN open collector, so use INPUT_PULLUP or a 10 kΩ pull-up.
the output goes LOW when an object is detected.
turn the screw at the back while watching the LED.
dark and shiny objects reflect less, so they are detected at shorter range.
What you need
Shop this list6 of 7 found in our store · ₹1,629
E18-D80NK Adjustable Infrared Proximity Sensor Switch 3–80cm – Diffuse Reflective, Digital Output, 1m Cable: the part this guide coversE18-D80NK Adjustable Infrared Proximity Sensor Switch 3–80cm – Diffuse Reflective, Digital Output, 1m Cable₹146
Generic E18-D80NK Mini Adjustable Infrared Sensor Switch 3-80cm – Diffuse Reflective, Digital Output, 70cm Wire: another version this guide coversE18-D80NK Mini Adjustable Infrared Sensor Switch 3-80cm – Diffuse Reflective, Digital Output, 70cm Wire₹169
DFRobot Gravity Digital Adjustable Infrared Proximity Sensor – 3-80cm Range, 5V: another version this guide coversDFRobot Gravity Digital Adjustable Infrared Proximity Sensor₹824- Uno R3 development board: the controller used in the wiring tableFind this part
ESP32-WROOM-32 38-pin development board: for Wi-Fi logging and dashboardsESP32-WROOM-32 38-Pin Development Board₹389
5 V relay module with optocoupler: to switch a light or load5V Relay Module with Optocoupler₹74
Buzzer module 3.3-5 V: for an audible alarmBuzzer Module 3.3–5V₹27
Alternatives and when to choose them
- IR obstacle modules: cheaper, shorter range.
- Sharp IR distance sensors: give a distance, not just yes or no.
- Photoelectric sensors: industrial versions.
Common mistakes to avoid
- Pulling the output up to 5 V on a 3.3 V board.
- Leaving out the pull-up resistor.
- Expecting a distance value instead of on/off.
- Setting the range in a different light than where it runs.
Frequently asked questions
Why does the E18-D80NK always read LOW or HIGH?
Check the pull-up and that the output wire goes to a digital pin with a common ground.
Can it work at 3.3 V?
It needs 5 V to run; with a pull-up to 3.3 V the output is safe for an ESP32.
Does it measure distance?
No. It only switches when an object is closer than the set distance.
Why does it miss black objects?
Black surfaces absorb infrared; they are detected only closer.
Can it work in sunlight?
Strong sunlight reduces range and can cause false triggers.
Parts for 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.

