In this illustration we will going to wire the Infrared distance switch, a high-sensitive photoreflector to detect distance function, ranging from 3cm to 80cm. When the infrared emitted by the emitter it will get reflected on a surface blocked it then the phototransistor will pick up the signal for a distance calculation. This device has integrated with potentiometer to adjust the range for easy and clear to use. Best usage on this device is for robotics, interactive media, industrial and automotive, etc.


As you can see the diagram above the technology behind this effective distance sensor is the modulation from the infrared light, the receiver functionality is sense only if infrared light and only when it receives the correct signal. Therefore it is not very sensitive to ambient light compared to normal infrared detectors. Below are the wiring diagram for testing and how to use this device with Arduino MCU.

E18-D80NK Infrared Distance Ranging Sensor

Device Characteristics

  • Power Supply: 5VDC
  • Supply current DC <25mA
  • Maximum load current 100mA (Open-collector NPN pulldown output)
  • Response time <2ms
  • Diameter: 17MM
  • Pointing angle: ≤ 15 °, effective from 3-80CM Adjustable
  • Detection of objects: transparent or opaque
  • Working environment temperature: -25℃+55℃
  • Case Material: Plastic
  • Lead Length: 45CM

Required Components

E18-D80NK Infrared Distance Ranging Sensor
Solder-less Bread Board
Jumper Wire / DuPont Wire

Wiring Diagram Schematics

Arduino Sketch Code


Wiring the E18-D80NK Infrared Distance Ranging Sensor
Tagged on:         


6 thoughts on “Wiring the E18-D80NK Infrared Distance Ranging Sensor

  • at

    obrigado pelo exemplo, pois o meu tem os fios de cor diferente, e voçe tem ai o esquema e código que procurava, Obrigado

    • at

      Seu bem-vindo, você pode remover a condição while usando simplesmente se condição. :)

  • at

    Hi, the 10K resistor in SERIES with the sensor output in the schematic, IS NOT a pullup resistor.

    You need to remove it AND read your own Type1 and Type2 table information and see how to fit the proper pullup.


    You need to remove it and turn the pullup resistor on in the Arduino software.

  • at

    Pin 5 is not D5 on most board, but GPIO5.

    For record, Pin 5 = D1 on nodemcu


Leave a Reply

Your email address will not be published. Required fields are marked *