Adjustable Infrared Sensor Switch (SKU:SEN0019)

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

Overview

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 sensor has a detection range of 3-80cm. 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 a bright light behind the probe to detect the scope of 3cm - 80cm.

Specification

  • Adjustable detection range, 3cm - 80cm
  • Small, easy to use/assemble, inexpensive
  • Useful for robot, interactive media, industrial assembly line, etc
  • Power supply: 5V

Pinout

  • Red - V+
  • Yellow - Signal
  • Green - GND
Infrared Sensor Switch

Connection Diagram

Analog sensor connection diagram

Sample Code

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

void setup()
{
  Serial.begin(57600);
  Serial.println("Start!");  
  pinMode(InfraredSensorPin,INPUT);
  pinMode(LedDisp,OUTPUT);
  digitalWrite(LedDisp,LOW);
}

void loop()
{
  if(digitalRead(InfraredSensorPin) == LOW)  digitalWrite(LedDisp,HIGH);
  else  digitalWrite(LedDisp,LOW);
  Serial.print("Infrared Switch Status:");
  Serial.println(digitalRead(InfraredSensorPin),BIN);
  delay(50);
}




Nextredirectltr.pngGo Shopping Adjustable Infrared Sensor Switch (SKU:SEN0019)