YouTube content creator AlmightyArjen had a problem: how could he stop his LEGO model trains smashing into each other at level crossings?

The answer, of course, is to mod in an Arduino to automate how the trains behave at these crossings (well, now you say it, it’s obvious isn’t it? -ed.)

This was done by separating the two intersecting tracks into one “priority track” and one “non-priority track”. The priority track has a sensor half a metre before the intersection. If the sensor is tripped by a train, the power on the non-priority track is cut, causing the train there to stop before it gets to the intersection.

As an added bonus, there’s a green and red lighting system to indicate stop and go. When the priority train passes safely through the intersection, the light will turn from red to green and the stopped train will begin moving.

There are a lot of other really neat details in this project too. The Arduino chip, for example, is on a custom PCB, and all the hardware has been nicely integrated into LEGO’s closed off nine volt model train system.

If you want more details on how the project was put together, check out the second video below which goes deeper into how it works. It also looks at how this system works when used on model trains powered by batteries instead of the rail, which makes things more complicated.