Putting together a row of LED's that goes from left to right by the use of a Pot.
All the diagrams I find has a resistor for every LED. I have wired the negative as common to all LEDs, Why can I not just put one resistor in this negative? As a pin gets high it will get connected to the resistor through the common negative?
A resistor is required to limit the current through each LED, except in the case that LEDs are in series.
The parallel connection you are describing will not work because individual LEDs have slightly different characteristics. That means that the current through the resistor would not be divided equally among them.
Even if the LEDs all had the same characteristics, the parallel connection would work properly ONLY if all LEDs were on at the same time.
HermanJFourie:
Putting together a row of LED's that goes from left to right by the use of a Pot.
All the diagrams I find has a resistor for every LED. I have wired the negative as common to all LEDs, Why can I not just put one resistor in this negative? As a pin gets high it will get connected to the resistor through the common negative?
LEDs (like all diodes are non-linear). The resistance of an LED drops as voltage increases. If the voltage is slightly too high the resistance drops you get excess current and the LED can (or something else) can burn-up. If the voltage is slightly too low, the LED will be dim. With a regular "constant voltage" power supply it's virtually impossible to get the voltage "just right".
A series resistor creates a voltage divider with the LED. But if you calculate the desired voltage drop across the resistor at the desired current* (Ohm's Law), the remaining voltage is dropped across the LED and the LED voltage "magically" falls into place at the desired current.
In series circuits the voltage divides among the components, but the same current flows through all series components.
Good diagram. For that one...you are assigning 1 voltage source for each LED. Each source is a digital output.
For each LED ... the current flowing through the LED will mainly depend on the digital output voltage and the resistor's resistance and the diode voltage drop. The current level is normally designed to be a suitable level ... eg 5mA or 10mA etc.
Not sure what you are saying? So for this application if all cathodes are connected and then a resistor to negative. It is fine as you are only going to power one LED at a time?
HermanJFourie:
Not sure what you are saying? So for this application if all cathodes are connected and then a resistor to negative. It is fine as you are only going to power one LED at a time?
Yes..... the digital outputs are able to supply up to 20 mA (or something like that). As long as all of the digital pins (combined) are not putting out something like 200 mA (total), then ok.
If the digital output is set to 5V, then consider it as being a source voltage of 5V. If you want 10 mA through the resistor (or roughly that), then I = 10x10E-3 ampere. Depending on what sort of LED you have..... it's often advantageous to know roughly what the forward voltage drop will be (when the LED is in normal working mode)..... let's just say it is 1.8V (if you know it from manufacturer's specifications). So the forward voltage drop of the diode is Vf = 1.8 volt (ie. assuming for now). Then the source voltage of 5V would need to be equal to (courtesy of ohm's law) Vf + I*R = Vf + 10x10E-3 x R. This is not accounting for 'source resistance' of a digital output pin (maybe 25 ohm).
This means 5 = 1.8 + 10x10E-3 * R.
Solve for R.
R = 320 ohm, for setting a current of 10 mA through the LED under the assumption that the forward voltage drop of the LED is 1.8V. Could choose 330 ohm (which is generally available).
To find out what the actual voltage drop of the LED is ..... you can hook up the LED system, and then use a multimeter (in DC voltage measurement mode) to measure the voltage across the LED (when the LED is glowing). If the forward voltage drop is much different from 1.8 volt, then just recalculate the required resistance needed to get 10 mA current flow.
On the other hand ... if you want some other amount of current ---- eg. 5 mA....then that's ok. Just recalculate.
Southpark:
R = 320 ohm, for setting a current of 10 mA through the LED under the assumption that the forward voltage drop of the LED is 1.8V. If you can make up a 320 ohm resistor, then great. Otherwise could choose 330 ohm (which is generally available).
Not the best description of standard component values.
There may be exceptions, but in general, you will never be able to tell the difference in brightness of a LED between a 320 or a 330 Ohm resistor. There are standard resistor values and 330 (or correspondingly, 33 or 3300) is one of them, so having calculated220 320 Ohm, you then pick the next higher (because you want to use less current rather than more) value to use.
(Badly worded table - E6 are the bold; all are E24 which is the basic series you would use in most cases.) For most uses, - such as lighting LEDs, ±10% will be quite satisfactory. There are many more values available for 1% resistors, but you do not need that accuracy for digital circuits.
HermanJFourie:
Putting together a row of LED's that goes from left to right by the use of a Pot.
All the diagrams I find has a resistor for every LED. I have wired the negative as common to all LEDs, Why can I not just put one resistor in this negative? As a pin gets high it will get connected to the resistor through the common negative?
Because the brightness will then depend on the number LEDs powered up - in effect you are limiting
the total current, not the current per LED. If you vary the number of LEDs lit up the resistor needs
to be chosen large enough to prevent damage to LEDs when a minimum number are lit, but that means
the brightness will be low when more are lit.
If you only light one at a time, its fine to share the resistor.
If you are just powering LEDs from a power supply, not Arduino pins, there is another reason to provide
a resistor per LED, which is that the variation in forward voltages will cause unequal current sharing
(this isn't an issue when driven from Arduino pins because the output resistance of a pin is about 40 ohms,
enough to prevent thermal runaway and give reasonable current sharing).
Every LED should have a resistor for the same reason why Mr. Peabody has his boy Sherman:
Every dog should have a boy.
But more to the point, you can put just one resistor on the common side if you are always only turning on one LED, or if you want multiple LEDs to appear to be on at the same time, but are in fact multiplexing them so they are actually on only one at a time, but are blinking fast enough that they appear to be solidly on. If more than one LED will be lit at the same time, then each should have its own resistor, and you don't need one on the common side.
ShermanP:
But more to the point, you can put just one resistor on the common side if you are always only turning on one LED, or if you want multiple LEDs to appear to be on at the same time, but are in fact multiplexing them so they are actually on only one at a time, but are blinking fast enough that they appear to be solidly on.
But you still need to be careful. If you do that, you must determine to cycle through all of the LEDs and either turn each on or not for the given time.
If you only include those you wish to illuminate in the multiplex cycle, then the proportion of time each is illuminated will differ according to how may are illuminated and the brightness will vary according to that number,
Paul__B:
But you still need to be careful. If you do that, you must determine to cycle through all of the LEDs and either turn each on or not for the given time.
If you only include those you wish to illuminate in the multiplex cycle, then the proportion of time each is illuminated will differ according to how may are illuminated and the brightness will vary according to that number,
But wouldn't you have the same problem even if you give each LED a resistor? LEDs which are on for a greater percentage of the time will appear to be brighter, even if the current is the same for each when on.
ShermanP:
But wouldn't you have the same problem even if you give each LED a resistor? LEDs which are on for a greater percentage of the time will appear to be brighter, even if the current is the same for each when on.
Ahh, yes, but that was not the point of the suggestion. It seemed to be about economising on 0.25¢ SMD resistors.
Sherman.... if the opening poster uses maybe 5mA for each of the LEDs (with each LED assigned to their own digital output with own series resistor), then should be ok to turn all of them on at the same time. No cycling of power between LEDs is needed, right? Could even bump up to 10 mA maybe.... for the mega 2560.
HermanJFourie:
Why can I not just put one resistor in this negative?
Herman ..... are you referring to a bunch of LEDs connected in series, and using 1 series resistor to limit the current? In your opening post, you refer to something like 1 resistor and LEDs, and you were asking a question about it. A diagram will be needed for clarity.
Your opening post title says 'Why does every LED need a resiStor' ...... so, at the moment, it's not yet established whether your question relates to asking why each LED (assigned to their own digital pin) requires a resistor ------ or something else.