GENERALINTEREST
Märklin Digital Model
Train Control (1)
From an idea by J. Schröder
This circuit provides an excellent opportunity to upgrade your Märklin
model train system from ‘traditional AC’ to digital control.
A low-budget approach
EEDTs, plus a short description of the latest
developments in the field.
The crux of digital model train control is
that several trains on the track can be con-
trolled independently. As opposed to tradi-
tionally operated tracks, where turning the
speed governor on the transformer puts all
rolling stock in motion at the same time, the
digital track is marked by each locomotive
having its own control element, allowing its
speed and direction to be controlled individ-
ually. In addition to this function, there is
often a plethora of options of the ‘bells and
whistles variety, including control of turnouts
and signals via the track. Unfortunately, how-
ever, these extras and their control are out-
side the scope of this article.
How does it all work, you may wonder.
With traditional control systems, a voltage is
Beginning model train enthusiasts
may have more digital-ready
(Märklin) locomotives moving about
on the track than they are aware of.
Usually, these locomotives are sim-
ply powered by the speed regulator
on the main transformer. These days,
model locomotives with an internal
digital decoder are hardly more
expensive than traditional types.
That is not surprising because elec-
tronic circuits are easier and cheaper
to produce in large volumes than any
of the traditional reversing relays.
Märklin always continued to produce
decoders capable of working in ‘AC’
mode as well, allowing them to be
used without problems with the
famous Märklin transformer. Upgrad-
ing to all-digital control is then pos-
sible at a later stage. Possible, yes,
but admittedly at a price because
the cost of the upgrade will easily
exceed that of all rolling stock.
Several attempts have been made
to lower the threshold. From 1987
roughly to 1991, Elektor Electronics
published items to create the all-
home-made EEDTs (Elektor Electron-
ics Digital Train System), a hugely
successful series! Some time ago,
Märklin introduced their Delta sys-
tem, which is actually a stripped
down version of the original Digital
H0 with limited addressing options
(4 instead of the usual 80). In fact, the
Delta system triggered the author to
design the circuit and software
described in this article. Many
Märklin locomotives come with a
Delta decoder fitted as standard,
instead of the traditional reversing
relay. These locomotives, too, are
controlled in old-fashioned AC mode
(i.e., by transformer speed regulator),
by the vast majority of model train
fans. The Digital Control discussed in
this article allows anyone and an old
PC in the attic, and capable of han-
dling a soldering iron, to get the feel of
digital model train control at a very
small outlay. So, if you do not yet
have a locomotive with a Delta (or
regular) decoder, you have a perfect
excuse to step inside a model build-
ing shop when it’s not December…
Recapping
Newcomers to the hobby can, of
course, not be expected to know all
the ins and outs of digital control for
model trains. Hence, a brief recap is
given of what we already described
in the long series of articles on the
GENERALINTEREST
Main Features
- Direct connection to PC parallel port.
- Simple to operate software (Windows 3.1x, 95, 96, NT) for individual control of up to 15
model trains.
- Controls Märklin Digital H0 stock using classic Motorola data format and Delta decoders.
- Integrated compact booster, max. 3.5 A output current, with overload protection.
- Powered by original Märklin transformer or single 15-VAC
- Manual on/off control of extra function.
Figure 1. Two trinary signals on the ‘scope: The top trace shows loco address 56 (X00X),
function bit = 1, speed = 7 (0001).Below, in stretched-display mode, logic 0 (00), logic
Open (10) and the start of a logic 1 (1…)
simply applied to the rails (alternating volt-
age in Märklin systems, direct voltage in
most others), where overvoltage (Märklin) or
polarity (other brands) provides information
about the direction the locomotive has to
travel in. With digitally controlled tracks, the
rails carry a signal that alternates between a
fixed positive and a fixed negative level.
Depending on the model train brand and
gauge, this voltage usually lies between
±12 V and ±18 V. The rate at which the volt-
age swings from + to – represents control
information for individual locomotives and, if
applicable, other devices like signals.
As with too many other products, the
industry did not succeed in agreeing on a
common standard in this field. Of the four dig-
ital systems originally available (Märklin Dig-
ital H0, Lenz, Fleischmann and
Selectrics), only the first two actually
got a foothold. In addition, Märklin
Digital H0 is now flanked by several
‘dialects’ including the EEDTs data
format and the ‘New Motorola
Dataformat’. Other brands, too, have
variants. In this article, we will limit
ourselves to Märklin Digital H0,
because that is the format recog-
nized by the system described here.
Märklin Digital H0 employs a
switching sequence once designed
by Motorola for use in remote con-
trols. Information is bundled into
packs of 18 pulses. In fact, these
pulses are pairs of two pulses each.
Three of the four combination possi-
bilities of the pulse pairs are actually
employed. 00 equals logic zero, 11
equals logic 1, and 10 is logic open.
In the original Motorola data format,
the combination 01 is not used — in
the New Motorola Dataformat, you
guessed it, it is.
A single data burst or packet con-
sists of nine pulse pairs. The first
four are used as (locomotive)
addresses, supplying 3
4
= 81
addresses of which only 80 are used
by Märklin. The remaining five pairs
are only decoded in binary fashion:
00 or 11; with bit 5 flagging the
on/off state of the extra function, and
bits 6-9 containing speed and engine
reversing commands.
GENERALINTEREST
BOOT1
SENSE
L6203
BOOT2
IC1
OUT1
VREF
OUT2
IN1
ENA
IN2
GND
11
10
VS
9
3
4
7
1
2
6
5
8
ULN2803A
IC3
VEE
+VS
11
12
13
14
15
16
17
18
I1
I2
I3
I4
I5
I6
I7
I8
O1
O2
O3
O4
O5
O6
O7
O8
10
1
2
3
6
7
8
4
5
9
R8
4x 10k
1
2
3
4
5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
CON1
8x 10k
1
2
3
4
5
6
7
8
9
R11
R9
22k
R10
47k
C8
1n
12
13
11
IC2d
≥1
1
2
3
IC2a
≥1
6
5
4
IC2b
≥1
9
8
10
IC2c
≥1
C11
100n
C10
100n
C4
220n
J1
C5
15n
C6
15n
R3
1
Ω
5
5W
R4
1
Ω
5
5W
R5
10k
R6
10k
K3
K4
C9
10n
R1
560
Ω
R2
560
Ω
T1
BC547B
T2
BC547B
D2
GO
D1
STOP
S1
STOP
S2
GO
B1
KBPC601
C3
4700µ
35V
C2
2200µ
40V
C1
2200µ
40V
T3
BC547B
C7
10µ
16V
R7
2k2
D3
5V6
400mW
JP1
MC145026
A1/D1
A2/D2
A3/D3
A4/D4
A5/D5
A7/D7
A8/D8
A9/D9
A6/D6
IC4
RTC
CTC
D0
15
16
10
13
12
RS
11
TE
14
1
8
2
3
4
5
7
9
6
IC2
14
7
K1
K2
PWR
PWR
FUNCTION
on
off
U
U
U
U
PWR
U
PWR
000066 - 11
IC2 = 4001
*
*
12 - 16V
see text
*
siehe Text
*
voir texte
*
zie tekst
*
Figure 2. Circuit diagram of the Märklin Model Train Control System. The control elements, a mouse and your PC keyboard, are not
shown here.
technology, we need not concern ourselves
too much with switching speeds or power
dissipation. At the maximum output current
of 3.5 A chosen for this circuit, the L6203
remains reasonably cool. With insufficient
cooling, an internal overheating protection
arranges for the IC to be switched off once a
certain temperature limit is exceeded. Com-
ponents C5 and C6 are so-called ‘bootstrap
capacitors’ which serve to ensure a suffi-
ciently high gate voltage on the two power
MOSFETs in the upper section of the bridge.
The output current flows to ground via the
sense connection and R3-R4. These resistors
serve to monitor the maximum output current
because the L6203 is not wholly and truly
short-circuit proof. The voltage developed
across R3 and R4 is fed to the input of NOR
gate IC2b via R5-C9, a low-pass filter to sup-
press inevitable switching pulses. Together
with IC2c, the NOR gate forms a bistable
with a special ‘treat’ in that IC2b is (mis-
)used as an analogue comparator. Standard
CMOS circuits are designed to switch at
about half the supply voltage. If the voltage
at pin 6 of IC2b reaches 2.5 V (which happens
at 2.5 V / 0.75
Ω or 3.5 A), IC2b and IC2c tog-
gle.
The enable input of the L6203 is then
pulled low, the bridge is switched off, and the
tracks are disconnected from the supply. The
green GO LED, D2, also goes out and its red
counterpart, D1, marked STOP, lights. When
this happens, switch S2 may be used to
rerestart the circuit. A stop condition may be
forced by operating switch S1.
The two remaining gates in IC2 are used
to supply the bridge with the normal and
inverted digital signal.
The 5-V logic supply voltage is derived
from the unregulated power supply. A zener
diode is used in combination with emitter fol-
lower T3 acting as a power buffer, because
the input voltage conditions are rather uncer-
tain. If, for example, a Märklin transformer is
connected and the speed control knob is
turned back to the train reversing position, an
alternating input voltage of 24-30 V appears
at the supply inputs. When rectified, that
would produce an input voltage surge that is
sure to endanger the life of a 7805 voltage
regulator. With D3 and T3 included, the cir-
cuit will withstand this abnormal condition.
The output bridge can also safely handle this
voltage surge of up to 52 volts.
(000066-1)
Next month’s second and final instalment will
cover the system software and hardware con-
struction.
Some time ago, Märklin intro-
duced the so-called New Motorola’
data format, in which all four combi-
nation options are allowed (00, 01, 10
and 11). The extra combinations in
the function bit and the remaining
four bits are used for non-volatile
direction information and extra
switching functions. The standard
Motorola encoders and decoders,
however, are unable to process these
pulse pair combinations.
Finally, we should mention that a
pause with a certain length is
inserted between the 18-pulse pack-
ets. This is done to synchronize the
transmitter and the receiver. The
packet has length of about 3.8 ms,
while the pause takes about 2 ms.
As an extra safety measure,
Motorola have built in a protocol that
arranges for the receiver to be sup-
plied with the same data packet
twice in sequence for it to be recog-
nized as valid. This protocol appears
to be surprisingly effective for all
rolling stock moving at considerable
speed across the track.
The circuit
The circuit diagram shown in Fig-
ure 2 is of an attractive simplicity.
The core is formed by IC4, a
Motorola encoder chip type
MC14026 which looks after all con-
verting into serial digital format of
data received from the PC parallel
port. In a way, the encoder IC also
restricts the operation of the circuit: it
is capable of generating the old (tra-
ditional) data format only. This
allows standard and Delta locomo-
tives to be controlled. Decoders from
other brands (for example, Lenz) or
decoders having the four extra func-
tion outputs utilizing the New
Motorola data format can not be
used in conjunction with this circuit.
Darlington array IC3 acts as an
interface between the parallel port
on the PC and the encoder chip. The
first four outputs are used to set the
locomotive address on the decoder.
Because the open-collector outputs
are not fitted with pull-up resistors,
the status of the address lines is
always Low or High-Z. The ability to
set a High-Z status is essential
because the Delta addresses defined
by Märklin all have ‘logic open’ bits.
If the encoder were connected
directly to the parallel port, it would
not have been possible to activate
any Delta decoder at all!
The second nibble of the parallel
port is used for setting bits 6-9 on
the encoder. These bits contain
speed information and the reversing
command: the bit combination is
1000.
Bit 5, the function bit, is given a
fixed state with the aid of a jumper
or switch (JP1) and is therefore on or
off for all locomotives to be
addressed. That should not be a
problem because this bit usually
controls the lighting function, which
is preferably on by default. Only the
oldest EEDTs decoder employs bit 5
for (non-volatile) direction informa-
tion. Hence that decoder can not be
used with this circuit, because
changing the state of JP1 would
cause all trains to reverse. Later
EEDTs loco decoder variants, includ-
ing the most recent EEDTs Pro, are
fully compatible with the present
system.
Components R9, R10 and C8
determine the timing of the encoder.
Resistor R9 determines the length
(duration) of one packet of 18 pulses
(3.8 to 4 ms), while R10 takes care of
the synchronisation pauses between
pulse packets.
Originally, the circuit was
designed for direct connection to the
EEDTs Booster. However, the
Booster, with its 10-amp output cur-
rent capacity and considerable cost
and effort of building may be too
much of a good thing, and beyond
the reach of beginners. That is why
the present circuit comes with its
own mini booster, IC1, which is
short-circuit as well as overload
resistant. To keep the cost of build-
ing the project down to the absolute
minimum, it is possible to connect
the existing Märklin transformer and
use it as a power supply. Using B1
and C1/C2 (or C3, see construction
details), a single direct voltage is
derived from the transformer’s sec-
ondary voltage. A full bridge output
stage has to be chosen to enable a
single-rail input voltage to be turned
into an output voltage that switches
between a positive and a negative
value. The L6203 from ST Microelec-
tronics combines the required func-
tions in a single IC. Plus, because
the IC is manufactured in DMOS
GENERALINTEREST