It's no secret that we here at Tom's Hardware love the Raspberry Pi but did you also know we have a deep appreciation for trains? Whenever these two passions come to a crossroads, we can't help but get excited. Case in point, today's project created by maker and developer Brendan McGrath is using a Raspberry Pi Pico to make his level crossing lights more realistic for his model trains and we're totally onboard with it.
This project was shared in a quick video on his YouTube channel Pater Practicus. In it, we get a close look at the entire setup — including the Pico and how it's wired to the lights. The level crossing lights use beam-break sensors to detect when a train is passing to more accurately change the lights.
The lights work by not just detecting when the first train car has passed a sensor but also checking for when the caboose has made its way through. This makes the lights operate more realistically in the way you would find at an actual intersection. All of the logic is handled by the Raspberry Pi Pico.
The video clip might be short but thankfully we get a good look at the hardware he's using. The Pico is wired up to a breadboard so the project isn't a finished piece but more of a proof of concept. The Pico is wired to both the sensors and level crossing lights. We also get a look at the model train which is being manually pushed along a track as well as a few Lego bricks that are being used to hold the sensors in place.
Another cool thing about this video is that we have access to the source code! The script was written by McGrath for the video using MicroPython. If you want to recreate it at home or just get a better idea of how it works, you can pause the video around 10 seconds in to check it out for yourself.
To get a closer look at this Raspberry Pi project in action, you can find the video shared on YouTube over at the official Pater Practicus channel. If you enjoyed this project, you should also check out this really cool Pi-powered FPV model train ride project.