Vintage Märklin Model Trains - Accessory control


I thought I'd share a project I have been working on.

In a nutshell, I used Node-RED, Tasmota and ESP8266 and built a small command station to control my 50 year old Märklin turnouts and signals. I looked into this to save some of the extensive amount of wiring usually required. on my current layout, this saved me about 50m of wiring.

I have put together a few videos which I posted on youtube: Wireless control - Märklin accessories. It is a bit long (3 part series), but describes my journey... This is kept high level, and I don't get into coding... I can't code anyway :slight_smile:

If you want a bit of background:

I collect old Märklin H0 gauge trains. If you are not familiar with them, they run on 16V AC on a 3-rail system. I run them on equally old track and build temporary layouts which never last more than a few months. All turnouts and signals are solenoid driven, the signals include relays to control power to the track based on their aspect. The system also includes ways to automate traffic with special tracks that can remote control accessories. This is all wire based, lots of it, but one can achieve all sorts of scenarios of various grades of complexity with the system. In such scenarios, the trains are in control, they will set another one in motion when passing a certain spot, or stop based on the position of another one. The only control is the speed setting if no form of manual override as been planned.

I tend to concentrate on the automation side of things when planning new layouts, including as little manual overrides as possible. The reason for this is that these would require... even more wires... The task of laying them is not complicated as such, but in a temporary setup, you usually don't drill holes to hide your cables, and cable management quickly becomes an issue...Invariably though, I find myself in a position where I have to retrofit some wires here and there, which is always a bit of a pain.

So, I was looking for way to reduce the amount of cabling, whilst keeping the analog control look and feel. I also didn't want to modify my vintage equipment in any way. I did a few tests with ESP8266 boards and Tasmota, then quickly moved on to design a control solution with Node-RED and MQTT. I know there are model railway control software packages around, but they are geared towards digital operations and can be a bit overwhelming with their heavy, feature packed interface. Additionally, most of them them are keyboard/mouse driven, and I didn't want a computer to spoil the analogue feel I am trying to enjoy when using the layout.

After a few weeks of learning, I managed to to get to something that does exactly what I want with Node-RED. I have set-up everything on a Raspberry Pi 4. I can control up to 50 accessories wirelessly using custom boards I designed and my iPad. Everything plugs into the existing wiring, so there was no need to modify anything.
On the Node-RED side of things, I used only standard nodes and all the logic is done using the nodes and their parameters, there is no custom coding involved.
The solution handles the entire workflow from device provisioning to operation, including move, add and change tasks. So, I am able to add, change or remove devices with a couple of taps. I now only need 1 or 2 short wires where I previously needed 6.

As someone with very limited knowledge, I was able to overcome a few challenges thanks to the excellent documentation on this forum. A big thank you to the community for their contributions.

If you have managed to stay with me that far, here is the link to the channel, The 3rd Rail, and a direct link to the playlist Wireless control - Märklin accessories.

Thanks for your attention,


For those interested in the topic, I have added turntable control functionality recently and a short overview of the device provisioning (ESP8266 firmware flashing and function based configuration).

There are 2 shorts videos on these topics on my YouTube channel.
And if you like old model trains in motion, there are plenty to see on the channel too :slight_smile:

Happy 2020!

1 Like