Introduction to LEGO Train Automation

Many traditional model train sets feature advanced computer-controlled automation. The LEGO company still has to reach this level of sophistication. But we can always rely on dedicated AFOLs to fill the gaps. This post will introduce some of the solutions available in the market. The goal is to find the right combination of hardware and software to achieve your train project. I have been able to control four trains on what continues track without crashes.

Trains

There are many original LEGO trains available, but there are even more interesting ones available from alternative brands/resellers. Just have a look at BlueBrixx’s train section. It comes down to your taste on what exact train model you prefer.

Train controllers

More critical are the train motors and train controllers. After all, you want to control the train(s) remotely. The most popular approach uses Bluetooth to communicate with the train controller. The Powered Up Bluetooth HUB train controller and motor are the obvious choices for this approach. Alternatively, you can use the Technic Hub or the Spike Hub.

But there are other options. You can also use the SBrick Plus to control LEGO Power Functions train motors. You can also use Mindstorms as your controllers. For example, you can use the EV3 with a custom cable. Or you can build your own train motor engine.

Tracks

The original LEGO tracks are the go-to choice for many, but there are other legitimate options. Bluebrixx sells their own tracks at a much better price. They are not the only ones. There is also Modbrix, Trixbrix and 4DBrix. Some of the less common tracks are produced using 3D printers. You can also just download the 3D fiels and print them yourself.

You can of course, also visit Aliexpress to get a large variety of cheap tracks. The number of different designs availale is just amazing. LEGO is again falling behind.

Switches

You do not only want to control your trains but also the track itself. You can build an automated switch with original LEGO bricks. You will connect these switches to LEGO hubs that you can then control just like the trains. 4DBrix offers a complete automation system that also includes motors that are mounted on top of your original LEGO switches.

Sensor

To control the train, you need to know where they are on the tracks. You can add sensors to the train, such as a light sensor or a distance sensor. You can then place markers on the tracks, such as colourful plates (light) or walls (distance). The sensor depends on what controllers you use. The sensors typically originated from the different versions of Mindstorms. While driving over the marker, the train senses this information and can act upon it. You need a programmable hub, such as Mindstorms, to process the sensory input and act accordingly.

Alternatively, you can mount sensors to the track itself. This can again be original LEGO sensors (light or distance) or you can use 4DBrix’s sensor in combination with their whole system.

Controllers

If you use a distributed architecture, then you need the train controllers to communicate with the track controllers. At least one of them needs to be programmable so that it makes decisions. Alternatively, you can use a computer as a central controller that communicates with all components in your train system. This can be done wirelessly (Bluetooth, Infrared, or Wifi). Other systems, such as the 4DBrix System, use wires for all track-mounted sensors, switches and actuators. Alternatively, you can consider the MattzoController system, but it does require more knowledge in programming micro controllers. Anopther option is the TrixBrix system, but I am not sure how much it can be programmed.

Software

You will need software to make all the decisions in your train system. Based on sensory input from your train or track sensors your trains need to start/stop. Also, switches need to be triggered, booms lifted and decouplers triggered. The 4DBrix system uses the nControl™ software running on a computer to plan and program your train system.

The Brickrail software is based on PyBricks to program hubs/controllers. Another option is the Brick Automation Project, although it does not seem to have been updated in a while.

Computer

Depending on what controllers you choose, your computer needs to have USB, WiFi and Bluetooth. The latter is a bit more tricky than normal. You specifically need a Bluetooth Low Energy Dongle that integrates all Bluetooth LE features. If your computer does not have it built in then you need an external dongle.

New Zealand Record for longest LEGO train track

New Zealand LEGO train track record.

Today we set the New Zealand record for the longest LEGO train track at the University of Canterbury’s library with the help of LUG 4/2. We achieve 230.5 meters, including bridges, tunnels and other features.

I took a 360 panoramic video with my Ricoh Theta camera. You can enjoy the 4K spherical video here:

Photos from the event are available over at Flickr.

LEGO Train Automation

How to control four LEGO trains on one track.

The LEGO company offers remote controls to play with your trains. You can control up to four trains with one remote. This works fine as long as each train runs on a dedicated track and you only need to pay attention to one train at a time. LEGO only allows you to control trains. You cannot control track switches, lights or decouplers remotely.

The 4DBrix company is offering advanced train automation and today I would like to share my latest train automation project with you. I ran four trains on one track without any collisions.

This video shows all four trains from the top, including a picture in picture video of one of the trains.

This video is a 360 panoramic video. You can spin the camera and look at all the trains and LEGO sets.

I used 4DBrix’s nControl IDE to program all the trains that were connected to the computer using Bluetooth. nControl uses the Python programming language. One little hick up was the need to flash the firmware of my BLED112 Bluetooth dongle to allow for more than three trains simultaneously.