Components and supplies
Rotary potentiometer (generic)
Slide Switch
Arduino Nano R3
5 mm LED: Green
5 mm LED: Red
5 mm LED: Yellow
Resistor 100 ohm
Tools and machines
Hot glue gun (generic)
Soldering iron (generic)
Plier, Long Nose
Project description
Code
Downloadable files
Fritzing Layout of Traffic Lights
Take a look at this image as a guide to the Traffic Lights wiring.
Fritzing Layout of Traffic Lights
Comments
Only logged in users can leave comments
stemmayhem
2 years ago
Thanks for the comment. We will keep an eye out for your students project.
dhgibbs
2 years ago
This will make for a great project for my son and I. He loves the Hot Wheel and Lego cars and having a few of these spread out would make for a sweet little robust town. I'd be interested in knowing if a mesh network could be configured into the several of the lights to replicate an ideal flow of traffic. Thanks for putting this together.
stemmayhem
2 years ago
Hot Wheels and Lego are the exact reason I built it :) I think you could make a mesh, either by using a single Uno, or by adding Bluetooth to this one. You could give each set of lights an id, and just detect the previous id and then sync to whatever time you want. Saying that, I am not sure how old your kids are, but mine certainly would hate an ideal traffic flow. Sounds awesome to me, but they want to stop and start at these lights, not hit a green all day long :) Let me know if you create a network. Thanks for the comment.
Anonymous user
2 years ago
Excellent project. The ATMega328 also has three internal timers that you could use to time events. It would be interesting to see this project use one of these timers. Thanks for sharing.
stemmayhem
2 years ago
Hi Dan... I am pretty new to Arduino, and I have never used the ATMega328, and I didn't know it had internal timers. That's very cool to know. Thanks for the comment!
Anonymous user
2 years ago
This was a very nice project i made it too i like it because didn't use delay
Jitto_Joseph
5 years ago
This was a very nice project i made it too i like it because didn't use delay
dhgibbs
6 years ago
This will make for a great project for my son and I. He loves the Hot Wheel and Lego cars and having a few of these spread out would make for a sweet little robust town. I'd be interested in knowing if a mesh network could be configured into the several of the lights to replicate an ideal flow of traffic. Thanks for putting this together.
stemmayhem
2 years ago
Hot Wheels and Lego are the exact reason I built it :) I think you could make a mesh, either by using a single Uno, or by adding Bluetooth to this one. You could give each set of lights an id, and just detect the previous id and then sync to whatever time you want. Saying that, I am not sure how old your kids are, but mine certainly would hate an ideal traffic flow. Sounds awesome to me, but they want to stop and start at these lights, not hit a green all day long :) Let me know if you create a network. Thanks for the comment.
Anonymous user
6 years ago
Excellent project. The ATMega328 also has three internal timers that you could use to time events. It would be interesting to see this project use one of these timers. Thanks for sharing.
stemmayhem
2 years ago
Hi Dan... I am pretty new to Arduino, and I have never used the ATMega328, and I didn't know it had internal timers. That's very cool to know. Thanks for the comment!
sandromesquitamecatronica
6 years ago
Very good, my students made one similiar, I'il post soon.
stemmayhem
2 years ago
Thanks for the comment. We will keep an eye out for your students project.
Anonymous user
6 years ago
I like this project for its hardware simplicity and for a good introduction to using millis() instead of delay(). The 100 ohm resistance is probably a good choice as well, especially if it gives sufficient illumination without overstressing the LEDs or the Arduino's microcontroller chip. Typical (not low-current) red, orange, and green LEDs will light up adequately at 10mA forward current (If) and will have a forward voltage between 1.8V and 2V. Two of these in series will drop about 3.8V at 10mA, and the Arduino's output voltage at 10mA will be around 4.8V. Therefore the series resistance will be (4.8V - 3.8V) / 0.01A, which is indeed equal to 100 ohms. There are certainly many ways to do the timing delays with negligible blocking, and your method is pretty good. I really like this project for anyone interested in adding realistic traffic lights to a layout!
stemmayhem
2 years ago
Thanks Jeff. Really appreciate this reply. I am glad you cleared up the resistance, as I am a little overwhelmed by this part of Arduino. I am just getting used to programming without using delay. I like it not just because it is a challenge, but it allows me to add different blocks of code to other projects. When you use delay, it blocks everything. Thanks again for taking the time to write this reply, and I am glad you liked it.
sandromesquitamecatronica
2 years ago
Very good, my students made one similiar, I'il post soon.