void loop() int sensorValue = digitalRead(sensorPin); if (sensorValue == LOW) // Obstacle detected digitalWrite(ledPin, HIGH); Serial.println("Obstacle!"); else digitalWrite(ledPin, LOW);
3.0V to 6.0V DC (Typically used at 3.3V or 5V). Current Consumption: ~23 mA at 3.3V. ~43 mA at 5.0V. Fc 51 Ir Sensor Datasheet
When an object enters the detection range, the light reflects back to the photodiode. When an object enters the detection range, the
void setup() pinMode(sensorPin, INPUT); pinMode(ledPin, OUTPUT); Serial.begin(9600); Specification Operating Voltage 3
The module is designed for simple "object vs. no object" detection rather than precise distance measurement. Specification Operating Voltage 3.0V – 6.0V DC Current Consumption ~23 mA at 3.3V; ~43 mA at 5.0V Detection Range 2cm – 30cm (adjustable via potentiometer) Detection Angle LM393 Voltage Comparator Output Type Digital (HIGH/LOW) Board Dimensions ~3.1cm x 1.4cm (PCB) Pinout and Indicators
If you are looking for a complete copy of the technical document, you can view the FC-51 IR Sensor Datasheet on or refer to project guides on Instructables and Hackster.io .
2 cm to 30 cm (Subject to target reflectivity) Effective Detection Angle: ~35° field of view