Rob Paisley designed a DCC block occupancy detector using a Vitec (TM) 57P1820G current sense transformer. I believe the NCE BD20 Block detector is similar. These circuits recognize block occupancy by detecting current being drawn through the track by locomotives, cars with lights or rolling stock with resistor wheels. A very simplified version of the design is shown at right. The Dig and Gnd terminals of the circuit are connected to a processor input configured with an internal 10k pull-up. The connection supplying power to a DCC track block is wound a few times through the transformer.
The capacitor charges through the pull-up resistor when there is nothing drawing current across the track. This is illustrated on the left side of the plot as the capacitor voltage increase until it reaches the supply voltage. The digital input on an Arduino processor recognizes a high input when the input is above 0.6V.
When something on the track draws current, the transformer generates voltage spikes whenever the track polarity changes. Current from negative going spikes flows through the diode. Current from positive going spikes flow through the base-emitter of the transistor causing it to discharge the capacitor through its collector-emitter junction. Successive DCC polarity reversals continually discharged the capacitor keeping its voltage near ground resulting in a low at the digital input.
.DCC packets are constantly transmitted, causing track polarity to change within 100 usec. This is shown in the plot at the 20 msec mark when the capacitor voltage is held near zero for as long as current is drawn through the track. The plot illustrates the capacitor charging at the 40 msec mark when the block become un-occupied.
The Paisley circuit uses 556 thresholds to distinctly recognize the detector circuit level as low and high at 1/3 and 2/3 supply voltage. It also uses the 556 outputs to provide an active and open-collector output. With the processor input part of the detector, there's no need for such an output. Software can also be used to debounce the input to guard against any digital level ambiguity.
This simplified design requires fewer components, allowing more circuits in less space, and is passive, requiring no power connections. Since it's output is essentially open-collector, the circuit can be located some distance from the processor.
Testing
The circuit was tested by connecting the output through a 10k resistor to a 5V source and measuring the voltage at the output, the capacitor. A wire was looped the specified number of turns through the transformer, in series with an LED and 1k resistor to a track driven by an NCE PowerCab. The circuit was also tested with a hand wrapped transformer with only 50 turns. The output voltage drops with more turns. Sensitivity will depend on the threshold for high/low of the input circuit. The Atmel mega328 processor in an Arduino recognizes a high at 2.4V and a low at 2.1V. Since it is a current that is being detected, a transformer with a smaller number of turns is more sensitive.
1 2 3 4 5 6 Turns Detector Output Using 5V Reg Supply LED/1k 5.0 5.0 4.6 3.7 2.2 0.6 Volts Detector Output Using 5V & ~50T Transformer LED/1k 4.2 2.7 1.0 0.49 0.44 0.43 Volts
Turnout Position Detection
A modified version of the block detection circuit can be similarly used to determine turnout position by monitoring the voltage difference between a turnout frog and one of the main rails. In one position, the voltage will be the same. In the other position, there will be a difference.
I've placed an LED and resistor across this path to visually indicate the turnout position on the fascia. Similar to the block detection circuit, current will flow through either the LED or transistor base-emitter junction depending on polarity. When there is a voltage difference, the capacitor will repeatedly be discharged and in the other position, allowed to charged.