Skip to the content
PCBKitNew board
2 layers80.2 × 55.5 mmSwitchy listener, the printed circuit board in 3D

Switchy listener

moosh/switchy2

Smart Wireless Integrated Train Control Hub sYstem

Size
80.2 × 55.5 mm
Copper layers
2
Thickness
1.6 mm
Parts
47
Nets
67
Pads
234
Tracks, vias
824, 124
Pours
2
Routed
Yes
KiCad
KiCad 9.0 (file 20241229)
Created
27 Feb 2025
Updated
11 Oct 2025

Overview

Switchy listener is an open-source printed circuit board by moosh, from the moosh/switchy repository on GitHub. It is a 2-layer board of 80.2 × 55.5 mm with 47 parts on 67 nets, routed with 824 tracks and 124 vias.

It is built around the WEMOS D1 MINI, CD4043BDR and LTV-847S, with the 74HC4051, CD74HC4067SM96 and TPS54302 among its other parts. Its parts include 13 resistors, 8 ICs, 5 capacitors, 5 connectors and 2 diodes. It belongs with the ESP8266 boards of this library.

Main components

9

README

README.md

SWITCHY

Smart Wireless Integrated Train Control Hub sYstem

Intro

The goal of this project is to create a freely available digital on-ramp for older Märklin train setups. If you have a wildly-wired analog train system, you may gain some flexibility by using the hardware and software described below. The hardware is designed to be as "set it and forget it" as possible. The software required is minimal and accessible to non-programmers.

TL;DR

I must say up front, my friend Bert is the train enthusiast, and I just like building things. Please forgive me if I use the wrong train terminology! Together we discussed how to move toward some software control over his setup. Early on Bert found the excellent YouTube channel The3rdRail. The hardware that follows was inspired by the train setup glimpsed there.

Hardware

Currently, the SWITCHY system has two different wi-fi enabled boards. Each board connects to a particular kind of track.

NOTE: No other hardware, other than a computer or tablet, is necessary. When powered up these boards find each other and self-assemble into a small local wi-fi network. From there it's up to you, using software tools described below, to control your actual train layout.

The White Board

The first is the white-colored board that allows you to control up to four Märklin turnouts. Alternatively, up to eight other accessories that take 16VAC. Here is one of the four turnout's connected and a close-up of the board:

alt text alt text

The Blue Board

The second is the blue-colored board that waits for a train to brush across a contact, left or right, in a track section. It then broadcasts this "event" and allows you to take any desired action.

alt text alt text



Full KiCad schematics and PCB layout documents for each board are available in this archive.

alt text alt text

More Details

Each board is currently powered by an ESP8266 microcontroller, specifically a WeMOS-like MCU. I've found much joy in this little device, and it's built-in wi-fi support.

All communication is via an ad-hoc MQTT network set up over wi-fi. Each board (also referred to as a node) is given a unique nodeID via its onboard 8-gang DIP switch. (See the software section below for a discussion on 8-bit binary notation). The board with nodeID = 0 (and there must be one board with nodeID zero) performs multiple duties. Along with controlling turnout switches it creates a wi-fi access point (hotspot), named "SWITCHY Network", requiring no password, at IP address 192.168.4.1. It also operates an MQTT server. This server is how all nodes communicate with each other and the control software (discussed below).

The network that forms allows up to 256 boards of each type. This means that the SWITCHY network supports controlling up to 1024 Märklin turnouts, or up to 1024 contact switch track sections.

Software

Any software system that supports communicating with an MQTT server can be used to control the SWITCHY network. Perhaps the easiest to use for non-programmers is Node-Red or n8n. Installation and basics of these platforms is outside the scope of this README so please refer to the links above for those details.

NOTE: The terms "board" and "node" are used interchangeably in the following discussion. Node primarily is used when talking about the board's software representation on the SWITCHY network.

White Board

The white-board (turnout switcher) listens for MQTT messages on the switchy/track_switching channel. From Node-RED, etc. you send MQTT messages on this channel to make the desired switch move. Messages are formed using JSON. Here's an example message you an send to a white board:

{ "nodeID": 3, "switchIndex": 1, "direction": "straight" }

  • nodeID: MQTT supports a publish/subscribe architecture used by the SWITCHY network. This means that every subscriber hears the same published message. The JSON message, above, includes a nodeID to indicate for which node the message is meant. All other nodes ignore the message.

  • switchIndex: The one-based index of the switch to be modified. Current versions of the white board support up to four Märklin turnouts. The switchIndex ranges in 1 to 4.

  • direction: Determines which way the track is to be switched. Should be one of "straight" or "round".

Blue Board

The blue-board (contact listener) will send a MQTT message on the switchy/contact_switching channel. Your Node-Red, etc. code will listen on this channel and react when messages arrive. For example, you might toggle one or more turnout switches based on your track layout. Like the white board's message format, the blue board also uses JSON. Here's an example message sent from a blue board:

{ "nodeID": 3, "switchIndex": 11, "direction": "left" }

  • nodeID: The ID of the node meant as the message's target. All other nodes ignore the message.

  • switchIndex: The one-based index of the switch toggled by a moving train, etc. Current versions of the blue board support up to four Märklin contact switch tracks. The switchIndex ranges in 1 to 4.

  • direction: One of "left" or "right". These directions are relative to the contact switch track section when the Märklin plug-ins are facing you.

With these two items, it's possible to control and react to a large number of track sections.

More Details

Each board on the SWITCHY network must have a unique nodeID. The DIP switches on each board allows you to set this ID. The eight DIP switches allow you to create an 8-bit binary number as an ID.

As mentioned above nodeID = 0 is a special node. There must be one and only one board with nodeID of zero. All other boards must have a non-zero, unique, nodeID. What this means in practice is one board has all DIP switches set to 0:

alt text

All other nodes have a unique nodeID, for example here's one set to 9:

alt text

Please check out this page for a discussion on counting in binary.

Parts

47
QtyValueFootprintReferences
1110KResistor_SMD:R_0805_2012Metric_Pad1.20x1.40mm_HandSolderR1, R2, R6, R7, R8, R9, R10, R11, R12, R13, R14
4, , , H1
3746X101103746X101103:746X101103RN1, RN2, RN3
222uFCapacitor_SMD:C_0805_2012Metric_Pad1.18x1.45mm_HandSolderC3, C4
2CD4043BDRCD4043BDR:SOIC127P600X175-16NU11, U12
2LTV-847SLTV_847S:SOIC254P1016X460-16NU8, U9
10.1uFCapacitor_SMD:C_0805_2012Metric_Pad1.18x1.45mm_HandSolderC2
1100ufCapacitor_THT:CP_Radial_D5.0mm_P2.50mmC1
110uHMLZ2012N100LT000:INDC2012X145NL1
110ufCapacitor_THT:CP_Radial_D5.0mm_P2.50mmC5
113KResistor_SMD:R_0805_2012Metric_Pad1.20x1.40mm_HandSolderR5
116VACB2B_XH_A:JST_B2B-XH-AJ1
15 VDCTestPoint:TestPoint_Pad_1.5x1.5mmTP1
15v altTestPoint:TestPoint_Pad_1.5x1.5mmTP2
174HC405174HC4051D:SOIC127P600X175-16NU6
191KResistor_SMD:R_0805_2012Metric_Pad1.20x1.40mm_HandSolderR4
1CD74HC4067SM96CD74HC4067SM96:SOP65P780X200-24NU13
1Contact SW1B2B_XH_A:JST_B2B-XH-AJ2
1Contact SW2B2B_XH_A:JST_B2B-XH-AJ3
1Contact SW3B2B_XH_A:JST_B2B-XH-AJ4
1Contact SW4B2B_XH_A:JST_B2B-XH-AJ5
1DF02MDiode_THT:Diode_Bridge_DIP-4_W7.62mm_P5.08mmD1
1GNDTestPoint:TestPoint_Pad_1.5x1.5mmTP4
1GND altTestPoint:TestPoint_Pad_1.5x1.5mmTP3
1LOGOthe_bag:the_bag_gray_8x8G***
1MSS1P3LDIODE_MSP3V3:DIODE_MSP3V3-LD3
1SW_DIP_x08Button_Switch_THT:SW_DIP_SPSTx08_Slide_9.78x22.5mm_W7.62mm_P2.54mmSW1
1TPS54302Package_TO_SOT_SMD:SOT-23-6U2
1WEMOS_D1_miniRF_Module:WEMOS_D1_mini_lightU5

Questions

How big is the Switchy listener PCB?

It measures 80.2 × 55.5 mm and has 2 copper layers, 1.6 mm thick.

What parts does the Switchy listener use?

47 parts, built around the WEMOS D1 MINI, CD4043BDR, LTV-847S and 74HC4051. 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 Switchy listener KiCad files?

From the moosh/switchy repository on GitHub, at the commit this page was made from: the board is kicad_listener/switchy_listener.kicad_pcb and its schematic kicad_controller/switchy.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the Switchy listener design in my own project?

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

More from moosh/switchy

2
  • 2 layers80.2 × 55.5 mmSwitchy, the printed circuit board in 3D

    Switchy

    moosh/switchy

    Smart Wireless Integrated Train Control Hub sYstem

    33 parts2
  • 2 layers27.3 × 13.1 mmSwitchy controller psu, the printed circuit board in 3D

    Switchy controller psu

    moosh/switchy

    Smart Wireless Integrated Train Control Hub sYstem

    14 parts2

Similar boards

  • 4 layers40 × 25.4 mmBrushless ESC, the printed circuit board in 3D

    Brushless ESC

    OlivePrichard/Brushless-ESC

    Just messing around and seeing if I can make this work

    63 parts
  • 2 layers135 × 101.5 mmLawn sprinkler ctl, the printed circuit board in 3D

    Lawn sprinkler ctl

    adriencarbonaro/lawn-sprinkler

    Lawn Sprinkler Controller

    91 parts
  • 2 layers213 × 84.8 mmZX Max 128 Issue 3 PCB, the printed circuit board in 3D

    ZX Max 128 Issue 3 PCB

    liveboxandy/ZX-Max-128-Issue-3

    KiCAD created files for the ZX Max 128 Issue 3 designed by DonSuperfo

    170 parts
  • 2 layers45.8 × 31.8 mmESP32C6 buttons, the printed circuit board in 3D

    ESP32C6 buttons

    computergeek1507/KiCad_Designs

    KiCad PCB Designs

    12 parts10
  • 2 layers140 × 60 mmBDUCU, the printed circuit board in 3D

    BDUCU

    HKUST-Red-Bird-Racing-EVRT/GEN6_ELEC

    ELEC Github Repo for Gen 6

    172 parts
  • 4 layers165.2 × 72 mmAudiograb, the printed circuit board in 3D

    Audiograb

    oveljosland/audiograb-pcb

    Design files for the Audiograb PCB.

    134 parts4CERN-OHL-S-2.0
  • 2 layers49 × 43 mmArming board, the printed circuit board in 3D

    Arming board

    tudsat-rocket/arming_board

    The new PCB for arming our rocket

    44 parts1
  • 2 layers310 × 100 mmAOML AB 3.0 reorganized v2, the printed circuit board in 3D

    AOML AB 3.0 reorganized v2

    cxs1529/XBT_Autolauncher_PCB

    KiCAD repository for the XBT Autolauncher board

    247 parts