To make the two modules function together each module needs
to be supplied with regulated +5V (more on this later) and the
output from the sensor is wired to the input of the relay mod-
ule – that’s all there is to it. To prevent soldering directly to the
pins on the sensor module, I cut off 3 female sockets from a strip
of header sockets (SAMTEC BCS-130-L-S-TE, for 0.01” pins on
0.100” spacing) and soldered to the sockets.
7
7. The two modules interconnected.
8
8. The sensor mounted below the track.
Optical Train Detection - 7
If you wield a hot soldering and solder quickly, there’s no harm in
soldering directly to the pins. On the relay module the wires go
directly into the screw terminals. For how the detectors modules
are interconnected see [7]. The red and black wires carry +5V
and ground respectively to the modules and the gray wire car-
ries the signal between the two modules.
Reading the LEDs
Both the sensor and the relay module have surface-mount
red LEDs on them. When the sensor detects an object, the
LED lights up. Similarly when a logic low signal appears on the
relay module’s input pin, it’s LED lights up and the relay pulls in
(which you can hear).
These LEDs are handy for troubleshooting, but the likelihood
of having to troubleshoot this circuit is low. The potentiom-
eter on the sensor board adjusts the detection range, turning
the screw clockwise increases the range. At maximum range a
white index card is detected at about an inch and a blackened
card is detected at about half an inch.
The LED in the source is an infrared LED and, therefore, not
visible when powered; but if you want to see the LED light up,
look at it with your cell phone’s camera or your digital camera;
most of their sensors can ‘see’ in the infrared.
Connecting and testing the modules
The output of the relay will go to your signal system; either as a
switch closure on detection (the normally open contacts) or as
a switch opening on detection (the normally closed contacts).
Since the relay module has a hefty 10-amp relay, this set-up
can also be used for automation as it can switch track current
MRH-May 2014