FC-51 obstacle sensor
The FC-51 infrared obstacle sensor: an IR LED and receiver on an LM393 board, one digital output. Aliases: KY-032, IR proximity sensor.
The clear LED shines infrared forward and the dark receiver beside it catches
whatever bounces back. Once enough comes back the comparator pulls OUT low and the
obstacle lamp lights. It is the robot car's "is there a wall" sensor and the eye of
a touchless soap dispenser.
Pins
| Pin | What it does |
|---|---|
OUT |
Low while something is in range, high otherwise. Open collector with a 10 k pull-up. |
GND |
Ground. |
VCC |
Supply, 3.3 V to 5 V. |
Properties
threshold is the trimmer as a fraction of the supply, 0.5 by default. Turning it up
reaches further.
While it runs
The slider is how far away the obstacle is, from 1 cm to 80 cm (the far end is nothing in front). Click the swatch beside it to swap a white card for a black object.
What the model gets right
The range. The listings give 2 to 30 cm, set by the trimmer. The light that
comes back falls with the square of the distance, and the model is fitted so the
middle of the trimmer trips on a white card at about 13 cm and threshold 0.9 on
5 V reaches about 30 cm.
Black things. A white card reflects about 90% of the infrared and a black object about 5%, so a black object has to come about four times closer to be seen: 3 cm at the middle setting. A robot with FC-51s runs into black chair legs for this reason.
The output. OUT is the LM393's open collector with the board's pull-up: a hard
low when something is there, and a 10 k high when not.
What it does not model
Sunlight, which is full of infrared and makes a real one see an obstacle that is not there; the 35 degree cone (anything on the slider is square in front); surfaces that are neither white nor black; and the board's response time. The comparator has no hysteresis, as on the real board, so a real one chatters with an object right at the edge of its range.
Common mistakes
Reading it the wrong way around: low means something is there.
Testing it in a sunny window, where a real one sees obstacles everywhere.
Expecting it to measure distance. It only says yes or no; for a distance use the HC-SR04.
See it in action
Touchless soap dispenser pumps one dose when a hand comes under the FC-51. Open it at /templates.