Advanced Raspberry Pi traffic lights simulator

My previous post about Raspberry Pi traffic lights introduced simple traffic lights simulator. I developed the solution further and came out with more advanced version that has better architecture, more flexible design and support for traffic lights schedules that are automatically downloaded from remote server.

I published new and more advanced version of traffic lights project where software side is more advanced and arhchitecturally more generalized. You can find link to my work from GitHub by following the link given below.

Source code available! To get the whole source code with explanations and guidance please go to my GitHub repository WindowsIotTrafficLights.

Raspberry Pi traffic lights architecture

Solution includes the following:

  • Source code of all components, simple online documentation about hardware and software pieces
  • Windows 10 IoT Core background service and UWP application projects (UWP has also form based traffic lights implemented)
  • Separate library with granulated classes that hold traffic lights logic
  • Different implementations for interfaces needed to switch traffic lights
  • Automatic update and loading of traffic lights schedules from remote server
  • Two traffic lights schedules (one for regular traffic lights cycle and another one for blinking yellow)
  • PHP script to serve randomly traffic lights schedules.

Feel free to dig around in my code and try it out. Also feel free to make improvements to code and give me a feedback.

Great example for kids

You can be evil and screw your kids brains with this sample. Just try to explain what it means to blink yellow light but do it through guiding questions so they really have to think. Maybe I’m not very good on discussions like this but here is my example that you can improve.

You: How you say to computer: “I want to blink yellow light”?
Kid: You tell it to do it – just blink the yellow light!
(You make yellow light blink and red one constantly on)
You: Is it really enough?
Kid: Hmm… umm… ooo…. no?
You: So, what I have to do more?
Kid: You have to turn out green and red light!
You: Right you are. But now, what’s blinking?
Kid: Yellow light blinks!
You: It’s actually two steps, just remember what we did with red and green.
Kid: Aaah! We turn yellow light on and off!
You: Yes, right! You just deserved some candies.


Gunnar Peipman

Gunnar Peipman is ASP.NET, Azure and SharePoint fan, Estonian Microsoft user group leader, blogger, conference speaker, teacher, and tech maniac. Since 2008 he is Microsoft MVP specialized on ASP.NET.

    2 thoughts on “Advanced Raspberry Pi traffic lights simulator

    Leave a Reply

    Your email address will not be published. Required fields are marked *