const int irSensorPin = 2;
Product counting on assembly lines or presence detection.
// FC-51 IR Sensor Testing Code const int irSensorPin = 2; // OUT pin connected to digital pin 2 const int ledPin = 13; // Built-in LED for visual alert void setup() pinMode(irSensorPin, INPUT); // Set sensor pin as input pinMode(ledPin, OUTPUT); // Set LED pin as output Serial.begin(9600); // Initialize serial monitor Serial.println("FC-51 Sensor Initialized."); void loop() int sensorState = digitalRead(irSensorPin); // Read the digital value if (sensorState == LOW) // Low signal indicates an obstacle is present digitalWrite(ledPin, HIGH); Serial.println("Status: Obstacle Detected!"); else // High signal indicates clear path digitalWrite(ledPin, LOW); Serial.println("Status: Path Clear"); delay(100); // Small delay to avoid flooding the serial monitor Use code with caution. Practical Applications
When working with the FC-51 IR sensor, keep the following tips and precautions in mind: Fc 51 Ir Sensor Datasheet
2cm to 30cm (Adjustable via potentiometer) Detection Angle: 35°
The datasheet for the FC-51 IR sensor provides the following key specifications:
Triggers automatic water faucets, hand sanitizers, or paper towel dispensers when hands approach. Limitations and Troubleshooting const int irSensorPin = 2; Product counting on
Q: What is the output type of the FC-51 IR sensor? A: The FC-51 IR sensor provides a digital output signal (HIGH/LOW).
void loop() int sensorValue = digitalRead(sensorPin); // Read the sensor
| Parameter | Value / Range | Details | | :--- | :--- | :--- | | Model Number | FC-51 | | | Operating Voltage | 3.0V - 6.0V DC (Commonly 5V) | | | Current Consumption | ~23 mA (3.3V), ~43 mA (5.0V) | | | Output Type | Digital switching (0 / 1) | | | Active Output Level | LOW (0V) when obstacle detected | | | Inactive Output Level | HIGH (~Vcc) when no obstacle detected | | | Detection Distance | 2cm - 30cm (adjustable) | | | Detection Angle | 35 degrees | | | Comparator Chip | LM393 | | | PCB Dimensions | 3.1 cm (L) x 1.4 cm (W) | | | Mounting Holes | 3mm screw holes | | Limitations and Troubleshooting Q: What is the output
The heart of the FC-51 module is the LM393 integrated circuit. This chip compares the analog voltage coming from the IR photodiode against a reference voltage set by the user. Because it handles the analog-to-digital translation on-board, your microcontroller does not need an Analog-to-Digital Converter (ADC) pin to read this sensor. Onboard Potentiometer
What should trigger when an obstacle is detected?
Digital output pin that connects straight to a microcontroller's GPIO. ⚡ Hardware Layout and Adjustments