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 an Arduino and some simple sensors to ensure two trains cannot crash while using a pair of crossovers in a LEGO train layout. This type of layout can offer two loops to allow for two trains to run at once, without any damaging consequences of an accident.
The Arduino acts as a finite state machine, and with the aid of the light sensors which detect oncoming trains to the crossing - one train loop can be shut down until the other train passes or a set amount of time has elapsed. Enjoy the following video for an interesting demonstration of what is possible:
If you're looking into starting with Arduino and motor control, such as the 9V LEGO trains shown in the video above from your Arduino or compatible, check out our HBRIDGE: DC/stepper motor shield. Based around the powerful Allegro A4954 H-bridge driver IC you can control two DC motors with complete ease, or one bipolar stepper motor. With connections for external power management, a complete beginners' guide and documentation - motor control couldn't be any easier. For more information and to order, visit the HBRIDGE: page.