How do I calculate the proper resistance for the resistors on this circuit, the LEDs use a voltage of 3.4V and a current of 20mA?
For any given resistor, how many LEDs it is connected to will be on simultaneously?
- One LED, (5v - 3.4v) / 20mA
R[Ω] = U[V] / I[A]
R = (5 - 3.4) / 0.02 = 80 Ω
Assuming that a high state on the pin is 5V and a low state is 0V.
It might be worth considering an additional display driver, something like the MAX7219, to avoid directly load the chip.
That circuit is not a good design, and could easily lead to destruction of your Arduino.
You can't choose the correct resistor value, unless you are certain that only one LED in a horizontal row is on at any time.
The maximum amount of current into or out of a port pin must always be less than about 40 mA, which will be exceeded if even two (20 mA) LEDs in a single low side connection are turned on at once.
Wouldn't a single 5V/0.02A=250Ω resistor protect an input pin against any number of 5V/30A voltage sources? The LEDs on the same protected low side connection row would have to share the 20mA.
If two or more resistor-protected low side connections are connected to the same unprotected high side output port, that would exceed the high-side port's current limit.
It's the column ports that are unprotected.
Those are the two major disadvantages of that circuit, one potentially fatal to the Arduino.
Adafruit sells some nice chips and modules designed for driving LED matrices.
If you wish to try your circuit (while considering alternatives) use a resistor between 160 and 200 ohms to start. The brightness will be no where near the 20mA brightness but the LEDs will be viewable.
That would be (5 - 3.4) /0.02 amp = 80 ohms, I would start with a 160 to 200 ohm resistor.
Note, it doesn't matter how many LED's you have in horizontal rows, the current draw will not change very much. The LEDs will get dimmer the more LEDs you have on in a given row. AND because the LED's are likely not matched, some will be brighter than others.
KEEP IN MIND, these numbers are only approximate. The processor output will not be = 5.0Volts, more like 4.5 or lower. The LED's won't be exactly 3.4volts and will vary with temperature and current.
7 LEDs will be connected on it simultaneously
I'm pretty sure only one LED will be on. Here is the code for the display:
void display() {
for (int thisAnode = 0; thisAnode < 7; thisAnode++) {
digitalWrite(anodes[thisAnode], HIGH);
for (int thisCathode = 0; thisCathode < 7; thisCathode++) {
int thisPixel = pixels[thisAnode][thisCathode];
digitalWrite(cathodes[thisCathode], thisPixel);
if (thisPixel == LOW) {
digitalWrite(cathodes[thisCathode], HIGH);
}
}
digitalWrite(anodes[thisAnode], LOW);
}
}
What is the pixels array?
I set pixels[i][j] LOW, when I want to turn ON the (i,j) LED, and HIGH, when I want to turn it OFF
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
