void loop() digitalWrite(relayPin, HIGH); // turn relay ON delay(2000); digitalWrite(relayPin, LOW); // turn relay OFF delay(2000);
Whether you are automating your home, building a robot, or designing a safety cutoff, the YL105 offers a reliable bridge between the fragile world of microcontrollers and the demanding realm of high-power electronics. Always respect the voltage ratings, adhere to proper wiring practices, and consult the SRD-05VDC-SL-C and PC817 datasheets for deeper technical insight. yl105 datasheet
| | Likely Cause | Solution | |-------------|------------------|---------------| | Relay does not click | No power on VCC | Check 5V and GND connections. | | Relay clicks but load doesn’t turn on | Wrong wiring (NC vs NO) | Load should be connected to COM and NO. | | Random toggling | Floating input pin | Use a pull-down (active HIGH) or pull-up (active LOW) resistor (10kΩ). | | Microcontroller resets when relay activates | Power supply insufficient | Relay coil draws ~80mA. Use a separate 5V supply for module. | | Jumper setting ignored | Poor contact | Remove/insert jumper multiple times or solder the desired connection. | 8. YL105 vs. Other Relay Modules How does the YL105 compare to similar modules? void loop() digitalWrite(relayPin, HIGH); // turn relay ON