NLMS - Dutch ModelRailroad -

Occupancy detector 1.


In this article I describe a simple self-designed, circuit that detects trains in a section of track, called a block. Just like the real railroad, by dividing the layout in different sections, blocks, multiple trains can run together at once.

With electronics, or even a computer, we can make a circuit for a safe operation, almost like CTC. With block occupancy a train will slow down and come to a stop if the section, block, ahead is occupied. Because of this, this circuit needs to know if a section of track is occupied or not. This could be a train, locomotive or even an uncoupled car,

My detection circuit monitors the current drawn from a locomotive. To detect a car a 1 K ohm resistor needs to be mounted across the wheels of an axle. The resistor will draw some current, which this detection circuit will pick-up. A passenger car can also be detected if it is equipped with lights, lights also draw a current.

To be insured of a well working detection, I have a reference voltage on the track of about 5 volts. This reference voltage is as low as possible to not move the locomotive, but high enough to create a voltage drop for the opto coupler to detect an axle with build in resistor.

During testing, on my test layout, I found the best value to be around 5 volts. This is where the locomotive did not move and detection was guarantied.

The schematic:

Parts: Connection:

R1 = 33 ohm
R2,3 = 1K ohm
R4,5 = 330 ohm
C1 = 47 F
D1,2,3 = 1N4001
D4,5 = LED
T1,2 = 2N4401
O1 = 4N25 of 4N35

A lot off 1 K ohm resistors
for the axles.

The + from the track power goes to X, this might be an ordinary power unit but also a fixed or adjustable power supply.

Y goes to the + rail of the track. This section of track will be detected.

The 5 volt power supply for the electronics, not the track reference voltage, will be connected to the 5 volt and ground, on the schematic at right.

A and B are the output from the detector, which are logical 1 or 0, depending whether the track, at Y, is occupied.


Track power is attached as follows. The -, ground, goes directly to the track, and the + attaches to connection X, and trough Y it continues to the section of track. This is the detected block. When an locomotive, or a car with an axle with a build in resistor, rides or stand still in this block, a current is flowing trough the diode's, D1, D2 and D3, this creates a voltage drop of 0.6 volt per diode, and totals 1.8 volts.

This voltage drop does not depend on the amount of voltage from track voltage, this is a characteristic of the diode which is used in this circuit, as long as there is enough voltage, 1.8 volt, for the three diodes. When a silicium diode conducts current, it has a 0.6 volt drop. The opto coupler, O1, is trough a resistor with this 1.8 volt activated. The transistor part of the opto coupler, the output, new energizes two transistors, T1 and T2, through the resistors R2 and R3, which will make a logical 0 and 1. When I made my test layout I was not sure to switch with 0 or 1 signals, that's why I build both options.

Output A is logical 1 when the block is empty, and logical 0 when occupied.
Output B is logical 0 when the block is empty and logical 1 when occupied.

Both LED's, D4 and D5, are indicators to aid in troubleshooting. On the circuit board you can see at once in what state the detector is. Ofcourse both the resistors R4 and R5 are to protect the voltage over the LED's.

The diode's D1, D2 and D3 have to be able to handle the current pulled by the train. The 1N4001 is able to survive about 1 amp., but for higher currents you are to use a different type. A bridge rectifier, contains 4 diode's, can also be used.

Also important to know is that in normal use, an opto coupler wear, and will become defective. This is because the led burns in the light sensitive transistor. Over time this will lower the output signal. This is one reason I don't let the opto coupler do all the work, hence the transistors T1 and T2. Luckily opto couplers are not expensive, and I used IC sockets, which simplify the replacement of the opto couplers.

The parts are easily available in the USA. In Europe you will have to replace the transistors with a European NPN spec. I used common NPN switching transistors, so probably a BC547 will do.

My circuit works together with TTL IC's, but can also work with conventional relays. The power supply can be made 9 or 12 volt, of course the value from the resistors will have to be changed. With this you can control a relays or any other system, there are plenty of possibilities. The focus of detection is around the opto coupler. The controlled electronics is completely separated from the track power.

The axle with resistor:

How to make a detectable axle, or better, how to install a resistor in an axle?

I had this problem. First I bought a few different axles, both different brands and material. The best resistors I found to be the small 1/8-watt. For N-gauge this might be a different story however. My first attempts destroyed the axles, by trying to solder the resistors to the wheel. This did not work, they got to hot and the plastic insulator melted.
I have found an easy way.

One wire end of the resistor is cut to about 5 millimeter. This I bend into a hook, which will mount against one wheel. The side with the plastic insulator.

The other wire end of the resistor will be turned tight around the axle. The resistor will be fixed to the axle with some superglue.

When this dried, I "paint" the resistor wires to the axle and wheel with a special conductive pen.

One check to test the 1 K ohm resistance axle, and when all is ok, I paint the assembly black to camouflage it. See the photos.

Here three photos's of the circuit board with eight detectors, good for eight blocks.


So far this article about detection.

There are more ways of detecting a train, maybe better, maybe simpler, but this circuit works to my satisfaction.

I do have two more schematics from other people that I will study, and perhaps for the future, I use some of their ideas.

This page is last updated on 15 July 2012

NLMS - Dutch ModelRailroad -