Adjustable Infrared Sensor Switch (SKU:SEN0019)

From Robot Wiki
Jump to: navigation, search
Adjustable Infrared Sensor Switch (SKU:SEN0019)


The DFRobot Adjustable Infrared Sensor Switch is a set of transmitter and receiver in one of the photoelectric switch sensor. The detection distance can be adjusted according to the demand. The DFRobot Adjustable Infrared Sensor Switch is small, easy to use, inexpensive, easy to assemble and can be widely used in robot to avoid obstacles, interactive media, industrial assembly line, and many other occasions. The switching signal output differs in accordance to the obstacles. It remains high when no obstacles and remains low when there are obstacles. There is also a red led on its back to indicate the sensor status.


  • Power supply: 5V
  • Working Current: <100mA
  • Adjustable detection range: 3cm - 80cm
  • Pin description:
    • Red - 5V
    • Green - GND
    • Yellow - Digital output
  • Digital output:
    • "0" - found barrier (~0V)
    • "1" - no barrier (~4V)
  • Dimension: 45x18mm


Connection Diagram

SEN0019 Sensor Switch Connection Diagram greenGND.png

Sample Code

const int InfraredSensorPin = 4;//Connect the signal pin to the digital pin 4
const int LedDisp = 13;

void setup()

void loop()
  if(digitalRead(InfraredSensorPin) == LOW)  digitalWrite(LedDisp,HIGH);
  else  digitalWrite(LedDisp,LOW);
  Serial.print("Infrared Switch Status:");


Cover the sensor head with your hand, the LED(Pin13) on board will light up, hold it toward an open area, the LED will be off. Open Arduino IDE serial monitor, you can also get the Infrared sensor status.

Sen0019 result.png

Trouble shooting

Q 1. We have to use manual, because describes explanation is too simple?

A: This is a photoelectric switch, only three lines, power, ground and output, so have not too complicated presentation.

Q 2. Why Connect the power, light has been lit?

A: To ensure stable power supply is 5V ± 2%, followed by the output of the probe is not connected to the microcontroller output port.

Q 3. Why connect infrared switch power, light has been lit?

A: .Please

  1. Check the power supply has not reversed, in a word, the infrared output to supply positive;
  2. check the probe is in the direction of the detection range that is no obstacle, the best against the open direction.

Q 4. If need the pull-up resistor, how much should be?

A: About 10K.

Any question and more cool ideas to share, please visit DFRobot Forum

Nextredirectltr.png BUY from DFRobot Store or DFRobot Distributor List