March 31, 2015

Automating LEGO trains with ultrasonic distance sensors

Next in the series of ongoing tutorials for the beginner from the Arduino LEGO Trains YouTube channel is a neat explanation of how to use inexpensive ultrasonic distance sensors to detect trains as they approach a buffer (the end of a line or siding) and cause them to stop for a duration.

As the train approaches the end of the line, the ultrasonic sensor reports back to the Arduino how far the train has to go before causing an accident. Then the sketch can slow down or stop the train (either via a motor controller for 9V trains or infra-red for PF-series LEGO). These sensors can give your layouts more intelligence and options when automating the layout. The entire procedure is demonstrated in the following video:

The sensors used in the demonstration can also be used for other applications, such trackside detection or adding collision-avoidance to other devices. For more interesting LEGO train 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're looking to learn about Arduino development platform and how it interacts with external devices such as ultrasonic distance sensors -  you can't go past "Arduino Workshop -  A Hands-On Introduction with 65 Projects” by John Boxall.

Arduino Workshop takes the reader from having zero knowledge about the Arduino platform, electronics and programming and leaves them with the know-how and instructions on everything from blinking an LED, to robotics, wireless data, cellular communications, motor control, sensors, Internet connected systems and more. For more information including a sample chapter and table of contents, visit the book page.

Leave a comment

Comments have to be approved before showing up.