This is only a preview of the July 2026 issue of Silicon Chip. You can view 37 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. Items relevant to "Adjustable Ultrasonic Cleaner":
Items relevant to "Phenomenal Pinball Machine, Part 2":
Items relevant to "DCC Accessory Decoders":
Items relevant to "I2C Controller":
Purchase a printed copy of this issue for $14.00. |
By Tim Blythman
μDCC Decoder
Accessory Decoder
I2C Controller
2
I C Controller
Destination Display
for DCC Accessory Decoders
Programming accessory decoders can be tricky, even though the
standards provide for it, since not all base stations provide the capability.
This small board makes it easy to program our DCC Accessory Decoders.
It only requires power and two signal lines on an I2C bus, so it could be a
handy device for other projects that need a simple user interface.
A
s we noted in the DCC Accessory Decoders article, it can be tricky to program accessory decoders. They
are usually permanently wired to the
main track circuit, so they can only
be programmed in ‘operations mode’.
There are means for bidirectional
communication in operations mode
(to read back and verify programmed
values), but that requires extra hardware, both on the decoder and on the
base station.
Providing a display and user controls for each Accessory Decoder
would make this much easier, but that
would be a waste as it would sit idle
most of the time and you’d need one
per decoder. It would also make the
Decoder larger, harder to build and
more expensive.
This I2C Controller is a simple
removable device that provides a display and some buttons. One Controller
can be used to set up several Accessory Decoders, one at a time, then be
put aside for future use. We also think
that the I2C Controller might come in
handy for other projects that require
a similar interface.
In this article, we’ll describe the I2C
Controller and its construction. We’ll
also detail how it can be used with the
DCC Accessory Decoders described
elsewhere in this issue, including programming their CVs and monitoring
their operation.
Circuit details
The circuit of the I2C Controller is
shown in Fig.1. CON1 is a four-way
header that has the SCL and SDA I2C
signals, plus ground and power. This
connects to a matching header on
the DCC Accessory Decoder (or other
device that needs a control interface).
The Decoder provides power and
acts as an I2C master. LED2 is simply
a power indicator LED with a 1kW
series resistor.
The I2C Controller provides several I2C slave interfaces that can be
controlled by the master. The first of
these is an OLED module, MOD1. It
contains a display controller IC, a 3.3V
regulator (for the display controller)
and pullups from the SDA and SCL
lines to 3.3V.
IC1 is a PCF8574 (or PCF8574A) I2C
IO expander (IC1); this also connects
to the I2C bus at its pins 14 and 15. IC1
is powered from the supply at pins 8
and 16. These are bypassed by a 100nF
capacitor. Three pins (1, 2 and 3) are
pulled low to set the I2C sub-address of
DCC PROJECT KITS
Snap-type Accessory Decoder (SC7685, $40)
includes the PCB and all onboard parts, including the electrolytic capacitor
Servo-type Accessory Decoder (SC7686, $40)
includes the PCB and all required onboard parts
I2C Controller (SC7690, $30)
includes all the parts in the parts list overleaf
80
Silicon Chip
Australia's electronics magazine
IC1 to zero. This means that a PCF8574
will appear on address 0x20 and a
PCF8574A on address 0x38.
Eight of the remaining pins are
designated as quasi-bidirectional I/O
pins. In practice, these are open-drain
outputs with weak internal pullups.
The chip also implements a pullup
accelerator that briefly applies a stronger pullup as the open-drain output is
switched off. Pin 13 (INT) is an output
that is triggered on an I/O state change
and is not used here.
The open-drain arrangement means
that the pins can be safely pulled to
ground without causing a conflict.
IC1 has commands to read its I/O pin
state and to control its open-drain outputs. Switches S1-S4 are connected
between the I/O pins and ground, so
a switch closure is detected as a low
level by IC1.
LED1 is a two-pin bicolour LED,
with each lead connected to another
of IC1’s pins. They are also pulled up
to the supply by 1kW resistors. When
one of LED1’s leads is taken low by IC1,
current flows into the resistor on the
other lead and out via the grounded
pin. Current is also wasted on the
other resistor, which is now directly
connected across the supply.
Still, by taking one or the other pins
low, either the red or green element in
LED1 can be lit up. Taking both pins
low means that they are at the same
potential and no current flows through
the LED, holding it off.
Helpfully, the wiring of CON1 is the
same as the I2C OLED modules that we
use, so the two can be interchanged to
a degree. Be careful, though; we have
seen some I2C OLED modules with
siliconchip.com.au
Fig.1: this board does little more than break out an I/O expander IC connected
to some pushbuttons and a bicolour LED along with an OLED module.
swapped power and ground connections!
For example, an OLED module can
be plugged in where an I2C Controller
is expected, and the display will work
as intended. The default display is a
status information screen that can be
viewed without the pushbuttons needing to be pressed.
Since the pinouts are identical,
other projects or devices that use an
I2C OLED module could be reprogrammed to access the I/O expander
chip to add extra inputs (S1-S4) to an
existing interface.
Having said that, note that the
PCF8574 and PCF8574A parts have
different I2C timing requirements to
the OLED module’s display controller.
So the I2C Controller may not work in
place of a bare OLED module unless
the firmware takes account of this.
Options
We have marked the PCB to suit a
polarised header so that the I2C Controller and Accessory Decoders can
be connected by flying leads without
a risk of reversed connections. However, you might prefer a different plug
and socket arrangement.
For example, it might be just as easy
to hard-wire a flying lead (with plug)
directly to the Controller, since there
will be little need to detach the lead
from the Controller. Our early prototypes used a simple header plug and
socket arrangement.
pin 1 indicator lines up with the mark
on the board. Tack one lead and check
that the other leads are on their pads,
then solder the remaining leads and
after that, refresh the first lead.
Next, solder the three resistors and
one capacitor; none of these are polarised. Clean off the flux residue and
allow the board to dry.
Now fit the four switches, making
sure their bodies are flat against the
PCB, then mount LED2 with its cathode to the left as shown. LED1 has
the red element’s cathode as marked.
Use a multimeter on diode mode to
check the orientation before installing it. When this LED lights up red
on a tester, the negative lead (usually
black) is connected to the cathode of
the red element.
When trimming the leads of the
LEDs, put the offcuts aside. Attach the
pin header to the OLED module if necessary, then solder it in place, being
sure to leave a small space between it
and the parts below. A piece of card
could be used as a temporary spacer.
Finally, use the offcuts to secure the
lower mounting pads in the OLED
module to the PCB below using solder.
You can test the I2C Controller by
applying 3.3-5V between the G (negative) and V (positive) connections.
If LED2 lights up, everything is working as well as can be tested without
an external microcontroller driving
the I2C bus.
Wiring harness
The photo overleaf shows how the
harness is assembled; we recommend
it be no more than 10cm in length.
Remember that I2C is short for inter-
integrated circuit and is designed to
cover short distances within a PCB.
Both ends are wired the same, and
the colour code we have used matches
black for GND and red for V, so there
are also some visual cues to ensure it
is not wired up incorrectly.
Fig.2: both the decoders
and I2C Controller
are marked with their
pin layouts, but we’ve
chosen a polarised
cable to ensure that
the boards are always
connected correctly. The
OLED module is fitted
last and sits over the
other components. We
designed this board to
interface with the DCC
Accessory Decoders
(elsewhere in this
issue), but it could
be a handy addition
to any project that
needs a simple user
interface.
Construction
Referring to Fig.2, the overlay diagram, apply flux paste to the pads for
the SMD parts. Place IC1, ensuring its
siliconchip.com.au
Australia's electronics magazine
July 2026 81
Use the headers and lead offcuts to
space the OLED module off the PCB
and clear of the parts below.
We used the colour coding shown
here (matching our prototype) but
it isn’t critical since the plugs are
polarised. The two ends can
be interchanged without any
problems.
How to use it
As shown in Fig.2, connect the I2C Controller to CON7 of the
DCC Accessory Decoder (based on a
PCB coded 09111254 or 09111255) and
power up your DCC system.
Both LEDs and the OLED screen
should light up. LED1 should be green
after a second or two, and the OLED
will display something like Screen 1; it
will be slightly different on the Servo-
type Decoder.
In general, buttons S3 and S4 (left
and right) cycle through the screens,
while S1 and S2 (down and up) edit
the values on the screen. Pressing S3
and S4 together resets the OLED display controller; try this if the display
is corrupted.
Screen 1 is a status screen, useful for
monitoring the Accessory Decoder’s
operation. As mentioned before, this
will appear if you just plug an OLED
screen in too.
The second line is only present on
the Snap-type Decoder and shows
the voltages on the motor supply
before and after the 100W resistor. The
screen will show VM OK and a green
LED1 if the 4700μF capacitor is fully
charged, or “VM --” and a red LED1
if it is charging. The servo motor supply rail voltage is shown by the Servo-
type Decoder.
The DCC text shows if DCC packets are being received, while the
last line shows the address of the
most recent accessory packet, or
dashes if none have been seen in
the last five seconds. These should
allow you to check that your DCC
base station is sending packets to the
expected addresses.
Pressing S4 will cycle to Screen 2,
showing the main mode. This screen
only affects the Snap-type Decoder
since the Servo-type Decoder is fixed
at four outputs. When two outputs are
selected, they are full-bridge types,
while the four outputs are open-drain
types. S1 or S2 can be used to change
this setting.
Screens 3-8 are repeated for each
output (1-4) and the output number is
shown at top left. These mostly allow
direct editing of the CVs (configuration variables). On these screens, S1
GPS-Synchronised Analog Clock
with long battery life
➡ Convert an ordinary wall clock into a highlyaccurate time keeping device (within
seconds).
➡ Nearly eight years of battery life with a
pair of C cells!
➡ Automatically adjusts for daylight saving
time.
➡ Track time with a VK2828U7G5LF GPS or D1
Mini WiFi module (select one as an option
with the kit; D1 Mini requires programming).
➡ Learn how to build it from the article in the
September 2022 issue of Silicon Chip (siliconchip.
au/Article/15466). Check out the article in the
November 2022 issue for how to use the D1 Mini WiFi
module with the Driver (siliconchip.au/Article/15550).
Complete kit available from $55 + postage (batteries & clock not included)
siliconchip.com.au/Shop/20/6472 – Catalog SC6472
82
Silicon Chip
Australia's electronics magazine
siliconchip.com.au
and S2 increment by one, unless the
other button (S2 or S1) is held down;
this will increment by ten instead,
allowing you to reach the desired setting faster.
Screen 3 is the address, which can
be set from 1 to 2048. Multiple outputs
can be set to the same address so that
they respond to the same commands,
although this will not work with CV
programming packets.
Screen 4 sets the output runtime
in multiples of 10ms, so the top-right
value is the raw CV3 value, while the
lower value is the actual runtime. A
value of zero means the output runs
indefinitely, at least until its counterpart is activated.
Screens 5 and 6 set the pulse width
that is applied to the servo motors in
the Servo-type Decoder. If an output
is active and its CV3 is set to zero, the
servo position will update the output
in real-time to allow it to be easily
fine-tuned. Note that these screens are
not present on the Snap-type Decoder
since they would serve no purpose
there.
Screen 7 allows the manual operation of an output. This means that
it’s entirely possible to operate the
DCC Accessory Decoders using just
the I2C Controller, without a DCC
base station. Screen 8 is used to reset
the selected output’s CVs back to the
default values.
The Accessory Decoders have been
programmed to recognise when the
I2C Controller is connected, but we
recommend that it is only connected
or disconnected while the power is
switched off to the decoders. This
should help to avoid damage due to
stray voltages while the connection
is being made or broken.
Screen 1: the first screen shows status
information, meaning that even a bare
OLED module can be used to check
and monitor an Accessory Decoder.
Screen 2: the Snap-type Decoder can
be configured to have four open-drain
outputs on this page. All changes are
made by pressing S1 or S2.
Screen 3: like the other pages, the
values can be quickly changed by
holding down S1 while pressing S2
(or vice versa).
Screen 4: the runtime applies to all
decoders. When it is set to zero, the
output is on until the other output is
activated.
Screen 5: this screen sets the servo
pulse width for the THROW output;
values between 1000μs and 2000μs
(1ms and 2ms) are typical.
Screen 6: the servo pulse width setting
for the CLOSE output. The defaults
should give about 90° of movement,
but most constructors will need to trim
the values to suit their installation.
Screen 7: this screen allows manual
operation, giving yet another option
(besides the onboard pushbuttons)
for using the Decoders without a DCC
system.
Screen 8: each output can be set to
its defaults by pushing S1 or S2; this
includes the address, run time and
servo pulse widths.
Parts List – I2C Controller
The I2C Controller is little more
than a module with a few I2C devices
on it, so it should be easy to connect
to microcontrollers like Arduinos
and Micromites. As we mentioned,
the PCF8574(A) has different timing
requirements to the OLED modules,
so you might find you need to tweak
your bus speed to suit.
Using an I2C scanning program is
a good way to test whether the bus is
working correctly. The PCF8574(A)
should be seen on 7-bit addresses of
either 0x20 or 0x38 (32 or 56), while
the OLED modules are typically set
SC
to 0x3C (60).
1 57 × 40mm double-sided PCB coded 09111256
1 4-way 2.54mm/0.1-inch pitch polarised header or similar (CON1)
[Jaycar HM3414, Altronics P5494]
1 1.3-inch OLED display module (MOD1) [Silicon Chip SC5026, SC6511]
4 6 × 6mm through-hole tactile switches (S1-S4)
Semiconductors
1 PCF8574 or PCF8574A I/O expander IC, wide SOIC-16 (IC1)
1 red/green 3mm bicolour LED (LED1)
1 green 3mm LED (LED2)
Capacitors/resistors
1 100nF 50V X7R M3216/1206-size SMD MLCC capacitor
3 1kW ¼W M3216/1206-size SMD resistors
Cable
2 4-way 2.54mm/0.1-inch pitch polarised header plugs with crimp pins
[Jaycar HM3404, Altronics P5474 + P5470A]
1 10cm length of 4-way ribbon cable OR
1 40cm length of light-duty hookup wire
siliconchip.com.au
Australia's electronics magazine
Using it with other projects
July 2026 83
|