My son had asked me to do a real traffic light for his LEGO Duplo train. I had tens of Atmel's ATTiny15L lingering around I thought it would be a good idea. I also had a 3D printer that can print in ABS... so I could combine both to produce the said traffic light.
I first found a Lego piece I wanted to "upgrade" and drew a mechanical drawing of it for reference. I used LibreCAD, seem a simple CAD program to design the basic location of the lights in the block.
I designed the 3D printed "LEGO" Traffic light, based on the LEGO designs.
For this you need to go to Openscad library of LEGO designs (yes it exists, and yes you can). The code is here. My choice of OpenSCAD as design tool is based on my experience, I tend to visualize better with equations and program lines... and using the library is simple as including it and asking for a box 3:2... then "cut" holes in the case. Then you print... and test if it sticks...
I then started developing the circuit and the software, the circuit is very simple and biggest problem was extending the battery life from the CR2032 and lock it inside (to prevent it to come out during play). This time I used KiCAD to design the circuit and PCB.
The code is here. Initially I developed the code in a perforated board where I had soldered the circuit and connections. The yellow block was a test (in PLA) to see if the printer printed with the correct dimensions (more or less did). The black is the final one in ABS.
To finish the project I want to glue and acrylic rod on the LEDs as a light pipe and make the block solid.