Skip to the content
4 layers25 × 20 mmRP2040-Decoder, the printed circuit board in 3D

Cost effective DIY DCC Decoder for model railroad locomotives

Size
25 × 20 mm
Copper layers
4
Thickness
1.61 mm
Parts
68
Nets
68
Pads
232
Tracks, vias
426, 114
Pours
6
Routed
Yes
KiCad
KiCad 8.0 (file 20240108)
Created
22 Aug 2021
Updated
20 Feb 2026

Overview

RP2040-Decoder is an open-source printed circuit board by gab-k, from the gab-k/RP2040-Decoder repository on GitHub. It is a 4-layer board of 25 × 20 mm with 68 parts on 68 nets, routed with 426 tracks and 114 vias.

It is built around the RP2040, BDR6133 and W25Q64JVSSIQ, with the MIC5200-3.3YS, SI1308EDL and 1N5819WS among its other parts. Its parts include 21 connectors, 18 capacitors, 15 resistors, 5 transistors and 4 ICs. It belongs with the RP2040 boards of this library.

Main components

9

README

README.md

RP2040-Decoder

Designed to be a low-cost, open-source alternative to commercial DCC decoders, it utilizes the Raspberry Pi RP2040 dual-core microcontroller. The decoder features DCC protocol decoding and command interpretation alongside motor control in a compact 25x20 mm form factor.

Key Features

  • DCC Signal Decoding: Interrupt-based edge detection with full packet/protocol decoding.
  • Motor Control: 128 speed steps with configurable acceleration/deceleration ramping and v_min/v_mid/v_max; closed-loop control for consistent motor speed under varying load conditions.
  • Flexible I/O: 4x transistor-switched outputs and 6x additional GPIOs; all of them PWM capable.
  • CV Configuration: Function mapping and programming track support.
  • Standards Compliance: Implements the most important NMRA (S-9.1, S-9.2.x) and RCN (210, 212, 216) DCC standards.
  • Compact Form Factor: 25x20 mm board size.
  • Integrated Documentation: Comprehensive GitHub Pages documentation covering hardware theory and software implementation.

Architecture Overview

The system uses each of the two ARM Cortex-M0+ cores for separate tasks:

  • Core 0: Signal Processing & Management
    • DCC edge detection and packet decoding.
    • Configuration Variable (CV) management using persistent flash storage.
    • Service Mode (Programming Track) logic and acknowledgment pulse generation.
  • Core 1: Motion Control
    • PID Controller: A discrete-time PID motor controller implementation utilizing based on a bilinear transform formula.
    • Back-EMF Feedback: ADC sampling during PWM-off cycles.
    • Adaptive Control: Gain scheduling for $K_P$ and a startup controller (feed-forward) to overcome static friction.

Hardware Revisions

USB Version

Optimized for ease of use; supports UF2 drag-and-drop flashing and serial logging.

Legacy Version

Revision without USB, one sided assembly, flashed via SWD.

Getting Started

To get started, you will first need the hardware. The different options for acquiring a board are outlined here.

For the software, you have a few options: you can either build it from source or use the ready-to-flash binaries built by the CI pipeline on each release. Flashing the firmware can be done via SWD or, if you are using the USB hardware version, simply by dragging and dropping the file using your regular file explorer.

License

  • Software: MIT License
  • Hardware: CERN Open Hardware Licence Version 2 - Permissive

Parts

68
QtyValueFootprintReferences
9100nCapacitor_SMD:C_0402_1005MetricC2, C6, C7, C10, C11, C12, C14, C15, C16
9Conn_01x01TestPoint:TestPoint_Pad_D1.5mmJ5, J6, J7, J8, J9, J10, J11, J12, J13
9Conn_01x01TestPoint:TestPoint_Pad_D2.0mmJ1, J2, J4, J14, J15, J16, J17, J18, J21
51kResistor_SMD:R_0402_1005MetricR4, R5, R10, R13, R15
5Si1308EDLPackage_TO_SOT_SMD:SOT-323_SC-70Q1, Q2, Q3, Q4, Q5
410uCapacitor_SMD:C_0603_1608MetricC3, C5, C17, C18
46k8Resistor_SMD:R_0402_1005MetricR8, R9, R12, R14
310uCapacitor_SMD:C_0402_1005MetricC8, C9, C13
210pCapacitor_SMD:C_0402_1005MetricC1, C4
227Resistor_SMD:R_0402_1005MetricR6, R7
25k1Resistor_SMD:R_0402_1005MetricR2, R3
2Conn_01x01TestPoint:TestPoint_Pad_1.5x1.5mmJ19, J20
11N5819WSDiode_SMD:D_SOD-323_HandSolderingD1
1200Resistor_SMD:R_0402_1005MetricR11
1BDR6133RP2040-Decoder_Additional_Footprints:SOIC-8-1EP_3.9x4.9mm_P1.27mm_EP2.41x3.3mm_ThermalViasU4
1DNFResistor_SMD:R_0402_1005MetricR1
1KMB24FPackage_TO_SOT_SMD:TO-269AAD2
1LEDLED_SMD:LED_0603_1608MetricD3
1MIC5200-3.3YSPackage_TO_SOT_SMD:SOT-223U1
1RP2040Package_DFN_QFN:QFN-56-1EP_7x7mm_P0.4mm_EP3.2x3.2mmU3
1USB_C_Receptacle_USB2.0_16PConnector_USB:USB_C_Receptacle_GCT_USB4105-xx-A_16P_TopMnt_HorizontalJ3
1W25Q64JVSSIQRP2040-Decoder_Additional_Footprints:SOIC-8_5.23x5.23mm_P1.27mmU2
1X322512MSB4SICrystal:Crystal_SMD_3225-4Pin_3.2x2.5mmY1
1YTS1T0162AWJ00RP2040-Decoder_Additional_Footprints:SW_Push_1P1T_NO_Vertical_Wuerth_434133025816SW1

More from gab-k/RP2040-Decoder

1
  • 2 layers25 × 20 mmRP2040-Decoder, the printed circuit board in 3D

    RP2040-Decoder

    gab-k/RP2040-Decoder

    Cost effective DIY DCC Decoder for model railroad locomotives

    57 parts131

Similar boards

  • 2 layers99.1 × 99 mmXDuinoRail Debug, the printed circuit board in 3D

    XDuinoRail Debug

    chatelao/xDuinoRail-Decoder

    The friendly decoder development plattform for model railroad tinkers.

    170 partsAGPL-3.0
  • 6 layers30 × 20.1 mmXDuinoRails Thor M, the printed circuit board in 3D

    XDuinoRails Thor M

    xDuinoRails/xDuinoRails_Thor

    Make a Seeed XIAO board a mtc21 decoder, all the electronics needed is on this little board: - mtc21/plux16 compatible connector - DC Motor - 2x Functions - DCC / DCC-ACK / RailCom

    46 parts1
  • 2 layers17.5 × 38 mmTps6292, the printed circuit board in 3D

    Tps6292

    ABaboshin/IoTrains

    The existing systems in the market are either with old roots (DCC) or not opensource (Märklin). More then that they were built over 20 years ago and therefore have historical restrictions.

    19 partsMIT
  • 2 layers90 × 67 mmMisterydev20k, the printed circuit board in 3D

    Misterydev20k

    MiSTle-Dev/Boards

    Custom board designs for MiSTle projects

    183 parts23
  • 2 layers65 × 45 mmBetaBoard, the printed circuit board in 3D

    BetaBoard

    timbk/BetaBoard

    A simple and low cost particle detector for teaching

    132 parts85BSD-2-Clause
  • 2 layers21 × 51 mmOrphkicad, the printed circuit board in 3D

    Orphkicad

    adammakesthingsdev/Orpheus-Pico-Kicad

    Kicad files and JLCPCB production gerbers for Orpheus Pico

    43 parts13
  • 2 layers154.7 × 79.5 mmIlluminati, the printed circuit board in 3D

    Illuminati

    Enderman8843/illuminati

    illuminati is a precession drafting triangle with many inbuilt microprocessor and wifi

    66 parts1
  • 2 layers358.8 × 134.9 mmRheneium, the printed circuit board in 3D

    Rheneium

    Enderman8843/Rhenium

    Rhenium is a Keyboard that is powered by RP2040 microprocessor that uses a USB-C,

    213 parts1

Questions

How big is the RP2040-Decoder PCB?

It measures 25 × 20 mm and has 4 copper layers, 1.61 mm thick.

What parts does the RP2040-Decoder use?

68 parts, built around the RP2040, BDR6133, W25Q64JVSSIQ and MIC5200-3.3YS. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.

Where can I download the RP2040-Decoder KiCad files?

From the gab-k/RP2040-Decoder repository on GitHub, at the commit this page was made from: the board is KiCad/USB/RP2040-Decoder.kicad_pcb and its schematic KiCad/Legacy/RP2040-Decoder.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the RP2040-Decoder design in my own project?

Its repository states no licence, so its author keeps all rights: ask gab-k before reusing the design.