Skip to content

How to use the FC 51 InfraRed proximity/obstacle avoidance sensor with Arduino




Hello,

Welcome to this little tutorial, we gonna see how to use the FC 51 infrared sensor, it’s a module used to detect if something is passing by or an obstacle, like in obstacle avoidance robot, this module si very easy to use, it sends infrared waves and if there’s something they reflect back and inform us that something is near, and it depends of how you set the potentiometer to adjust the detection range.

 

FC 51 Module

Wiring:

Code:

//This code is to use with FC51 IR proximity sensor, when it detects an obstacle it lights the internal LED
//of the Arduino Board, refer to Surtrtech for more information

const int ProxSensor=3; //Declaring where the Out pin from the sensor is wired

void setup() {                
  pinMode(13, OUTPUT);   // setting the pin modes, the "13" stands for the internal Arduino uno internal LED  
  pinMode(ProxSensor,INPUT); // then we have the out pin from the module
}

void loop() {
  
  if(digitalRead(ProxSensor)==HIGH)      //Check the sensor output if it's high
             {
               digitalWrite(13, LOW);   // Turn the LED on (Yes by writing LOW)
             }
  else
            {
              digitalWrite(13, HIGH);    // Turn the LED OFF if there's no signal on the ProxSensor
             }
  delay(100);             

}

No libraries needed, the functionning of the module is very simple, it has a digital output that’s give a high level when it detects something otherwise it’s low, the detection range can be set by the potentiometer on the module.

Yassine View All

Automation and Electrical Engineer, Electronics amateur trying to share my little projects.

3 thoughts on “How to use the FC 51 InfraRed proximity/obstacle avoidance sensor with Arduino Leave a comment

Leave a Reply

%d bloggers like this: