Gravity: Analog Adjustable Infrared Proximity Sensor For Arduino


The DFRobot Digital Adjustable Infrared Proximity Sensor 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 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.



Connection Diagram


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.



Q&A Some general Arduino Problems/FAQ/Tips
Q1 We have to use manual, because the description is too simple?
A1 This is a photoelectric switch, only have three lines, including power, ground and output, so don't have too complicated presentation.
Q2 Why does the light turns on when I connect the power?
A2 To ensure stable power supply is 5V ± 2%, followed by the output of the probe is not connected to the microcontroller output port.
Q3 Why does the light turns on when I connect the infrared switch power?
A3 Please:
1. Check the power supply, make sure the lines are not reversed, in a word, the infrared output to supply should be positive;
2. Check the probe, make sure it is in the direction of the detection range where doesn't exist obstacle, the best way is to orientate the open direction.
Q4 If need the pull-up resistor, how much resistance should it have?
A4 About 10K.

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

More Documents

DFshopping_car1.png Get Digital Adjustable Infrared Proximity Sensor from DFRobot Store or DFRobot Distributor.

Category: DFRobot > Sensors & Modules > Sensors > Range & Distance Sensors

category: Product Manual category: SEN Series category: Sensors category: Source category: Diagram

Turn to the Top