Hello all. I am working on a design but am having trouble with the math calculations for selecting resistors.
My goal is to get the best refresh rate with little flickering and as bright of LED's as I can get.
The Project
21x16 LED BAR Array (21 rows, 16 columns) acting as VU Meters and driven by 5 74hc595 chips via an Arduino Mega.
Hardware Test
I have successfully tested my setup with 2 of the 16 columns operating. (and simulating the other 14 by writing out zeros to the shift registers)
Voltage
+5v from the Arduino
LED Bar Specs
Vf : 2.0V
Forward Current: 20mA
Max Forward Current: 100mA
The Columns (common cathodes)
Each column is looped through and turned on via 2 of the 74hc595 shift registers. Only one column on at a time.
Each column currently has a 2N3904 transistor and a 1.5K resistor at its base.
The software is looping through each column with a built in delay (D) of 510 Microseconds. I worked out this number by trying different values
My oscilliscope (if I am reading it correctly) is correctly showing roughly 0.5 Milliseconds for each column
The Rows (anodes)
Each row may have anywhere from 0 to 21 LED's lit
The leds "grow" from the bottom so they are all lit in succession creating a bargraph
The rows are turned on via 3 74hc595 shift registers
Each row has a 33Ohm resistor between the 74hc595 and the anode of the LED
My Questions:
1. How do I determine the best value for the row anode resistor ("Ra")?. I started with 220ohm but it was too dim, so I tried 33ohm. Much better but still a bit dim
2. How do I determine the best value for the common cathode resistor ("Rb") that is at the base of the transistor? - 1.5K was a guess based on some other similar designs.
3. What problems will I run into when connecting all 16 LED Bars that I may run into?
4. Is there an optimal value for my "delay" between each column lighting up?
Finally: If something goes wrong in my code, and a fault occurs and a column gets stuck "ON", how do I prevent the leds from burning out?
Schematics
I made up a few different versions - I hope these are helpful!!!
Closeup of 1 LED Bar and the resistors
Block Diagram
Full Crazy Big Schematic
Some Measurements I have taken
- 0.7mA : Between one anode resistor and it's LED - This seems small
- 0.11V: Between one anode resistor and it's LED - This seems small
- 0.4V: Between one cathode resistor and the 74HC595 pin
When ALL 21 leds are lit in a single column:
- 8.6mA - At the collector of the transistor to the common cathode
- 0.17V - At the collectorof the transistor to the common cathode
When only 1 led is lit in a single column
- 2.2mA - At the collector
- 0.36V - At the collector
Finally - My software setup
I am reading values from a digital audio workstation program on my computer (It's called "Reaper" - does what Pro Tools does). I am sending track VU data via USB Serial to the Arduino.
The arduino reads the values sent to it from the computer, and then writes them out to the shift registers via PWM
Psudocode:
void loop()
{
readTheUSBSerialData();
putSomeDataIntoArrays();
for(i=1;i<=16;i++)
{
writeShiftRegistersForColumn(i);
delayMicroseconds(510);
}
emptyAllShiftRegistersForColumnInCaseOfFreakout();
delayMicroseconds(510);
}
Thanks!
I hope I provided enough information and I appreciate any insights at all!
This is a personal project to add some digital VU meters to my home recording studio.
My goal is to get the best refresh rate with little flickering and as bright of LED's as I can get.
The Project
21x16 LED BAR Array (21 rows, 16 columns) acting as VU Meters and driven by 5 74hc595 chips via an Arduino Mega.
Hardware Test
I have successfully tested my setup with 2 of the 16 columns operating. (and simulating the other 14 by writing out zeros to the shift registers)
Voltage
+5v from the Arduino
LED Bar Specs
Vf : 2.0V
Forward Current: 20mA
Max Forward Current: 100mA
The Columns (common cathodes)
Each column is looped through and turned on via 2 of the 74hc595 shift registers. Only one column on at a time.
Each column currently has a 2N3904 transistor and a 1.5K resistor at its base.
The software is looping through each column with a built in delay (D) of 510 Microseconds. I worked out this number by trying different values
My oscilliscope (if I am reading it correctly) is correctly showing roughly 0.5 Milliseconds for each column
The Rows (anodes)
Each row may have anywhere from 0 to 21 LED's lit
The leds "grow" from the bottom so they are all lit in succession creating a bargraph
The rows are turned on via 3 74hc595 shift registers
Each row has a 33Ohm resistor between the 74hc595 and the anode of the LED
My Questions:
1. How do I determine the best value for the row anode resistor ("Ra")?. I started with 220ohm but it was too dim, so I tried 33ohm. Much better but still a bit dim
2. How do I determine the best value for the common cathode resistor ("Rb") that is at the base of the transistor? - 1.5K was a guess based on some other similar designs.
3. What problems will I run into when connecting all 16 LED Bars that I may run into?
4. Is there an optimal value for my "delay" between each column lighting up?
Finally: If something goes wrong in my code, and a fault occurs and a column gets stuck "ON", how do I prevent the leds from burning out?
Schematics
I made up a few different versions - I hope these are helpful!!!
Closeup of 1 LED Bar and the resistors

Block Diagram

Full Crazy Big Schematic

Some Measurements I have taken
- 0.7mA : Between one anode resistor and it's LED - This seems small
- 0.11V: Between one anode resistor and it's LED - This seems small
- 0.4V: Between one cathode resistor and the 74HC595 pin
When ALL 21 leds are lit in a single column:
- 8.6mA - At the collector of the transistor to the common cathode
- 0.17V - At the collectorof the transistor to the common cathode
When only 1 led is lit in a single column
- 2.2mA - At the collector
- 0.36V - At the collector
Finally - My software setup
I am reading values from a digital audio workstation program on my computer (It's called "Reaper" - does what Pro Tools does). I am sending track VU data via USB Serial to the Arduino.
The arduino reads the values sent to it from the computer, and then writes them out to the shift registers via PWM
Psudocode:
void loop()
{
readTheUSBSerialData();
putSomeDataIntoArrays();
for(i=1;i<=16;i++)
{
writeShiftRegistersForColumn(i);
delayMicroseconds(510);
}
emptyAllShiftRegistersForColumnInCaseOfFreakout();
delayMicroseconds(510);
}
Thanks!
I hope I provided enough information and I appreciate any insights at all!
This is a personal project to add some digital VU meters to my home recording studio.