max number of leds

I started to make some simple projects with leds using the 74hc595.
I use 8 leds per 74hc595 and each led has a 220? resistor.
At this time i have 2 74hc595 and 16 leds in the circuit and they are connected like this

I wonder if there is any limit in the max number of leds and 74hc595 i can use in order to protect arduino.

Thanks in advance.

There is a limit to how much 5v power you can safely draw from the Arduino. Not sure what that is but if you power from USB it's probably less than 500 mA. If you provide a hefty 5v power supply for the shift registers and LEDs then you should only be limited by how fast you can shift in bits and how often you want to change the output.

At 20mA per LED, you could connect probably connect up to 40 LEDs before you hit the 800mA limit of the 5V regulator.
Reduce the curent flow to each LED and you drive more of them.
( I read the data sheet as saying tota current flow should be limited to 70mA, so you should limit current to around 8mA/pin to avoid smoking the parts with all pins driving continuously at the same time).

I also hope you haven’t put that capacitor on the clock line, that will damage your arduino.
Yes there are limits but not fixed number, things get more complex as you scale them up and you have to add decoupling capacitors on the supplies and buffeting on the common shift register lines.

So i could use an NPN transistor and an external power supply in order to draw much lower current from the arduino?

Yes, exactly. Or a logic level N-channel MOSFET to switch the cathodes to ground, will dissipate very little power.

Thank you CrossRoads.
That was very helpful.

The maximum current that i can draw from the 5V pin is 800 mA?

The maximum current that i can draw from the 5V pin is 800 mA?

No it depends on the input voltage you will be limited by the amount of heat the regulator will dissipate:-