Simple Train Detector Using A Photocell 

The new modules we were building at the Nottawasaga Model Railroad Club (NMRC) had some stub-ended hidden tracks for staging trains.

Fellow member, Bill Payne, and I were looking for a train detection circuit that we could use to know when an engine or car was getting close to the end of the track.

We wanted a simple, inexpensive circuit that did not rely on track current because we don't know if the club will stay DC or switch to DCC. We found a circuit on the Internet posted by Mark Rollins at It appeared, on paper at least, to be just what we were looking for.

model train detector schematicTrain detector circuit by Mark Rollins

Mark's description explains that the detector responds when anything blocks the light reaching the photocell. This circuit can trigger a crossing bell or lights or simply turn on a light to let you know the location of the train. You could even use it to turn on the lights in a factory when a freight car is spotted at a loading dock, turn on a sound module or some animation. It has many possibilities.

The photo shows our test setup.

model train detector test setupSetup to test photocell circuit

We used the meter to set the Tech II DC throttle to approximately 12 volts. The circuit can be set up for 12 or 6 volts DC.

We used my ACE Circuit Evaluator board to make the test board. This allows small-gauge wire (Bell wire) to be inserted along with any components. There is no soldering required. It is easy to insert or swap components.

The circuit, as designed, drives a relay. The contacts on the relay will then drive whatever you want, depending on the voltage you apply. In our case, for test purposes, we ran the same 12 volts to the relay and hooked up a 12 volt bulb to simulate the light that could be installed on the module's fascia.

Unfortunately, when we tried to power up the circuit it wouldn't work! It was a simple matter to check that we had inserted all the connections in the proper holes. Then we used the meter to check that we were getting 12 volts at the right places. We even tried changing the components one at a time. Neither Bill or I are mathematicians and I have never learned how to calculate the voltages and current. 

We can read a circuit, but do not have the experience to evaluate a circuit or design one. We proceed more by trial and error. 

In this case we determined that the voltage was far below what was necessary to turn on a light or the relay. We finally decided that the 22k ohms resistor before the trim pot was the culprit. We wondered if the drawing was wrong and that 22 should have been 2.2k ohms. We put two 1k ohm resistors in series (because we happened to have some) and, lo and behold, the circuit functioned as planned.

Even if you don't have any experience with building electronic projects, try your hand at building one. This track detection circuit is easy to build. Mark's diagram is easy to understand because it has drawings of all the components. He has used readily available, inexpensive components.

Try it for yourself. There's a lot of satisfaction in getting something like this to work. It's like moving from a "built up" model to a "shake the box" model. Maybe a little more daunting than that, but soon you'll be tackling more "craftsman-type" electronic projects.

Elsewhere on my website are more sophisticated circuits. I used some photocell circuits from LogicRail that worked very well on my home layout. John Houghton designed and built his own circuits for his N gauge layout and for our NMR train club. Have a look at what John did by going to the NMR page. There's are links below and in the right hand column to Our Train Club.

Go from "train-detector" to Model Railroad Wiring.

Go to Signal circuits.

Go to Our Train Club.

Go to Track occupancy using CTs for detection.

Go to Making your own signals.

Go to the Modular Overview page with more on our NMR club.

Return from "train-detector" to my Home Page.

Return to Top

How to make Social Media work for you

New! Comments

Have your say about what you just read! Leave me a comment in the box below.
Copyright© 2008-2017