March 16, 2015

Experimenting with LEGO train detection and control using Arduino

In the last few months there seems to be a renaissance of LEGO trains, and many Arduino enthusiasts have been using their boards to add all sorts of interaction and control to their layouts. An ongoing series of tutorials for the beginner is explaining how to do this and the latest update by the Arduino LEGO Trains YouTube channel shows us how to use light sensors to detect trains as they approach a station and cause them to stop for a duration.

The train is detected by a light sensor fitted between two sleepers, and when this goes dark the Arduino stops current to the train via a separate L298N motor controller which replaces the 9V speed controller. This is a neat idea and allow you to add some automated realism for hands-off enjoyment of the trains. Watch the following video for a complete rundown and more:

To expand on the project consider using PWM to slowly bring the train to a stop, with the sensor placed further away from the station. And for more interesting videos, subscribe to their YouTube channel.And for more, we're on twitter, facebook and Google+, so follow us for news and product updates as well.

If you need a light sensor, you can maintain constant reliable results with our LIGHT: light sensor module:


Our tiny light-sensor module uses the very-reliable TEMT6000 light sensor, which gives consistent and repeatable readings even between different units - unlike cheapie light-dependent resistors, which can vary dramatically in their sensitivity. So for reliable light sensing - look no further


Leave a comment

Comments have to be approved before showing up.