switching LED's with 74HC595 and 2N222 transistors

HI GUYS,
I'm making a project with my arduino uno, 10 * 74HC595 switch registers and 80 * 2N2222 NPN transistors and a 24VDC power supply. (see image)
I have a question:

  • Do I need to use resistors in my circuit before the transistors?

Thanks,
Robbe

There will be 80 controls (transistors) with 10LED's per control (in series?)

That's doing it the hard way.
Instead, use TPIC6C595 or TPIC6B595. Each output goes to a series resistor/LED to the 24V. Shift in a 1, the output goes LOW, connected to an LED cathode to turn it on. Shift in a 0 to turn it off. No transistors needed.
https://www.digikey.com/en/products/detail/texas-instruments/TPIC6C595N/276260

I agree. The TPIC6B595 is great for controlling lots of LEDs from a few pins on the Arduino. I’ve wired loads up for massive strings. They will handle quite a lot of power too, so I’ve used them to drive solenoids as well.

This is the board I use to make wiring up easy, but they are pretty easy to use on a verobaord.

I also agree with the suggestions above. But to answer your 3 questions: yes (both), yes (you need them, but not not connected like that), yes.

If you place 10 leds in series, you will need a very high voltage to drive them. Around 24V for 10 red leds for example. Maybe 36V for blue or white leds. And you would still need a resistor.

Here is a useful tool to help decide whether to connect leds in series or parallel and calculate the series resistor values for you.

PaulRB:
I also agree with the suggestions above. But to answer your 3 questions: yes (both), yes (you need them, but not not connected like that), yes.

If you place 10 leds in series, you will need a very high voltage to drive them. Around 24V for 10 red leds for example. Maybe 36V for blue or white leds. And you would still need a resistor.

Here is a useful tool to help decide whether to connect leds in series or parallel and calculate the series resistor values for you.

Thanks for the Help, I am using a power supply of 24VDC so that's no problem. The LED's are Warm white so I can't place 10 in series but that's not a problem.
Is this a correct pic for placing the capacitor?

Hang on! This is getting quite out of hand!

You are showing 74HC595s which were never intended for driving LEDs. Ignoring the internal resistance of the 74HC595, and presuming the green LEDs drop say, 2.5 V, then the 470 Ohm resistor would nominally supply 5.3 mA.

This is just senseless!

A MAX7219 is designed to drive 64 LEDs in a matrix (yes, all at once) using one resistor (and the 100nF capacitor) and you can chain a number similarly to the 74HC595s to control successive groups of 64. Whilst multiplexing, the effective LED current will also be 5 mA (one eighth of 40 mA) so the brightness is at least the same.

And the same story as always applies - I recommend buying some of the MAX7219 matrix module kits, unassembled like this:

Better still buy some extra, assemble one with the matrix provided for practice, and wire the others to your own arrays.

You need a switchmode "buck" converter to obtain a regulated 5 V supply from your 24 V for your Arduino and the LEDs and drivers.

It's not clear to me how the OP intends to wire the leds, but it sounds like he might want to control 16 groups of 10 white leds and power the leds with 24V. If I'm right, max7219 might not be suitable. Instead, perhaps 2 groups of 5 leds in series, each with a series resistor, switched with an npn transistor, with resistor on the base, each base controlled by a 74hc595 output.

Is this a correct pic for placing the capacitor?

Yes, but you need one per 74hc595, and they should be 0.1uF ceramic, placed as close as you can conveniently get them to the VCC and GND pins of each chip.

PaulRB:
It's not clear to me how the OP intends to wire the leds, but it sounds like he might want to control 16 groups of 10 white leds and power the leds with 24V. If I'm right, max7219 might not be suitable. Instead, perhaps 2 groups of 5 leds in series, each with a series resistor, switched with an npn transistor, with resistor on the base, each base controlled by a 74hc595 output.
Yes, but you need one per 74hc595, and they should be 0.1uF ceramic, placed as close as you can conveniently get them to the VCC and GND pins of each chip.

That's correct, I tested it and i can set 8 led's in series (3V*8=24V) for full brightness. I am soldering my LED's right now. So for each shift register, I need a 0.1uF condensator and I need to place a resistor a between each output and the base of the 2N222 transistor. Wich value of resistor do I need, 1K?

What is the voltage across each LED, generally referenced as Vf (f for forward voltage)?

Resistor value will be: (24V - (5 x Vf))/current desired = resistor value
So say Vf was 3.2V, and you want 10mA of current.
Then (24V - (5 x 3.2V))/0.01A = 800 ohm

TPIC6B595 has current Sink outputs. If you want current Source outputs, then use MIC5891.
Individual transistors is a lot more effort, especially if you have an Arduino controlling things.

These schematics show 12V vs 24, both chips will work at 24V. And 5 LED vs 3 LEDs as long as the correct resistor is used.
I typically use SPI.transfer() to quickly load up shift registers, you can use shiftOut() as well.

If you want to go the NPN route, then connect the LEDs the same as the TPIC6B595.
You’ll also need a resistor between each Arduino output and the NPN base pin, which to the Arduino looks like a diode to Gnd, so you have to limit the current there. Same calculation as for the LEDs, and set the current to 25mA max.
(5V - 0.7V)/.025 = 172 ohm, so use a 180 ohm resistor. You can do the math and see the effect of using 150, or 220, which are other nearby standard values. Or two 100’s in series to make 200 ohm.

robain:
I tested it and i can set 8 led’s in series (3V*8=24V) for full brightness.

Really? What supply voltage will you use? What value series resistors? Did you use the calculator I suggested?

robain:
I need to place a resistor a between each output and the base of the 2N222 transistor. Wich value of resistor do I need, 1K?

1K may be OK. That would provide a base current of around 4mA. We want the transistor to be in saturation, and it might only have a gain of x10 like that, so can sink up to 40mA from the leds.