The Sensor FC-51 IR is an infrared proximity sensor module that utilizes infrared radiation to detect the presence of objects within its sensing range. It is widely used in robotics, security systems, and various automation applications where non-contact object detection is required. The sensor operates by emitting an infrared signal and then detecting the reflected signal from nearby objects.
Pin Number | Name | Description |
---|---|---|
1 | VCC | Power supply (3.3V to 5V DC) |
2 | GND | Ground |
3 | OUT | Digital output signal (high/low) |
4 | EN | Enable pin (optional, not always present) |
// Define the connection pin
const int IRPin = 2; // Connect the OUT pin of FC-51 to digital pin 2
void setup() {
pinMode(IRPin, INPUT); // Set the IRPin as an input
Serial.begin(9600); // Start serial communication at 9600 baud rate
}
void loop() {
int sensorValue = digitalRead(IRPin); // Read the sensor value
if (sensorValue == HIGH) {
// When the sensor detects an object, it outputs HIGH
Serial.println("Object Detected!");
} else {
// When no object is detected, it outputs LOW
Serial.println("No Object Detected");
}
delay(200); // Wait for 200 milliseconds before reading again
}
Q: Can the FC-51 sensor detect the color of an object? A: No, the FC-51 sensor cannot detect color as it only measures the presence of objects based on reflected infrared light.
Q: What is the maximum sensing range of the FC-51 sensor? A: The maximum sensing range is approximately 30cm, but it can vary based on the object's surface and environmental conditions.
Q: Is the FC-51 sensor waterproof? A: No, the FC-51 sensor is not waterproof. Precautions should be taken to avoid exposure to moisture.
Q: Can the sensor work in the dark? A: Yes, the sensor can work in the dark as it uses its own infrared emitter for detection.