Model railroading is a popular hobby going back more than a century, but which has remained largely unchanged for many decades now. The typical model railroad uses an electric locomotive with a motor powered through the rails by DC current, with the polarity of the power supply determining direction and voltage determining speed. But development boards, like Arduinos, open up new possibilities, as demonstrated by this adorable, Mister Rogers-esque model trolley that moves back and forth across a garden.
This looks like the kind of trolley you might see traversing cities like San Francisco. It endlessly crosses a rail between two “stations” a few feet apart in a garden, while playing sound effects. A standard model railroad would require manual control to change directions, but this railroad has automatic polarity reversal.
An Arduino controls the power going to the rails through an Adafruit Motor Driver Shield. It monitors infrared sensors at the ends of the track, inside the stations, to detect the presence of the trolley and then reverses the polarity. It also plays sound effects through an Adafruit Audio FX Sound Board. And like with any good model railroad, a lot of effort went into making the stations look realistic. It is a fun way to liven up a garden that doesn’t need constant oversight.
Read more about this on: Arduino Blog