- Learn Linux
- Learn Electronics
- Raspberry Pi
- LPI certification
- News & Reviews
In this project I'm going to cover the process of creating model railway traffic lights for a G-Scale Outdoor Model Railway.
The traffic lights are designed using FreeCAD. This is a free parametric modelling tool. FreeCAD is a powerful tool, although not particularly easy to get started. Once you have you will find it gets easier to create useful 3D models with a good amount of control over the dimensions.
My first method for automation is using a Raspberry Pi Pico microcontroller. The Pico provides a quick way to create connect the traffic lights up using a solderless breadboard. This provides a flexible way to control the traffic lights. The sequence can be changed through a few lines of code.
The wires were soldered into the back of the traffic lights. I crimped the ends of the wires to male crimp pins which helped with inserting the stranded wires into a breadboard. I used 120Ω resistors for each of the anodes and used common cathode for the negative connection to ground.
The GPIO ports used on the Raspberry Pi Pico are shown in the image below:
The source code is available to download: Pico uPython traffic light code (pico-upython-trafficlightcode.zip).
In future I also plan to add details of a custom printed circuit board I've designed.
Please view the copyright information regarding use of the circuits.