Control Your Lego Train Set with Arduino

Lego train sets have been thrilling children with curious minds for over 50 years, with battery-powered sets winding their way around bedrooms, living rooms and even gardens. But there’s always been an issue with controlling the trains and their journey, even with the more recent remote controlled systems.

The result has been a train track experience that remains inferior to Hornby … and it really shouldn’t be like that. Lego’s move into robotic systems over the past few years should have also given us motorized track switches and automated train lighting. Perhaps a few Arduinos could encourage them?

A 14-part series of YouTube videos from the Arduino Lego Trains channel explains how.

To get started, you’ll need:

  • 1 x Arduino (Mega preferred for overall control, although the Nano is ideal for onboard integration of power function trains)
  • 1 x L298N motor controller
  • 1 x 12V DC Power supply

You’ll also need a battery-powered Lego train and the track. Various ways to integrate an Arduino with your Lego train are covered in these videos, from light sensors and controlled junctions to motorized track switches and controlling modern power function trains. 

But these videos are more than just building Lego and connecting an Arduino. The video creator also includes full details on how to write an Arduino sketch for the various functions. If you’re new to Arduino, there’s also an overview of how to upload the program to your device. By the end of the series, you’ll be ready to add some Arduino-controlled automation to your own Lego trains

Several Lego train sets are featured throughout the video, so it shouldn’t be too difficult to adapt these tutorials, whatever Lego trains and tracks you own. If you’ve been looking for a way to get your children interested in electronics, this is ideal!

Leave your feedback...

Latest Articles