void loop() // Check if data is available from the YL-105 if (mySerial.available()) // Read the byte and write it to the hardware serial monitor char c = mySerial.read(); Serial.print(c);
Today, we are doing a deep dive. Let’s look at how this board actually works and how to use it reliably in your projects.
If you are building a battery-powered ESP8266 or ESP32 project, the YL105 is the better datasheet choice. yl105 datasheet better
Most users assume they can source current from an Arduino pin to drive the IN pin high. While true, the improved datasheet would clarify that the YL-105 is more robust when used as a . Why? Because the onboard LED and base resistor are referenced to VCC. When you pull the IN pin low (sinking current), the path is direct to ground, avoiding voltage drop issues from the MCU's output driver. A superior datasheet would include a driver recommendation: "For best noise immunity, drive the IN pin with an open-drain or open-collector configuration, or use an active-low signal."
5-meter specialized cable included for immediate installation. void loop() // Check if data is available
The datasheet is better than online tutorials because it confirms you must disable interrupts during the 40-bit read. If you use delayMicroseconds() without disabling interrupts, you will get CRC errors. Use noInterrupts() and interrupts() in Arduino, or portDISABLE_INTERRUPTS() in ESP-IDF.
void loop() int moisture = analogRead(analogPin); // 0 (dry) – 1023 (very wet) int wetDetected = digitalRead(digitalPin); // LOW = wet Most users assume they can source current from
void setup() // Initialize hardware serial for monitoring Serial.begin(9600);
The YL-105 is a popular, low-cost capacitive soil moisture sensor. Unlike its resistive counterpart (the YL-69 or FC-28), the YL-105 uses a copper-plated probe to measure dielectric constant. In theory, this prevents corrosion. In practice, without a better datasheet , you face calibration hell.
A truly better datasheet would be a living document, including application notes, oscilloscope captures, and a failure mode analysis. Until then, treat every YL-105 datasheet as a starting point, not an ending one. Probe the signals, test the limits, and always— always —design with a safety margin. In the world of relay modules, the difference between a prototype and a product is the quality of the questions you ask of the datasheet. Ask better questions, build safer circuits.