Electronic – Building a simple mcu-driven array of LEDs

ledmicrocontroller

I'm planning to put together a simple shift-register driven array of LEDs as a first project, something akin to this:
Simple LED array
But using a 74HC595 shift register (two, eventually) and a transistor to drive each individual LED alone.

It's been twenty years since my (limited) formal electronics education, and I have a few questions:

  1. I believe understand why the resistors in line with the LEDs are necessary, because an LED essentially behaves like a short circuit, and will draw a lot of current from the register, right up until either it dies or the register dies. Is this correct?
  2. Why the "1K or 2.2K" resistor on the base of the transistor? Will I need one on each of the bases? Is this to limit the current between the base and emitter of the transistors? How do I know what value to use?
  3. Should I use 2N2222 transistors or should I use something like a 2N3904? What is the difference, other than the 2N2222 seems to have a much higher collector-emitter capacity? Does that affect the choice of resistor I need?

Best Answer

  1. Yes

  2. Yes. You can calculate the resistor by calculating base required current (you will need to know 'hfe' of your transistor). But you can just try. Working range is quite high, so if you will just use 500 Ohm for example, it should just work.

    For example, if max total current is 100mA, voltage is 5V, and hfe is 150mA, you need 100mA / 150mA = 0.6mA base current, so resistor should be 5V / 0.0006 = 8.3kOhm or less.

  3. There are lots of differences, but yes, it depends on how much current you will need in the worst case. If these LEDs are usual 10mA ones, almost any BJT will work so you can take what's cheaper or what you already have.

BTW. Don't see your shift register :-)