Decoupling Lego Trains Automatically

Lego train sets were introduced almost 50 years ago, and since then, one thing has been constant: the trains connected with magnets. While this is a supremely simple means of connecting locomotives to rolling stock, there is one big disadvantage. Building decouplers – devices that will separate one car from another – is difficult.

Now, with a clever combination of racks, gears, and wedges, trains can disassemble themselves. They can even do it with an Arduino.

wedgeThis decoupler works by effectively wedging cars apart from each other. With a motor from an old Lego Technic set, a few gears, shafts, and a rack, a device can be constructed that fits between the rails of a track that raises into the undercarriage of rolling stock.

Because this rolling stock is moved around with a locomotive, all that’s needed to separate two halves of a train is to move the locomotive forward. Yes, it does mean that the connection with the weakest magnet is disengaged – not necessarily the connection you want to decouple. However, with only one car and a locomotive, there’s only one connection to break. Simple enough.

This Lego decoupler can be further improved with an Arduino, a few ultrasonic sensors, and an IR detector to make a fully automatic decoupling siding for a Lego train layout. You can see all this below operating with a full state machine that perpetually switches rolling stock behind a locomotive.

A great use for Legos.

25 thoughts on “Decoupling Lego Trains Automatically

        1. Is your point is that you want the plural of Lego to be “Lege” instead of “Lego”?

          “Moose” is an Eastern Algonquian word, most likely from the Narragansett language, which means it comes from a genetic group within the Algic language family. Due to this, the correct plural of “moose” should be “mosinee.”

    1. Depends on which version of train motor used in this project. Old 4.5v and 12v were fixed speed. 9v electric track (which cost a lot on used market) had variable speed control, and both the short lived RC and the current PF train system have 7 speed motor.

      If you’re starting out, I’d go with the current set which are PF (power function). If you have lots of time and experience with remote controlled PWM technology, you could pick up cheap old 4.5v train stuff and add PWM to get variable speed. 12v stuff is rather expensive due to scarcity.

  1. I noticed the top decoupler catches on the second axle, not the intended first one. At some point the concrete mixer almost tumbles. I think the train should back up a little bit more before activating the decoupler. Or maybe the position of the infrared detector (photoresistor vs. IR led position) could be adjusted. Great build!

  2. As someone who did a lot with Lego trains in the glory days of the 12V railway, back in the early Eighties, I feel I have to point out that Lego did have an official solution for just this:
    The magnetic couplings used with those models had a vertical pin hanging down. When they passed over the uncoupler, its slanted blades forced one pin to the left and the other to the right, breaking the magnetic contact and uncoupling the rolling stock. I fantasised about building a hump-shunting system this way. Unfortunately the component can’t have been a success, as it was only sold for one or two years, and it wouldn’t work with the current system.

    1. Maybe but you’d need to go back about 10 years or more when LEGO still used separate magnet and parts. The train coupler in the last 10 years used sealed magnet and permanent connection which would make custom electromagnet a little hard. Unless you mean using EM to break the existing magnet field?

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.