This is only a preview of the January 2026 issue of Silicon Chip. You can view 35 of the 104 pages in the full issue, including the advertisments. For full access, purchase the issue for $10.00 or subscribe for access to the latest issues. Articles in this series:
Items relevant to "DCC Base Station":
Articles in this series:
Items relevant to "Remote Speaker Switch":
Articles in this series:
Items relevant to "Earth Radio, Part 2":
Purchase a printed copy of this issue for $14.00. |
By Tim Blythman
Decoder
Base Station
Using DCC
Remote Controller
DCC Booster
DCC Base Station
Image source: https://unsplash.com/photos/
a-toy-train-traveling-through-a-lush-green-forest-rxBE5UF-Dsk
Following on from the DCC Decoder last month, the other main component needed to add DCC to a
model railway is a DCC Base Station. It provides power and data to the tracks. It’s based on a Pico 2
microcontroller module connected to an LCD touchscreen, so it’s easy to customise.
D
igital Command Control (DCC) is a system
to operate model railways in a more
realistic fashion than previous
techniques such as DC/analog voltage control. The latter involves using
a controller to apply a voltage to the
tracks, connected straight to the locomotive motor via wheel pickups, to
allow control of speed and direction.
To turn a conventional analog
model railway into one using DCC
requires specific equipment in the
locomotives and for the controller.
The DCC Decoder from last month
can be installed in a model locomotive to enable DCC operation. That
article also covered some of the background of DCC.
The DCC Decoder receives power
and commands from a DCC base station. It then controls the motor and
lights in the locomotive according to
those commands. The DCC base station thus takes the place of a controller in a DCC system.
The DCC standards are maintained
by the NMRA (US National Model
Railroad Association) and our designs
have been tested to work with commercial gear from brands such as DigiTrax,
NCE, TCS and DCC Concepts.
siliconchip.com.au
On page 49, we have a detailed guide
on working with DCC. It will focus on
using our Decoder and Base Station,
but much of it will also be applicable
to commercially available devices.
The Base Station
There is quite a bit of variety in what
might be expected from a DCC base station. Some, like the Complete Arduino DCC Controller (January 2020;
siliconchip.au/Article/12220) rely on
a computer running the JMRI (Java
Model Railway Interface) software.
JMRI can show layout maps, mimic
panels, rolling stock rosters and can
even automate operations.
At the other end of the spectrum are
simple base stations that are designed
to allow simultaneous operation of
a few locomotives and allow some
amount of decoder programming;
enough for someone converting to DCC
for the first time.
Features & Specifications
🛤 Designed for small HO/OO and N scale operations
🛤 Pluggable screw terminals for easy connection to tracks
🛤 PCB front panel to suit UB3 Jiffy box or on a custom control panel
🛤 DC jack for plugpack, or screw terminal power inputs
🛤 Controls for five locomotives including speed, direction and four functions each
🛤 Automatic current sensing with adjustable trip limit
🛤 128 speed steps
🛤 Uses a Raspberry Pi Pico 2 and 3.5in 480×320-pixel LCD touchscreen
🛤 Main track output: up to 10A
🛤 Supply/track voltage: 8V-22V (don’t exceed 17V with our DCC Decoder)
🛤 Programming track output: limited to 250mA
Australia's electronics magazine
January 2026 35
At a minimum, the base station
needs to have a processor of some sort
to process user input and encode the
DCC data for output. The user input
might include selecting a decoder
address or a request to send programming data to the track, as well as the
operation of locomotive controls. Some
sort of driver is needed to generate the
DCC signal for power and control.
There are systems that even provide
a means to connect extra user panels.
Since DCC is intended to allow more
than one train to operate, it makes
sense to allow multiple users to have
control over the data that is transmitted, more on this shortly.
On a hardware level, a base station
must be able to drive the DCC track
voltage, which is an AC square wave
about 12V-15V in amplitude (24V-30V
peak-to-peak) with a frequency varying around 6kHz. There should also be
some current sensing and circuit protection, since the output could easily
be a few amps or more, and it isn’t too
hard to accidentally short the tracks.
Our Base Station is intended as a
simple and economical way to try out
the world of DCC, but it still offers
many features. All the controls are
based on a 3.5in LCD touchscreen
showing one of five different ‘pages’,
each of which can be allocated to a
decoder address. There are also pages
for performing DCC programming and
configuring the Base Station itself.
We have also designed a DCC
Remote Controller unit that can connect to an expansion port on the Base
Station. Each Remote Control can
control three locomotives; multiple
Remote Controls can be connected in
daisy-chain fashion to a Base Station.
We will present the DCC Remote Controller add-on project next month.
Hardware
The hardware for the DCC Base Station is fairly simple, so let’s start by
looking at the circuit in Fig.6. Modulation of the main DCC signal is handled
by two BTN8962 half-bridge drivers,
IC2 and IC3. These are the same drivers
used in the Arduino DCC Controller,
and can handle up to 30A, so should
be robust in a circuit limited to 10A.
Each chip drives one of the rails
to either 15V or ground under the
control of signals DCC1EN, DCC1A
and DCC1B from the Pico 2 module. If DCC1EN is low, both INH pins
are low and the drivers are disabled
36
Silicon Chip
(high-impedance). When DCC1EN is
high, the outputs of IC2 and IC3 follow the inputs DCC1A and DCC1B,
respectively.
We’ve provided 1kW series resistors
to afford some protection to the Pico 2
in the event of a critical failure of the
driver ICs. When their high-side drivers are active, IC2 and IC3 source current from their IS pins in proportion to
the current flowing to the output; the
ratio is approximately 1:10,000. Since
only one driver is active at a time, we
combine the currents through dual
diode D2.
This current develops a proportional voltage across the 1kW resistor
at its cathode. The 10kW resistor and
100nF capacitor smooth out peaks
due to the varying DCC signal, and the
voltage is sampled by one of the ADC
(analog-to-digital converter) pins of
the Pico 2 via GP27 so it can monitor
the track load current.
The outputs of IC2 and IC3 are connected to CON1, a pluggable screw terminal. Bicolour LED1 and its dropping
resistor provide a visual indication of
the voltage output at CON1. There is
also a 100kW resistor that pulls the INH
pins of IC2 and IC3 low if they are not
otherwise driven.
The driver for the programming output does not need to be as powerful,
so we have used the same DRV8231
motor driver (IC1) as in the Decoder.
The standards indicate that a programming output should be limited
to supplying 250mA; the 3.7A-rated
DRV8231 will handle that with ease.
IC1’s control signals connect on
lines DCC2A and DCC2B via 1kW
series resistors. Its Vref pin is fed
from 3.3V and with a 0.1W resistor on
the ISEN pin, the current limit is set
to 3.3A. The voltage across the 0.1W
resistor is monitored by an ADC pin on
the Pico 2 to allow the programming
current to be measured.
We apply the 250mA limit through a
pair of 2W 33W resistors on the driver
outputs, which can handle short-
circuit conditions continuously with
up to 16V at the input. The programming output is intermittent and only
active for seconds at a time under
direct supervision of a user, so we
think this will be adequate.
The resistors provide this soft limiting to prevent the DRV8231 from
shutting down its outputs, since that
would corrupt the DCC data stream.
The outputs from IC1 are available
Australia's electronics magazine
at CON2 and are shown by bicolour
LED2. The presence of a short circuit
will be obvious, since LED2 will not
light up when expected.
Other circuitry
The MOD2 LCD panel needs seven
data lines to interface an SPI-mode
controller to its LCD driver and touch
controller; these are taken from appropriate pins on MOD1. MOD2’s LED
backlight is driven by P-channel Mosfet Q1 from the 5V Vsys rail. Q1 is in
turn switched by Q2, which is controlled by a pin on the Pico 2, GP3.
The 10kW/1kW divider combined
with a 1μF capacitor across the incoming supply from CON3/CON4 is connected to the last free analog/ADC
input on the Pico 2. This allows the
supply voltage to be monitored and
displayed.
Two of the remaining free pins
are connected to CON5 (a four-way
header) and CON6 (an RJ45 socket) for
connection to external control boxes,
along with the 3.3V and ground rails.
We have chosen the GP0 & GP1 pins
since they are capable of both I2C and
UART (serial) operation. They have
2.2kW pullups to the 3.3V rail.
S1 connects to the 3VEN pin on
MOD1; when this line is pulled low,
by S1 being pressed, the 3.3V supply
on the Pico 2 is shut down. This can be
siliconchip.com.au
Fig.6: The Base Station
circuit is based on the Pico 2
microcontroller module, MOD1,
and an LCD touchscreen, MOD2.
The incoming supply powers
these through buck regulator
REG1 and also feeds IC1, IC2 and
IC3. Those three chips provide the
DCC outputs under the control of
MOD1.
used to reset both the Pico 2 and any
connected control boxes, since they
are also powered from 3.3V. An external momentary pushbutton connected
in parallel with S1 could be used to
provide an emergency stop feature.
Power supply
A DC supply of 8-22V is provided
to either CON3, a DC jack, or CON4, a
pair of screw terminals. These are connected in parallel with the intent that
one or the other is used. The DC jack
should be good for up to 5A, while the
screw terminals can handle up to 10A.
We’ve specified an 8V to 22V supply voltage range because those are the
siliconchip.com.au
limits set by the DCC standards. The
components on this rail are all rated
up to 30V. You’ll also need a suitable
DC power supply wired with a positive tip. A basic 12V supply capable
of at least an amp will be sufficient to
run some tests and operate the Base
Station and a few small locomotives.
Fuse F1 provides circuit protection,
with reverse-connected diode D1 forcing the fuse to blow in the event of a
reverse-polarity voltage being applied.
This arrangement is preferred at higher
currents, since the polarity protection
diode must carry the full current at all
times if arranged for reverse blocking.
The 1000μF capacitor provides the
Australia's electronics magazine
bulk bypassing for the supply. REG1
is used to provide the low-voltage rail
for the microcontroller and display
modules. It is a switch-mode device,
since we will be driving a backlight
(typically 300mA) at 5V, dropping
around 10V from the supply. A linear
regulator would dissipate 3W or more
if used here.
REG1 is an MCP16311, the same
device we used in the Homemade 78xx
Switchmode Regulator from August
2020 (siliconchip.au/Article/14533).
The circuit here is much the same as
the 5V version of the Switchmode Regulator, although we have used common E12 resistor values of 56kW/10kW
January 2026 37
to give a nominal output of 5.3V with
a 0.8V reference voltage.
This is a classic buck regulator circuit, with inductor L1 storing energy
between switching cycles under the
control of REG1. The 5.3V rail has a
100μF electrolytic capacitor for filtering, and the circuit includes the
four ceramic capacitors needed by
the regulator.
Since the 5.3V rail passes through
schottky diode D1 to the remainder of
the circuit, we have near enough to 5V
at the point of use. Connected to D1’s
cathode is pin 39 (Vsys) of the MOD1
Pico 2 microcontroller module, along
with the MOD2 LCD touch panel module supply.
The Pico 2 has its own diode from
the USB supply feeding into the
Vsys pin. These diodes prevent back-
feeding from the regulator to USB or
vice versa. A connection to MOD1’s
micro-B USB socket can also be used
to provide power to the low-voltage
(5V and 3.3V) circuits for testing.
Software
From the hardware, we can see that
we have a high-power (up to 10A)
driver output that will be used for
the main DCC track signal. The second driver output will be used for the
programming output. We can monitor
the drive currents via two of the ADC
inputs, with the incoming supply
being measured by the third.
The Pico 2’s second processor core
spends most of its time monitoring
the CON1 current so that it can react
promptly if there is a fault. If the current limit is reached, the output is
switched off for one second, then back
on. It might switch off again
immediately if the fault has
not been cleared.
This core also measures the other analog channels when needed.
Both DCC signals are provided by a
callback function from a timer interrupt; the interrupt triggers every 58μs.
DCC uses pulse lengths of 58μs (nominal) to signal a binary ‘1’ and a pulse
length of 100μs or longer to signal a
‘0’. Two 58μs periods are used to generate a 116μs pulse length for transmission of a ‘0’.
The callback function provides digital signals to control IC1, IC2 and IC3.
It processes each packet’s bits in turn,
and flags when it is ready to receive
the next packet. A packet takes around
6ms to deliver, so our main software
loop simply needs to supply fresh
packets as needed.
If there is no data available,
so-called ‘idle’ packets can be sent to
keep valid DCC traffic on the rails. This
can occur if the processor is otherwise
busy doing other processing, such as
updating the display.
All display pages in the user interface have buttons for switching the
DCC output off and on, so power can
be shut off to the track immediately if
there is a problem. A stop button also
sets the speed of all locomotives to
zero. The voltage and main track current are also shown at all times.
The main control page provides five
tabs, each of which can be allocated
a DCC locomotive address. There are
controls for speed, direction and function (eg, lighting) outputs. Two packets are needed to send all this data
for each locomotive, so a queue of 10
packets is kept updated and sent in
round-robin fashion.
The interior
layout is similar to
many of our LCD BackPack
projects, with the LCD screen connected to a
main PCB assembly via a 14-way header & tapped spacers.
38
Silicon Chip
Australia's electronics magazine
When a control is changed, such as
a speed control being adjusted, a priority system allows the relevant packet
to be output as soon as it is changed.
This makes the system more responsive to user input.
There are two other pages. One provides settings pertaining to the Base
Station and includes things such as
calibration values for the current and
voltage readings and user-settable
parameters, like a software-controlled
current limit.
Programming output
The remaining page controls the
DCC signal on the programming track
output at CON2. In general, at most
one decoder (and thus locomotive)
should be connected to the programming track. This is because ‘service
mode’ programming does not distinguish locomotive addresses.
CON2 supports direct, paged,
physical and address-only programming modes. Of these, direct mode
is the newest and fastest, although it
has been around for at least 20 years
already, so most modern decoders
should support it. We recommend
using this mode unless it does not
work with a specific decoder.
Programming involves writing values to certain CVs (configuration variables) to change the behaviour of the
decoder. Physical mode only supports
a very limited number of CVs, while
paged mode supports more through
the use of a page register.
Service-mode programming relies
on specific patterns of packets, including repeated packets and so-called
‘reset’ packets to ensure that programming does not occur unless intended.
These patterns are noted in the standard, but we have also validated them
against the output of a commercially
available DigiTrax base station.
DCC also implements an acknowledgement feature, which can be used
to read back data programmed into
decoders. The acknowledgement
involves the decoder loading the output with a 60mA or higher load; typically, by briefly driving its motor
outputs.
Thus, the Base Station can also perform a read-back of CVs to check their
values or confirm them after writing.
Our circuit allows the acknowledgement to be seen as LED2 dimming due
to the load on the 33W resistors.
The Programming page can also
siliconchip.com.au
send operations-mode programming
packets. They are not sent via the
CON2 programming track; instead,
they go to the main track via CON1
instead. These packets are addressed,
so they use the currently selected
decoder address from the main pages.
There is no read-back, since operations
mode does not use the acknowledgement scheme described above.
We’ll look more closely at the software operation after the Base Station
has been completed. Our separate article will also provide more detail about
programming decoder CVs with the
Base Station.
Control panel
If you are planning to fit the Base
Station into a larger panel, such as the
control panel for an existing layout,
then we recommend that you use the
panel PCB as a template to trace the
outline of the shape.
Tracing around the main PCB
(before it’s assembled) will give you
an idea of the amount of material you
need to cut out of your panel to fit the
Base Station assembly into it. The LCD
panel mounting holes can be used to
align the two PCB outlines.
You will probably have your own
ideas about what connectors you will
use, so you may not want to fit the
standard connectors until you have
worked out how it will connect to
your layout.
If you don’t think you’ll use the
CON6 remote control connector, the
tab that protrudes from the PCB can
be carefully snapped off. This means
that a hole does not need to be cut in
the case for CON6. It can still be fitted later, since the traces do not cross
onto the tab, but it will lack mechanical support.
Construction
Start by assembling the main PCB,
which is coded 09111244 and measures 130 × 68mm. Most components
are on the top, including the majority
of surface-mounting parts. The smallest parts are M3216 size (imperial
1206), so construction is not too difficult. Gather your SMD equipment and
consumables, including flux paste,
solder wicking braid, tweezers and a
magnifier.
Begin with the SMD parts on the top
of the PCB, followed by the two SMD
parts on the reverse. After cleaning
off any flux residue, the handful of
siliconchip.com.au
Parts List – DCC Base Station
1 Base Station PCB assembly (see below)
1 black panel PCB coded 09111244, 130 × 68mm
1 3.5in LCD touchscreen module (MOD2) [Silicon Chip SC5062]
4 M3 × 8-10mm black panhead machine screws
4 M3 × 6mm panhead machine screws
4 M3 × 12mm tapped spacers
4 M3 nylon hex nuts
1 UB3 Jiffy box [Altronics, Jaycar, Bud Industries CU-1943]
1 DC power supply to suit layout (see text)
Base Station PCB assembly
1 double-sided PCB coded 09111243, 55 × 131mm
1 Raspberry Pi Pico 2 microcontroller module
programmed with 0911124B.UF2 (MOD1)
1 14-way 0.1in socket header strip (for MOD2)
2 2-way 5mm/5.08mm pluggable screw terminal blocks (CON1, CON2)
[Altronics P2592 + P2512, Jaycar HM3102 + HM3122,
or Dinkle 2EHDRC-02P + 2ESDV-02P]
1 PCB-mounting DC barrel jack (CON3)
1 2-way 5mm/5.08mm screw terminal (CON4; optional)
1 4-way 0.1in R/A locking header (CON5; optional, for remote control)
1 RJ45 PCB-mount socket (CON6; optional, for remote control)
[Altronics P1448 or P1448A]
1 22μH 1.3A SMD inductor, 6×6mm (L1)
1 6 × 6mm through-hole tactile switch with short (~1mm) actuator (S1)
2 M205 fuse clips (F1)
1 M205 fuse to suit PSU (F1)
1 small tube of neutral cure silicone or similar to secure the capacitors
Semiconductors
1 DRV8231DDAR motor driver IC, SOIC-8 (IC1)
2 BTN8962TA half-bridge drivers, TO-263-7 (IC2, IC3)
1 MCP16311(T)-E/MS buck regulator, MSOP-8 (REG1)
1 SSM3J372R or AO3401(A) P-channel Mosfet, SOT-23 (Q1)
1 2N7002 N-channel Mosfet, SOT-23 (Q2)
1 SS14 40V 1A SMD schottky diode, DO-214AC (D1)
1 BAT54C dual common-cathode SMD schottky diode, SOT-23 (D2)
1 1N5404 or 1N5408 3A silicon axial diode, DO-27 (D3)
2 3mm bicolour red/green LEDs (LED1, LED2)
Capacitors (all SMD MLCC, M3216/1206 size, except as noted)
1 1000μF 25V radial electrolytic
1 100μF 25V radial electrolytic
5 1μF 50V X7R
4 100nF 50V X7R
Resistors (all SMD M3216/1206 size, ±1%, ⅛W except as noted)
1 100kW
9 1kW
1 56kW
2 33W M6332/2512 size, 2W
4 10kW
1 0.1W
4 2.2kW
The DCC Base
Station is a simple but
complete system for starting out with DCC.
The Base Station has controls for five locomotives. We
have also designed a DCC Remote Control that can provide extra controls.
Figs.7 & 8: the board uses a mix of
surface-mounting and through-hole
components and modules. Most
components are on the top side of
the PCB, but we have placed F1 on
the back to allow easy
access if needed.
through-hole parts and modules can be
fitted. Figs.7 and 8 are the overlay diagrams for the top and bottom, respectively. You can find photos of the PCB
assembly on earlier pages.
Regulator REG1 comes in an MSOP
package with the closest pin pitch on
the board, so start with it. Spread flux
paste over the pads on the PCB and rest
the chip in place. If you can’t see the
pin 1 marking on the silkscreen, it is
near the 56kW resistor. Tack one lead,
check the positioning and then solder
the remaining pins when it is correctly
placed and flat against the PCB.
Follow with the SMD diodes and
transistors, being sure not to mix up
the three different SOT-23 parts. Single diode D1 must have its cathode
stripe facing correctly, towards the
‘K’ on the PCB.
Follow by soldering IC1, then IC2
and IC3. Since IC1 will be operating
at a small fraction of its limit, we have
opted not to solder the exposed thermal
pad on its underside. Tack one lead,
adjust and solder the remaining leads
when you are happy with its position.
40
Silicon Chip
For IC2 and IC3, be sure to add a
generous amount of flux to the pads
before placing the part, and turn up
your iron if it is adjustable. Tack one
of the smaller leads in place, then add
a good amount of solder while applying your iron to the large tab and pad
near CON1.
If your iron cannot provide enough
heat, you can try preheating the board
or supplementing the iron with a hotair tool. When the solder flows freely
and the flux is smoking, you will know
that the joint is solid. Finish by carefully soldering the remaining leads.
The remaining SMD parts are all
passives. Inductor L1 is larger than
the others, so solder that now while
the iron is hot, then turn it back down
for the remaining passive components.
All the values are marked on the silkscreen, so take your time and make
sure that they are all placed correctly.
Finish with the two 100nF capacitors
on the back of the PCB.
Clean off any flux residue using your
choice of solvent and allow the PCB to
dry. Inspect it closely for bridges, dry
Australia's electronics magazine
joints and pads that do not
have solder adhering correctly. Fix any problems
before proceeding.
At this stage, the circuitry around REG1 is
complete, so you can test
it by applying a current-
limited power supply
(such as a 9V battery) to
the pads of the (not-yet
fitted) 1000μF capacitor.
You should see 5.2V-5.4V
on D1’s anode relative to
ground (the negative lead of either
electrolytic capacitor).
Programming the Pico 2
We suggest programming the Pico 2
now, since it will be more difficult to
access its BOOTSEL button when the
LCD is affixed above it. We also recommend using the flash_nuke.UF2 firmware image to ensure that the Pico 2’s
flash memory is blank first, although
this should not be strictly necessary if
the Pico 2 is brand new.
Hold the BOOTSEL button on the
Pico 2 and connect it to the computer, then copy the flash_nuke.UF2
file to the RP2350 virtual drive that
will appear. Wait for the drive to disappear and then reappear, then copy
the 0911124B.UF2 firmware. The LED
on MOD1 should light up, indicating
that the firmware has been loaded correctly and is running.
The remaining through-hole
components
For simplicity, we recommend soldering the Pico 2 directly onto the
siliconchip.com.au
PCB, surface-mount style. You can use
headers, but since full-height headers
would be too tall, you will need to
use low-profile headers and no sockets. That will work, but the clearance
is very tight.
The 14-way header socket for the
LCD can also be fitted now. Make sure
all headers are mounted squarely; you
can use MOD1 and MOD2 to align
them. Solder CON1 and CON2, the
pluggable screw terminals, and follow
with your choice of CON3 or CON4,
since only one of these is needed.
You should also fit either CON5 or
CON6 if you plan to use the Remote
Controller. We preferred to use the
RJ45 socket (CON6), since we can use
standard Cat 5/6 cables to connect
Remote Control units. Next, mount
the fuse clips for F1 (with the retention tabs on the outside), large diode
D3 and the 100μF capacitor on the rear
of the PCB. You can slot a fuse into the
clips to keep them aligned.
Switch S1 and the 1000μF capacitor are the last parts on the top of the
PCB. Make sure to bend the capacitor
leads the right way before soldering
and add some glue or silicone to secure
the capacitor bodies to the PCB. Leave
off LED1 and LED2 for now.
To fit the LCD panel and align the
LEDs, start by attaching the M3 ×
10mm machine screws to the front
panel PCB using the nylon nuts. The
nuts will act as spacers for the LCD
panel below. Slot the LCD panel
over the screws, making sure that the
14-way header is at the end opposite
the LED holes in the panel. Secure the
LCD panel with the tapped spacers.
Now guide the LEDs into their holes
on the main PCB, but do not solder
them. Their polarity does not matter,
since a DCC signal is effectively alternating current. Attach the LCD panel
assembly to the main PCB, making sure
that their 14-way headers connect.
Secure the main PCB using the M3
× 6mm machine screws. Bring the
LEDs up so that they are just poking
out through the front of the panel and
solder them in place, then trim the
LED leads and check that you have
a fuse fitted. The rating of the fuse
should match that of your chosen
power supply.
Initial checks
The 5V-powered parts of the Base
Station can be supplied from the Pico
2’s USB socket, so USB power is sufficient to check that the processor and
LCD touchscreen are working. Connect USB power to the Pico 2 and see
that the LCD backlight switches on
and Screen 1 is visible on the panel.
Verify the touch panel calibration by
trying some of the buttons. The default
touch calibration should work for all
3.5in panels, but there are parameters that can be edited if it does not.
Check the “Arduino library and software” panel overleaf, as this has more
details on adjusting the calibration and
customising the software. If all is well,
disconnect the USB cable.
Testing and setup
A 9V battery is a good choice for a
current-limited power supply, but just
about any plugpack that can deliver a
few hundred milliamperes at 8V-22V
Screen 1: the SET and PR buttons can be used to access
Screens 2 and 3, respectively. One of the five tabs can be
selected using the L1-L5 buttons, while the address can be
changed by using the button at upper left.
siliconchip.com.au
should be sufficient. Check that the
Base Station powers on and that the
voltage display at lower right matches
the power supply voltage. The displayed current should be 0.0A.
The SET page (Screen 2) holds the
calibration parameters (I1x, I2x, Vx
and IO/S). The software current limit
for the main track is ILIM. Most of the
calibration parameter defaults should
be usable, but the current offset (IO/S)
can vary wildly.
This parameter is due to IC2 and
IC3 producing a non-zero current signal at zero current, so the offset setting is necessary to cancel this out. If
you use a different supply voltage, this
may change. If you wish to redo this
calibration, reset the IO/S parameter
to zero before doing so.
Make sure nothing is connected to
the MAIN (CON1) output and change
the ILIM parameter to 9A by pressing
the ILIM button and typing 9 ENTER
on the on-screen keypad. Press the yellow ON button, which should cause
the MAIN LED to light. You should
be able to see that both the red and
green elements are on in the LED; if
not, then there is likely a fault in one
of the drivers.
The current display should also
show a non-zero value around 4A to
5A, although anywhere between 1A
and 9A can be expected according
to the BTN8962 data sheet. Take that
reading and enter it in the IO/S field.
The current reading should now drop
to 0A with the offset applied.
Now adjust the ILIM value to suit
your power supply. All values are
immediately saved to flash memory,
Screen 2: apart from the calibration parameters, the button
at lower right saves the currently selected locomotive
selections (L1-L5). Pressing this button should show
SAVED, after which L1-L5 will be automatically loaded
when the Base Station is next powered on.
Australia's electronics magazine
January 2026 41
so you don’t need to perform an extra
step to save them. The other parameters should be within a few percent
without adjustment, so should not
be changed unless you have an accurate way of measuring the voltage and
currents.
Enclosure preparation
The panel PCB has been designed to
fit a UB3 Jiffy box; Figs.9 & 10 show the
cut-outs needed to fit the assembly into
this box. We have not included holes
for CON4 or CON5, since we have not
used them in our prototype.
The 6mm hole for the CON3 DC jack
suits our power supply, but you may
need to enlarge it if your plug has a
short shaft. If you’re planning to use
CON4 instead, you can make a hole in
front of that for wires to pass through.
Similarly, if you plan to use CON5
instead of CON6, you could omit the
rectangular cut-out for the RJ45 socket
and drill a hole for wires to pass
through instead.
The three rectangular holes can be
made with vertical cuts from the top
of the case. Score the horizontal cut
with a sharp knife and snap off the tab
with pliers. The round hole is simply
drilled with a twist or step drill.
The PCB assembly takes the place
of the Jiffy box lid, and can be secured
using the screws that are provided
with the box.
We prefer to
surface-mount the
Pico 2 module.
If you find that
the holes are slightly misaligned, you can trim the sides of the
holes using a sharp hobby knife.
Using it
We’ll now take a look at the basic
operation of the Base Station. Those
who have experience with a DCC system should be able to take what they
need from these brief instructions.
Note that only 128-step speed instructions are issued. For more details about
getting started with DCC for the first
time, refer to our separate article in
this issue, starting on page 49.
When the Base Station is powered on, it starts on the main page,
seen in Screen 1. Buttons L1-L5
select the active locomotive, which
is highlighted. The controls above
this operate on the active locomotive. The top left button can be used
to change the selected address controlled by L1-L5.
DCC uses two types of addresses; a
short address is seven bits, and is valid
between 1 and 127, although values
above 99 are generally avoided since
they conflict with some programming
packets. Long addresses are 14 bits and
are valid from 1 to 10239, enough to
hold all four-digit numbers.
In both cases, zero is not valid, so it
is used to indicate that the tab is inactive. This is shown as three dashes in
the address box.
Any address entered with three or
more digits is treated as a long address.
To use a long address in the range of
DCC Base Station
Short-form Kit
(SC7539, $90):
includes everything in
the parts list, except
for the case, power
supply, glue, CON4 &
CON5 headers
42
Silicon Chip
Australia's electronics magazine
siliconchip.com.au
Screen 3: the
default of DIR
(direct) mode
programming is the
newest and should
work with all
modern decoders
(including our own
design from last
month). You can
use this to read or
write the decoder’s
CVs (configuration
variables).
1 to 99, add leading zeros to pad the
value to three or more digits. Long
addresses are displayed with five digits using leading zeroes.
There are a few safety interlocks
in the code. You cannot set two tabs
to use the same decoder address, and
you cannot change an address without
reducing the speed to zero first. That
helps to prevent conflicting control
commands and runaway trains!
The REV, FOR, STOP and F0-F3 buttons control the commands that are
sent to the addressed locomotive. F0
has a toggle action, since it is usually
used for controlling a light such as a
headlight. You might see it referred to
as FL for this reason.
F1 and F2 are momentary-action and
are typically used to control a horn or
whistle. The four indicators above the
buttons show the state. F3 is provided
with a toggle action, so there is another
latching control available.
Switch on the DCC track power
(ON) if it is not already. To operate a
locomotive, enter its address at upper
left, then select the direction (FOR or
REV) and switch on the headlight (F0)
if needed. Drag the slider to change
the speed, which is displayed with
the direction on the top line.
Pressing the yellow STOP button
will set the speed of all locomotives to
zero, while OFF can be used to shut off
power in an emergency. The current
display will be green if it is below the
limit, or red if it has tripped. You will
also see the MAIN LED go out when
a trip occurs.
Screen 3 shows the page used for
CV programming. This is accessed
through the PR button on the main
page. DIR, PAG, PHY and OPS refer to
direct, paged, physical and operations
mode programming, respectively. DIR,
PAG and PHY modes occur on the
CON2 programming track, while OPS
packets are sent to the CON1 main
track to the currently active locomotive, as selected by L1-L5.
Power is only applied to the PROG
output when a read or write is occurring on the programming track, so you
will see the PROG LED light up during
these times. Pressing BACK during programming will cancel the operation.
The CV to be programmed is entered
with the CV# button. It can be read
with the READ button, with the value
shown below it if the read was successful. A value to be written is entered in
the box below WRITE and pressing the
WRITE button performs that action.
The status of the last or current action
is shown at the top of the page.
The LONG address is actually a
pair of CVs (17 and 18). They can be
edited separately, but the LONG button manages the value of both of these
together when reading or writing a
long address. Press LONG instead of
entering a CV# to access this mode.
Note that you will need to set the long
addressing bit (CV29, bit 5) to activate
the long address once set.
Other information
The Software panel overleaf has
more information on the libraries
used in writing the software for this
project, so you should have a look at
that if you wish to compile the sketch
yourself. Our separate feature article
has more depth on using our Decoder
and Base Station as a complete system. We recommend reading it if you
are new to DCC.
The Decoder article from last month
also has information about the most
common CVs, including all that are
implemented by that Decoder. That
article also includes a glossary of DCC
terms.
Figs.9 & 10: with
rectangular holes
abutting the top edge of the
case, it is not difficult to make
the cuts needed. Once the PCB
assembly is complete, you can use
it to judge whether any of the holes
need trimming.
siliconchip.com.au
Australia's electronics magazine
Conclusion
The DCC Base Station is a simple
but complete control unit for DCC
Decoders. Once you have built it,
adding Decoders to the locomotives
on your layout will provide most of
what is needed to convert a layout to
DCC operation.
January 2026 43
Arduino library, software & screen calibration
This panel provides a bit more background on the libraries and other code that are used for anyone interested in
compiling the Arduino code, either to make some tweaks
or perhaps create your own version. We’ll also discuss how
to calibrate the touch panel.
The following assumes that you have an assembled
Base Station PCB connected to a 3.5in LCD touchscreen
or, at least, the same wiring between a Pico 2 and the LCD
panel. A solid background using the Arduino IDE would
help. Many of the functions used by the main sketch are
in the util.h file. Near the top of this file are some defined
colours, so you can adjust the colour scheme easily. The
dcc.cpp and dcc.h files contain the DCC-specific drivers.
LCD driver
The LCD driver library is the main external library we have
used, and this is the TFT_eSPI library. It can be found at
https://github.com/Bodmer/TFT_eSPI or installed by
searching for TFT_eSPI in the Arduino Library Manager.
We also use the TFT_eWidget library (https://github.com/
Bodmer/TFT_eWidget) to draw the GUI elements. These
libraries are quite powerful and offer anti-aliasing on the
fonts and GUI elements, so the display looks very nice.
You will need to install these libraries and any dependencies they require. Rather than using a configuration within
the sketch, this library uses a global (library-level) configuration for the display pinout and driver selection. You will need
to set this up before doing anything else with the library.
The code for this configuration is noted in the util.h file.
It requires creating a profile in the “libraries\TFT_eSPI\
User_Setups” folder to suit the display type and wiring;
this is the PICO_ILI9488_DCC.h file that you will find in the
software bundle.
Then edit the User_Setup_Select.h file to include the
PICO_ILI9488_DCC.h file as the active configuration. This
configuration will now be used for all sketches compiled
with this library, so you can try any of the example sketches
using the Base Station display hardware. You can subsequently change configurations by editing the User_Setup_
Select.h file.
The Examples → Generic → Touch_calibrate sketch can
be used for touch panel calibration. Upload this sketch
and open the serial monitor. Run the calibration, and the
results are displayed on the serial monitor. The
updated values can be used to set the calData
array in the main sketch file before compiling.
That’s all there is to changing the calibration.
tool at https://vlw-font-creator.m5stack.com, we converted this into a VLW file using a size of 36pt. We then
used the HxD hex editor program to convert the file data
into a byte array that could be embedded in the sketch; this
is the asimov_36.h file.
DCC code
The DCC code has been written with the Pico/Pico 2 architecture in mind, so you will need the arduino-pico board
profile installed. The DCC code depends on this profile
and the Ticker library that calls the DCCcallback() function every 58μs.
The code provides functions to create all manner of
DCC packet types with both long and short addresses.
The main track DCC output implements a short queue that
can be filled with the queuePacket() function. If the queue
is empty, the code will produce idle packets to keep valid
data on the track.
As the DCCcallback() function consumes the packets,
new packets can be added. For the most part, the software updates an array of the 10 packets that are needed
to control the state of the five locomotive outputs. As the
queue empties, the software cycles through the array and
delivers each of the 10 packets in turn.
There is a loco_t data type that can be used to hold the
information (speed, direction, address etc) about a decoder.
Most packets can be created directly from the loco_t object
using straightforward function calls.
For the simplest implementation of a mainline track
output, create a loco_t object and set its various elements
(address, speed, direction etc). Create two dccPacket_t
objects and call the speedPacket128() and F04Packet()
functions to load these packets with speed and function
data, respectively. Use the packetQueueSpace() function
to see if there is space in the queue and, if so, queue the
packets with the queuePacket() function. Keep updating
the loco and packets, and continue queuing fresh packets
as needed. The DCC output can be switched on and off
with the dccSwitchOn variable.
The programming track output works slightly differently;
it doesn’t have a queue. It is expected that the packets for
the programming track are managed from a tight loop that
produces
the specific packets as needed at the
correct times.
SC
Fonts
The anti-aliased fonts used in this project
require a different data format than we have
previously used. The asimov_36.h file contains the font data we created to suit this display. There are online tools to create custom
font data from computer font files.
We started with the open-source Asimov
font in the OTF font file format. Using the
The RJ45 socket on the right-hand side of
the Base Station can be used to connect extra
controllers. Next month, we will introduce our design for a Remote
Controller which includes a display, speed potentiometer and six buttons.
44
Silicon Chip
Australia's electronics magazine
siliconchip.com.au
|