Encoder Design
Introduction
What is DCC you ask?
It stands for Digital Command Control and it's
a NMRA Standard
for controlling model trains.
What's so cool about DCC?
Unlike traditional controllers that simply
vary the voltage to the track regardless of where the trains are, DCC
controllers digitally communicate with a decoder inside the locomotive.
The power on the track is constant and it is the decoders that actually
control the motor speed and direction. This means...
- A locomotive can be controlled wherever it happens to be on the layout.
- Multiple trains can be controlled without having to worry about
switching points correctly and isolating sections from each other.
- Forwards is always forwards and backwards is always backwards, it
doesn't matter which way round you place a locomotive on the track
it knows which way is forward.
- There is permanent power to the track which means lights can be
always on regardless of the train's speed.
- Extra functions on the train can be controlled such as switching
on the headlights or starting a snow-blower!
- Accessory decoders can be attached to the track anywhere
which means you can operate electric point motors remotely without
having to run wires everywhere.
- You can cause head-on collisions!
Can DCC be used with LEGO Trains?
Yes and no. The main problem with commercially available DCC systems
is that they are designed for 12V systems whereas LEGO trains are
9V. 12V would most likely fry a LEGO motor. It might be possible to
program a commercial decoder to limit the maximum speed but this
isn't something I've investigated.
There is very little room inside a LEGO train motor but having
taken one apart there does appear to be enough room to install
an N-Gauge decoder.
Partially completed N-Scale decoder
How about building a custom DCC System for LEGO Trains?
Well that's what I've been working on. It's a long way from
completion but I've made significant progress. In this
mockup you can see what the system will look
like. The large black box is the encoder and has two unmodified
LEGO train controllers attached to it (up to 4 are possible with this
box). Note the red "panic" button used to avert disasters such as
an imminent head-on collision.
The encoder runs in two modes, slave mode and master mode.
In slave mode it is attached to a PC via the parallel port and
a Windows 95 program controls the trains, you can then use the mouse,
keyboard or the LEGO train controllers for speed control.
In master mode, the PC is disconnected and only the LEGO train
controllers can be used.
Here is the encoder control board and an
inside view of the box.
I have built a
prototype decoder inside a 9V battery box.
This has enabled me to make a few hardware modifications and also
lets me attach a programming cable to make some firmware modifications.
The changes I have made are mainly to allow the train motor to
continue to work on a non-DCC layout.
This type of decoder can also be used as an accessory decoder for
controlling point motors as seen in this picture.
Note how the decoder gets its power (and DCC signal) from the track.
Project Progress Report
As yet the system is not fully operational, as I make more progress
I will publish the results here, including detailed schematics
of the encoder and decoder boards and the firmware that runs
on them.
14Jun98 Prototype decoder built into LEGO 9V battery box. This will
be used for testing decoder firmware and later will be converted to
an accessory decoder for controlling points etc. Verified modifications
to original design to allow it to still operate in analog mode (non-DCC mode).
12Sep98 Encoder version 1 built. Communication with PC tested and
working, allows PC to read the control knob position of up to
four LEGO train controllers. (Additional A to D chip will allow
eight).
06Mar99 Encoder is working, generated DCC packets and sending
them successfully to a decoder. I gave up building my own decoder and
tried one supplied by Dave Hinkle. Two were tried, an MRC ADC330
which works fine, and a Digitrax DN140 which has some problems that
need fixing.
08Mar99 MRC Decoder installed inside a LEGO motor. Works great!