IR Relay Control
This project shows a simple way to detect a near object (like a model train passing) and activate a relay.
Supplies
5 volt relay module
IR detector module
Make sure the little yellow jumper is placed close to the "L" end (the IR sensor goes low when it detects an object).
Connect according to this schematic. The power supply used is 5 volts dc. The small blue potentiometer can be turned to adjust sensitivity.
When the object is close, the relay will close (note the small red light on the relay module). When the object is not close, the relay will open.