Skip to the content
2 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
2
Thickness
1.6 mm
Parts
57
Nets
59
Pads
187
Tracks, vias
445, 123
Pours
1
Routed
Yes
KiCad
KiCad 7 (file 20221018)
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 2-layer board of 25 × 20 mm with 57 parts on 59 nets, routed with 445 tracks and 123 vias.

It is built around the RP2040, BDR6133 and W25Q64JVSSIQ, with the HT7533S, T2N7002BK,LM and KMB24F among its other parts. Its parts include 20 connectors, 17 capacitors, 9 resistors, 5 transistors and 4 ICs. It belongs with the RP2040 boards of this library.

Main components

7

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

57
QtyValueFootprintReferences
10100nRP2040-Decoder_Additional_Footprints:C_0603_1608MetricC3, C4, C7, C8, C9, C10, C11, C12, C13, C15
510uRP2040-Decoder_Additional_Footprints:C_0603_1608MetricC1, C2, C5, C6, C14
5T2N7002BKPackage_TO_SOT_SMD:SOT-23Q1, Q2, Q3, Q4, Q5
46k8RP2040-Decoder_Additional_Footprints:R_0603_1608MetricR1, R2, R5, R6
31kRP2040-Decoder_Additional_Footprints:R_0603_1608MetricR7, R8, R9
20TestPoint:TestPoint_Pad_D2.0mmJ3, J8
21TestPoint:TestPoint_Pad_D2.0mmJ4, J9
210pRP2040-Decoder_Additional_Footprints:C_0603_1608MetricC16, C17
22TestPoint:TestPoint_Pad_D2.0mmJ5, J10
23TestPoint:TestPoint_Pad_D2.0mmJ6, J11
1+3V3TestPoint:TestPoint_Pad_D2.0mmJ7
1+VTestPoint:TestPoint_Pad_D2.0mmJ14
1200RP2040-Decoder_Additional_Footprints:R_0603_1608MetricR3
14TestPoint:TestPoint_Pad_D2.0mmJ12
15TestPoint:TestPoint_Pad_D2.0mmJ13
1BDR6133RP2040-Decoder_Additional_Footprints:SOIC-8-1EP_3.9x4.9mm_P1.27mm_EP2.41x3.3mm_ThermalViasU2
1DNFRP2040-Decoder_Additional_Footprints:R_0603_1608MetricR4
1GNDTestPoint:TestPoint_Pad_D2.0mmJ17
1HT7533SPackage_TO_SOT_SMD:SOT-23U1
1KMB24FPackage_TO_SOT_SMD:TO-269AAD1
1M_OUT_ATestPoint:TestPoint_Pad_D2.0mmJ16
1M_OUT_BTestPoint:TestPoint_Pad_D2.0mmJ15
1RP2040RP2040-Decoder_Additional_Footprints:QFN-56-1EP_7x7mm_P0.4mm_EP3.2x3.2mmU4
1RUNTestPoint:TestPoint_Pad_D2.0mmJ20
1SWCLKTestPoint:TestPoint_Pad_D2.0mmJ18
1SWDIOTestPoint:TestPoint_Pad_D2.0mmJ19
1T0TestPoint:TestPoint_Pad_D2.0mmJ1
1T1TestPoint:TestPoint_Pad_D2.0mmJ2
1W25Q64JVSSIQRP2040-Decoder_Additional_Footprints:SOIC-8_5.23x5.23mm_P1.27mmU3
1X322512MSB4SICrystal:Crystal_SMD_3225-4Pin_3.2x2.5mmY1

More from gab-k/RP2040-Decoder

1
  • 4 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

    68 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
  • 2 layers21.4 × 25.2 mmCicada pwm esc, the printed circuit board in 3D

    Cicada pwm esc

    mars2860/cicada

    The quadcopter based on ESP8266 wifi module

    32 parts6GPL-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 layers61.6 × 53.7 mmOsborne floppy emulator, the printed circuit board in 3D

    Osborne floppy emulator

    khaddra/osborne-floppy-emulator

    Floppy disk drive emulator for the Osborne 1. Unfinished.

    82 parts2
  • 2 layers92.1 × 78.1 mmPaperd ink rev3, the printed circuit board in 3D

    Paperd ink rev3

    paperdink/paperd.ink_hw

    Hardware files for paperd.ink

    92 parts9CC-BY-SA-4.0
  • 2 layers79.8 × 63 mmCPR Machine Schematic, the printed circuit board in 3D

    CPR Machine Schematic

    Jack-p-hammer/HeartBridge

    Software, electronics, mechanical parts and simulation for HeartBridge, an automated CPR machine. The project started as MIT 2.009 Green Team's 2025 class project and has continued since.

    85 parts2

Questions

How big is the RP2040-Decoder PCB?

It measures 25 × 20 mm and has 2 copper layers, 1.6 mm thick.

What parts does the RP2040-Decoder use?

57 parts, built around the RP2040, BDR6133, W25Q64JVSSIQ and HT7533S. 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/Legacy/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.