So, I've built a circuit, it's a simulation of traffic lights. Here's a pic.
Now, for this I have used 6 resistors. My question is, can those 6 resistors be replaced by one resistor? It's just an idea of mine, just want to be sure it will work. Here's a pic again.
I think this should work, just want to stay safe.
NOTE: MOVE THE SLIDER TO THE RIGHT, SO YOU CAN SEE THE OTHER PART OF THE PICTURE. THAT'S WHERE THE MAGIC HAPPENS
If your design is a true traffic light simulation there is a condition where you will have two LEDs on each column lit simultaneously. In the UK this is Red + Amber. The full sequence being Green -- Amber -- Red -- Red+Amber -- Green. The sequence may be different in other systems. I presume at the moment you have a current control resistor attached to each LED. IF, and it's a big if, a sequence group of 3 LEDs were controlled and lit singley then you could use one resistor to drive each LED in this group of 3. Each group of 3 would require their own current control resistor. Because you may have 2 LEDs operating together you cannot use a single resistor because the current demand of the 2 in parallel is obviously greater than the individual LEDs. Say each LED has a specific current demand (say 20ma) the current limiting resistor is sized to suit this current, generally somewhere around 180ohms. Two LEDs lit together will require 40mA or so and the voltage drop across a 180ohm resistor would exceed the output voltage of your arduino, or to put it another way the drive current through each LED would be approximately half of what it should be and the LEDs would be dimmed.
jackrae:
If your design is a true traffic light simulation there is a condition where you will have two LEDs on each column lit simultaneously. In the UK this is Red + Amber. The full sequence being Green -- Amber -- Red -- Red+Amber -- Green. The sequence may be different in other systems. I presume at the moment you have a current control resistor attached to each LED. IF, and it's a big if, a sequence group of 3 LEDs were controlled and lit singley then you could use one resistor to drive each LED in this group of 3. Each group of 3 would require their own current control resistor. Because you may have 2 LEDs operating together you cannot use a single resistor because the current demand of the 2 in parallel is obviously greater than the individual LEDs. Say each LED has a specific current demand (say 20ma) the current limiting resistor is sized to suit this current, generally somewhere around 180ohms. Two LEDs lit together will require 40mA or so and the voltage drop across a 180ohm resistor would exceed the output voltage of your arduino, or to put it another way the drive current through each LED would be approximately half of what it should be and the LEDs would be dimmed.
You're right, I do have red and amber lit up at the same time. Thank you very much.
Can I get a more detailed answer? I am a beginner, so...
The reason I didn't give a detailed answer is because the same question is asked in one form or another over and over and over and over and over again on this forum. A simple search would have given you your answer from the thousands of threads all asking the same question.
Quite frankly, no offence intended to you, but I'm bored of answering the same questions and I wish people would learn to use google.
Yes you can use 1 resistor for multiple LEDs. But if you want more than 1 LED at a time to appear on and keep the brightness levels the same, you must time-multiplex them; rapidly lighting one at a time so that one or more appear to be on together. Otherwise, the brightness will dim as the current allowed by the resistor is spread between the resistors.
If the LEDs are different colors, the LED with the lowest turn on voltage Vf (typically Red) will turn on and the LEDs with higher Vf will not turn on without multiplexing.
So in this case, without multiplexing, and given that you expect the combination of red and amber but not red and green, then for each group of three, you can have one resistor for the amber, and one common resistor in the supply side for red and green.
Now of course, if you use the same resistor value for read and green, the red will have a (significantly) lower forward voltage, and may appear brighter. Since they will not be on simultaneously, you may not notice this.
Having read what CR suggests I agree, you can indeed use a single resistor. Since each LED will have a dedicated output pin on the arduino the single resistor will act as the common current control device. By using controlled switch-on you ensure that only one LED output at a time is actually active. I'd surmise a frequency of around 25Hz shouldn't be noticeable. To overcome brightness variation concerns you could drive each output via PWM rather than simple ON-OFF and effectively control the brightness between different LED colours. Since the PWM frequency will be much higher than the multiplexing frequency there shouldn't be any problem combining both switching frequencies.