You will need a breadboard, yes. Probably 2 or maybe 3 breadboards for your prototype, given all the LEDs you want to wire up. They can be clipped together if you get the same brand/model, but different brands may use different type or spacing of clips.
I would avoid those Dupont jumper wires. They are notoriously unreliable. For your breadboard prototype I would use solid core wire, cut to length and laid flat on the breadboard.
And importantly, choose a breadboard compatible Arduino. I would also recommend a classic Nano V3. Same processing power as an Uno R3 but in a smaller and breadboard friendly form-factor.
Unfortunately, several forum members have already recommended Uno, when it's already clear that a breadboard/strip board form-factor Arduino model is more appropriate for your project.
What are your thoughts on MOSFETs vs BJTs for this? Does one type of transistor make more sense than the other? I noticed the BC337 is a BJT but other folks were talking about MOSFETs. The 800mA max current sounds perfect — I could use the exact same core components for larger intersection models with more LEDs in the same group.
It's even less. The largest group is the north/south traffic light circuit with 3 sets of traffic lights on each side of the intersection: meaning 6x red/yellow/green on at any given time, and only 120mA total current for the group.
That's great. I'll experiment and see if I find some that perform well at extremely low currents. I could potentially bypass the need for transistors while also prolonging battery life.
These particular traffic lights have streetlights built into some of them. I'm trying to figure out how to make something the same (as I doubt anything off the shelf would have that design). The final version will have functioning streetlights with their own separate power switch.
One switch = traffic lights
One switch = streetlights
I was thinking of using a Pro Micro for the prototype then a Pro Mini for the finished product.
Having trouble choosing between the Nano and the Pro Micro for prototype now but tempted to go with Pro Micro because they say it's more breadboard friendly.
Unlike the BC337, the max current is 500mA per channel instead of 800mA, but it has eight channels instead of only one. Biggest draw will be 6x20mA (120mA), so even the biggest LED group would be well within its per-channel limit. The eight channels would also scale really well for more complex intersections with more lights.
Definitely feels like a more elegant solution to use two of these instead of 10 BC337s! I also like the fact no base resistor is required for each channel and they're directly compatible with the logic from the digital output pins. Sounds pretty much perfect.
I think I'll buy a couple of these but it sounds like I could potentially get lucky and end up with LEDs that are able to deliver decent brightness with only 2mA, which would mean no need for transistors even with the largest LED group.
500mA is the max for one channel not for all 8 at the same time. As with any device whether it's an IC, BJT, MOSFET or resistor, you need to make sure you do not exceed the device's maximum power dissipation.
Apparently, the max power dissipation is only 1.47W for the whole chip. I guess I need to read this to figure out how much total current I could pull through all the channels:
It's best to use the same for both prototype and finished product where possible. Otherwise you risk the finished product failing where the prototype worked fine.
Either model, or Nano V3, will be fine for your project. They are all breadboard compatible, except...
On the Pro Micro, some of the pins, for example the i2c pins (A4, A5), are not breadboard compatible. You won't need to use them in this project, but they might come in handy for later, more complex projects.
We are doing two diferent projects. My project is to teach the concept of a state machine and the concept of using millis() to create timed events/states. I only need 6 LEDs total for the first version. In a later phase I can add the pedestrian lights without and with press to walk then later still add the left turn scenario.
There is very little to be learned at least from a coding perspective of all the extra redundant lights. However if your project is to reproduce reality for perhaps a railroad setup or some other use like that then yes you will likely need more current thyan any MCU or MPU can provide. Now that you introduced that idea to me I will add an extra module to discuss the use of BJT's and MOSFETS and their differences to control more current than the processors can control.
Another board to consider is the Wemos line and also a Raspberry Pi RP2040 or the RP2350.
If the voltage drop of the ULN chip is 1.3V, and all 18 LEDs, that are lit at the same time, were powered through the same chip, it's dissipation would be 1.3 x 0.360 = 0.47W, so probably no problem for this project. That MOSFET array chip has much lower voltage drop, so much lower dissipation also.
some time ago I made a traffic light / City Simulation on a 16 x 16 map.
It not only has an intersection but also some smaller crossings.
Cars travel around and some of them have special tasks to perform.
Leds turn current into light at certain frequencies set by atomic bonds in material junctions. Photon energy-frequency makes color where red is low and blue is high. It takes more V to make red than green or blue, the Forward Voltage of a led makes the color (more driving V makes more current) and current makes photons flow. If there’s too much current, the junction melts/burns so always limit current to leds!
PS - forward voltage lowers slightly as the led warms up, a bit more limiting resistance is good; we use 220R with leds in general which calculates to < 20 mA to a cold red led.
Side note: you can detect light with leds. Leds with colored bulbs make color detectors. Stick the short (-) leg in GND and the long (+) leg in A0 and run a sketch that reads A0 every few seconds and displays read voltage while messing with light and shadow on the led. If you wait long enough (for your light level) the voltage will get to Vf (forward voltage) and won’t read higher.
Considering you probably won’t be operating at an ambient temperature of 85ºC, the actual current will be much higher. I calculated 219mA/channel at a temperature of 32ºC with a 90% power disipation to keep it cool.
The opposite, blue LEDs have a higher band gap the red - probably a typo. The previous sentence is correct red is lower frequency = lower energy, lower band gap and lower Vf.
In the early days of LEDs this lead to what I called "stupid LED tricks" , interesting but not particularly practical things you could do with LEDs. For exemple.
Okay. I think I'll still get a Pro Micro for initial testing, then will do further testing with a Pro Mini once I've got the logic all figured out. It would also probably be good for me to have some hands on experience with both models.
That's exactly what I'm looking to do here: reproduce reality. I'll only learn what I need in order to achieve that, and apparently redundant lights will serve an important role as they'll get the model one step closer to being an accurate replica.
The beauty of all this will be in its realism.
Interesting. That must've been hard to figure out!
219mA/channel means about 11 LEDs per channel max. That's pretty good. Means a single channel could handle up to 5 LEDs on either side of an intersection (i.e. 10 total). Ch1 could handle up to 10 red LEDs in a group. Ch2 could handle up to 10 yellow LEDs in a group etc.
If I ever built a more complex system, I could break groups of LEDs sharing the same logic up into multiple channels after the first channel hit 10 LEDs.