home
back

Wiring part 3 : DCC and district occupancy detection

Digital Command Control or DCC is a system that associates:
a power signal that supplies the trains
with a binary signal (Digital)
composed of different commands (Command)
transferred to trains to control their operation (Control).

This DCC signal can be used to control not only trains but also switches, signals, etc.. . .
Each user of the DCC signal (Locomotive, turnouts, etc... are equipped with a receiver (decoder) having an individual number (address) by which it can be selected and controlled.

On this layout, the DCC will be used only for controlling trains.
Nevertheless, it is implementing various automations, which in order to operate properly, must know the position of trains.
For this purpose, the layout are cut into 24 pieces called districts.
Each district will be equipped with a system to detect the presence of a train.

This districts system can be used indifferently on layouts powered by Digital or Analog signals both AC or DC.

This page is partly inspired by the work of Allan Gartner with his kind permission.
Visit his website about wiring and DCC, garden train and much more : Wiring for DCC (see links page).

DCC signal specifications


Here is an example of a clean DCC signal.

Voltage = 40 V peak to peak = 20 Vpeak

Period varies between 116 to 232 us.

=> frequency varies between 8.62 to 4.31 kHz.

The signal is rectangular with very low noise, this is the kind of signal you should be able to measure anywhere on your layout.



cablage_03_01



This DCC signal is transmitted by the main bus to different districts bus spread around the layout.

The length of the main bus should however be limited to maximum 10 m to avoid signal distortion due to parasitic components of the wires
(L inductance  R resistance  C capacity).

To limit this length, do not place the booster at the end of the layout, think about installing it to center position.

See the Position of Booster right in the middle of the layout.

The main bus starts from this point in 4 different directions to limit its length to a maximum of 4 m.


cablage_03_02


Districts definition

You will find below the district plans of my layout.


pdf
District plan first level
pdf
District plan second level A
pdf
District plan second level B    



Each district bus (secondary bus) has a "coupler" which connects it to the main bus.
This coupler consists of 2 x 2 1N5402 diodes mounted in opposite.

When a train is present in a district, the current consumption gives a voltage drop of 1.2 to 1.4 volts at the diodes terminals.
This voltage drop are measured by the detector and converted into digital signal (1 or 0).

These digital signals are then processed to command a switch, a retro-signs, etc. ..

If you use this system on a DC analog layout, only two diodes are needed.
cablage_03_04



Here are the "couplers" in reality.

Note that all buses are twisted as well as the AWG22 wires that connect the coupler to the detector.

Note that the diodes are "as close as possible" to the main and district buses.

Do not deport them, there would be additional losses and disturbances.

The maximum distance between detector and coupler should not exceed 50 cm, to avoid electromagnetic interference on the wires that connect them.
cablage_03_05



As usual in electronic industry, I try to prepare as well as possible the wiring work.

The 4 diodes 1N5402 and AWG22 twisted pair which connects them to the detector are pre-wired before installation.

This way of working limits the wiring time often uncomfortable under the layout.About the printed board, do the first print on paper and after printing, check  that the dimensions of the circuit are 160 x 100 mm.
It may be that your print program performs a scale correction.
If everything is correct, you can print the slide that will serve to make the printed circuit.
cablage_03_06



It just remains to install the diodes and connect the pair AWG22 to the detector.

Note, in the foreground, the power bus (black-blue-red) which supply the sensors and other electronic circuits, is also made of 1.5 mm twisted wires.
cablage_03_07


Current detector


 These 4 diodes are moved to the DCC bus coupler
cablage_03_08
R1 = 27 Ohms - R2, R3, R4, R5 = 10K - R6 = 2K2 - D4, D5 = 1N4148 - D3 = led rouge 3mm - C1 = 220uF - Opto = H11AA1 - IC1 = LM311

These components are available at any good electronics retailer otherwise, see RS Components on the "Links" page.


Detector's functional description


To limit the wires losses, the diodes D1, D2, D6, D7, originally intended to be mounted on the PCB, have been moved to the bus coupler as described above.
These 4 diodes should not be mounted on the PCB.

When the district is free, the output of the IC1 comparator (Out) is an open collector and the LED D3 is "Off. " When a train travels through the district, the output of the comparator IC1 (Out) goes to 0.4V and the LED D3 is "On. " This output can be used to control all kinds of automation, mini relay, etc.. . The comparator output is an "open collertor", this means that: In "occupied" position, when output = 0.4V, the maximum output current is 50mA. In position "free", the output provides a high impedance. If you want an output type "relay contact ", you just install a  mini-relay between the +12 V and output (Out). Examples of mini-relay:
Zetler AZ830-2C-12DSE  or  Omron G6A

Components C1, R5, D4, D5 serves as a relaxation delay of the comparator.
This means that the detector is set to "occupied" for 1 to 2s after the release of the district.
This prevents oscillation of the comparator due to a possible poor contact between the rails and train wheels.
If you want to change the delay, simply change the value of C1.
If C1 increases, the delay increases, the range of C1 is from 47 to 470 uF.

PCB printing : you better do the first print on paper, after printing, check that the PCB dimensions are 160 x 100 mm.
Sometimes, some printing program performs a scale correction.
If everything is correct, you can print the slide that will serve to insolate the PCB.

Below you will find the schematic, the components layout and the PCB of the detector.


pdf
Schematic
pdf
Components
pdf
P C B


DCC wiring tests

As we saw earlier (see wiring part 1 page), it is necessary to use fairly large section of wires and limit the contact resistances.
If you use a digital system, your control unit is certainly provided with a short circuits protection.
This protection should absolutely be tested before running the trains.
This test, called "coin test "by some U.S. modelers, must be performed everywhere on the layout and especially in most distant areas from the control unit or booster.
This validates the quality of wiring and various connections through the power bus.
Before perform this test, make sure that your control unit or booster is equipped with a short circuit protection !

He's crazy. . . ! He wants me to short circuit my tracks  in order to check my wiring !

In fact, if your wiring is done badly (wires too thin, poor contacts, etc....), when a short circuit will occur (eg derailment), the parasitic resistances accumulated will limit the short-circuit current and the control unit will not be able to activate its protection.
In this case, the undetected overload can cause wires overheating or even a fire !


Very simple to perform, this test is to short-circuit the rails with a metallic piece.

Perform this test everywhere along your layout and especially in areas most distant from the control unit or at places where wiring is "doubtful".

If you did a good job, the control unit or the booster must activate its protection instantly!

If not, check wiring in this part of the layout !

WARNING: During this test, you will stress your electrical wiring with a current equivalent to the short-circuit current defined by your control unit, be sure that all components can handle this current and especially, the detectors diodes.

The 1N5402 diode, used here, is rated 3 A and 200 A peak during 8.3 ms.
cablage_03_09


Wiring of the XpressNet bus

In order to communicate between different components of the DCC network,
LENZ (see Links) has developed the XpressNet bus based on the RS-485 communication protocol.
On this layout, I use this bus to communicate between the LZV100 control unit  and the LH100 or LH90 hand held controlers
This bus has 4 wires, 2 wires for RS-485 and 2 wires for power supply 12V and 0V.



To connect the hand held controler to different places of the layout, I use LA152 adapters.

Between LZV100 control station and these LA152,
I used a 4 wires shielded cable.

The shield protects the XpressNet signal from electromagnetic interference induced by other cables (DCC bus, mains, relay power supply, etc....).

cablage_03_10



Here is the LA152 adapter wiring.

Note that this side of the cable shield is not connected, to avoid ground currents the shield is only connected to the control station's ground.
cablage_03_11


home
back