The YL-105 is an IR tracking and obstacle avoidance sensor. It combines an infrared emitter and a phototransistor receiver on a small PCB with onboard comparator circuitry.
Common Applications:
| Problem | Likely Cause | Solution | |---------|--------------|----------| | Output always LOW | Threshold too low or magnet always present | Turn potentiometer clockwise to increase threshold | | Output always HIGH | Threshold too high or no power | Turn potentiometer counterclockwise, check VCC/GND | | Jittery output near switching point | No hysteresis | Add a 100k resistor from DO to non-inverting input, or use software debounce | | No response even with strong magnet | Wrong magnetic pole | Use south pole of magnet | | AO reads constant voltage | Hall sensor damaged or VCC unstable | Check VCC with oscilloscope; replace module if needed |
Connect DO to an Arduino digital pin with a pull-up resistor enabled (or use INPUT_PULLUP). Place a small neodymium magnet on a rotating shaft. Each time the magnet passes the YL-105, the output goes LOW. Use interrupts to count pulses per minute. yl-105 datasheet
Arduino Code Snippet:
int sensorPin = 2; volatile int pulseCount = 0;void setup() pinMode(sensorPin, INPUT_PULLUP); attachInterrupt(digitalPinToInterrupt(sensorPin), countPulse, FALLING); Serial.begin(9600);
void loop() // Calculate RPM every second // ...The YL-105 is an IR tracking and obstacle avoidance sensor
| Symptom | Likely Fix | | :--- | :--- | | Digital output never changes | Adjust the potentiometer (too sensitive or not sensitive enough). | | Detects only at 2mm distance | You need a 10k pull-up resistor on the DO pin (open-collector output). | | Onboard LED always on | The potentiometer is set too high; turn it counter-clockwise. | | Erratic readings on white surface | Add a 10µF capacitor between VCC and GND near the sensor. |
| Feature | YL-105 (Analog + Digital) | KY-003 (Magnetic Switch) | US1881 (Latching) | |---------|----------------------------|---------------------------|-------------------| | Output Type | Digital + Analog | Digital only | Digital (latching) | | Sensitivity Adjustment | Yes (potentiometer) | No | No | | Detectable Field Polarity | South pole only | South pole only | Both poles (latches) | | Best for | Adjustable proximity, RPM | Simple ON/OFF | Rotary encoders, door locks | void loop() // Calculate RPM every second //
The YL-105 wins for flexibility due to its analog output and adjustable trigger point.
Because “YL-105” is a module assembly rather than a single silicon component, there is no single official manufacturer datasheet from a major semiconductor house. However, you can obtain all necessary documentation by downloading:
Search strings to use: