Place your target obstacle at the desired maximum detection distance.
2cm to 30cm (Adjustable via onboard potentiometer) Detection Angle: 35 degrees
Helps wheeled robots detect walls or furniture to steer away before an impact occurs.
const int irSensorPin = 7; // FC-51 OUT connected to pin 7 const int ledPin = 13; // Built-in LED Fc 51 Ir Sensor Datasheet
The FC-51's simplicity and low cost make it suitable for a wide range of applications across robotics, automation, and education.
If the reflected light is strong enough, the output pin ( OUT ) drops to a LOW (0V) state, and the onboard green status LED illuminates. Calibration and Range Adjustment
The following specifications are typical for the standard FC-51 module. Always check your specific vendor datasheet, but the values below are industry-standard. Place your target obstacle at the desired maximum
| Pin Name | Description | |----------|-------------| | | Power supply (3.3–5V) | | GND | Ground | | OUT | Digital output (0V when obstacle present, Vcc when no obstacle) | | EN | Enable pin (leave floating or pull HIGH to enable; LOW may disable) – not always present on all clones |
// Define the sensor connection pin const int SENSOR_PIN = 2; const int ONBOARD_LED = 13; // Built-in LED for visual feedback void setup() // Initialize Serial Monitor for debugging Serial.begin(9600); // Configure the sensor pin as an input pinMode(SENSOR_PIN, INPUT); // Configure the onboard LED as an output pinMode(ONBOARD_LED, OUTPUT); Serial.println("FC-51 IR Sensor Initialized."); void loop() // Read the digital state of the sensor int sensorState = digitalRead(SENSOR_PIN); // FC-51 outputs LOW (0) when an obstacle is detected if (sensorState == LOW) digitalWrite(ONBOARD_LED, HIGH); // Turn on LED Serial.println("Obstacle Detected!"); else digitalWrite(ONBOARD_LED, LOW); // Turn off LED Serial.println("Path Clear."); // Small delay to stabilize serial printing delay(100); Use code with caution. 7. Troubleshooting and Calibration
Bring the object closer, use a lighter target surface, or turn the potentiometer clockwise. Fluctuating power supply voltage or high electrical noise. If the reflected light is strong enough, the
The FC-51 is a simple sensor and is . Ambient light, especially sunlight, can cause false triggers as the phototransistor may detect other IR sources. Temperature variations also affect the IR components and can change the detection threshold.
A: "LM393" refers to the comparator IC. Many IR sensor modules (including FC-51) use the LM393. FC-51 is a specific board layout and component selection.
Because the FC-51 provides a clean digital output, it does not require complex analog-to-digital conversion (ADC). It can be wired directly to any digital input pin on a microcontroller.
Connecting the FC-51 sensor to an Arduino is straightforward. FC-51 VCC -> Arduino 5V FC-51 GND -> Arduino GND FC-51 OUT -> Arduino Pin 2 Simple Arduino Code: