Control model railroad with Wifi and Mqtt

  • Beginning to develop some pcb in Kicad, easier to solder and looks a lot better.

    First one is a card that can control 8 servos for turnouts or other things.


    Next one is a more flexible card that can control signals, lights and servos too. Mix as you please.


    And the rescent one that I just finished in Kicad is a card for 4 block occupancy detectors.

    It is a quite simple and cheap type based on a bridge rectifier, ac optocoupler, led and a couple of resistors.


    Picture borrowed from:


    "S" from this card goes to "S" on the flexible card above, and when f.ex. a locomotive is on a detected piece of track

    then a message is sent to those that are interested, signals, track plan, what ever.

    And as a final for this year a made a video on a 3D-printed, wireless, modular track plan that we use:


    That's all for now.

    Happy New Year! :)

  • Goodmorning,

    Do you have already some code for the handheld and MQTT for the Basic Station and maybe some schematics about this all?

    with regards,


  • God evening, Johan.

    Code and schematics are just prototype versions. The code for the handheld control is quite large and not well commented,

    and it is still growing. The schematic is not so complicated.

    I´m going to make a new version for the base station this autumn with the new DCC++EX and a more powerful motor driver (IBT_2).

    Maybe I can share that if someone is interested, and go from there.


  • I have become quite familiar with Kicad (for making PCB) and tried to make some cards with the more efficient microcontroller ESP32.

    It has a lot more I/O pins so I don't need as many cards to control everything.

    There is an ESP32 in my handheld control but there I only use a few pins.

    So my first ESP32 card looks like this


    Made some minor flaws on the design that doesn't make any difference, will fix it for the next version.

    It has 24 pins (4 are just inputs) and can control leds, servos, buttons, whatever.

    Just solder the components needed, not all of them.

    An extra bonus is that ALLPCB sent me these cards for free, no charge, not even for freight.

    I have soldered two of these cards and will install the firs one next week.

  • Made some short videos on a new, cool part on my brothers layout.

    A small turntable för KLV 12.

    KLV 12 turntable video 1
    Short video of a small, homemade, low budget turntable for KLV 12, scale 0.It is made of 3D-printed parts and a microprocessor controls a stepper motor in 3 ...

    KLV 12 turntable video 2
    Just another video of the small turntable.

    KLV 12 turntable video 3
    And a third video of the small turntable.

  • My brothers layout is run by DCC++ and until now the power from the command station was limited to 2A

    which was the max power from the Arduino motorshield. Since the layout is still under construction that

    wasn't a big issue. But it needed to be increased.

    So now I have built a second version of the command station which is equipped with a more powerful

    motordriver called IBT_2, which can deliver 43A (in theory). And i put it all together in a small 3D-printed box.

    Inside it looks like this:


    On the bottom is an Arduino Mega with DCC++EX 4.0 and on top of that is a Wemos D1 mini that controls MQTT communication.

    The IBT_2 motordriver is mounted on the lid. There is also Volt- and Ampmeter and two RGB-leds.

    USB ports are accessible at the back for software updates without disassemble the box.

    IMG_20220803_090333_25.jpgIt is programmed to deliver up to 5A and I hope that will be enough for a while.

    The layout is divided into 4 different power sections so when it is ready it is easy to add boosters when needed.

    IMG_20220803_090425_25.jpgIt is tested and working.

    Next project....

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!