- Home
- Learn Linux
- Learn Electronics
- Raspberry Pi
- Programming
- Projects
- 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).
I've also designed a custom PCB using an Arduino like circuit based around the ATmega328p microcontroller. You can follow the process of creating that on my Electronics part of this site "Custom PCB designs using KiCAD. That is based around a simplified circuit designed to make it easier for the YouTube videos. I have then created a full featured board specifically for this project.
For the latest updates please:
Subscribe to the PenguinTutor YouTube Channel
and
Follow @penguintutor on Twitter
Please view the copyright information regarding use of the circuits.