## Internal operation of a decoder

### Diagram of a commercial decoder

This is the LD-G-5 model of Tams Elektronik GmbH, a German brand. I chose this decoder example because its internal electrical diagram is published by its manufacturer, which is rare, and because this diagram is quite simple and perfectly illustrates the generic operation of a DCC decoder. Here is the diagram.

Everything coloured green on this diagram has been added by me to make the operation explanations easier, without going into details however.

First, the green rectangles delimit numbered functional subsets which I will explain later. Then, I drew the motor connection (the circle with an underlined M) and an LED connection to an auxiliary output.

As the diagram is not necessarily very readable, here are some clarifications. The two leftmost terminals (X2, X3) are to be connected to the track (red and black wires). The terminal above (X1), from which I drew a green line marked Vcc, is the positive common (blue wire). The two terminals at the top right (X10, X11) are the motor terminals (orange and grey wires). Finally, the bottom right three terminals (X5, X4, X7) are the auxiliary outputs (white, yellow and green wires).

### Deciphering the diagram

Let us transform this rather complex diagram into a functional diagram, also called block diagram.

Normally, since all details are removed, it should look much clearer! Here is the explanation for each block.

Block ① is the rectifier. As everybody knows, the DCC current into the track is alternating, formed by rectangular waves. However, the electronics must be supplied with direct current, hence the need for this rectifier. The continuous nature of the resulting current is further improved by the capacitor C2 visible in the detailed diagram. The voltage obtained is applied to two different blocks: ② and ④.

The block ② is used to supply a voltage adapted to the microcontroller ③. Indeed, the latter requires a voltage of approximately 5 V, whereas the rectified DCC voltage can range from 14 V to more than 20 V (which is not recommended).

The microcontroller ③ thus receives this voltage, but also a signal coming directly from the track: it is the DCC code itself which will give commands to the microcontroller, such as: accelerate, light the front lights, etc. In fact, all the decoder complexity is programmed here.

Block ④ is the power unit of the decoder: it receives the rectified voltage and a control signal coming from the microcontroller. It drives the motor with an “H-bridge”, a term that derives from its appearance (see the H drawn in the detail diagram). In this circuit, only two transistors (acting as switches) can conduct simultaneously: the one in the top left with the one in the bottom right, which gives the first direction of rotation (first diagram); the one at the top right with the one at the bottom left, which gives the opposite direction of rotation (second diagram). In these diagrams, the current flow is indicated by red lines. The rotation speed depends on the conduction time of these transistors with respect to their non-conduction time. This is called : a small duty cycle will give a low speed, and a large one will give a high speed. To the limit, if the transistors conduct all the time, the duty cycle is equal to 1 and the motor receives the full rectified voltage.

Finally, the blocks ⑤ purpose (there are three on this decoder) is to amplify the current of the auxiliary logical outputs, here by means of NPN transistors. It may be assumed that, on more recent decoders, use is made of MOS transistors.

Strictly speaking, the duty cycle is the ratio between
the conduction time tC and the sum of the conduction
and non-conduction times:
Rcy = tC / (tC + tNC).
It can therefore vary between 0 (if tC = 0) and 1 (if tNC) = 0).