Driving LED's from a PIC16F84A

Discussion in 'The Projects Forum' started by RodneyB, Sep 5, 2013.

  1. RodneyB

    Thread Starter Well-Known Member

    Apr 28, 2012
    I am wanting to drive several LED's from a single pin out put on a PIC 16F84A.

    The sink and Source current is 25mA

    I assume I will have to drive the LED's through a transistor. Using a BC547 transistor. is a 10K resistor suitable.

    Many thanks
  2. MaxHeadRoom


    Jul 18, 2013
    2n7000, no resistor?
    RodneyB likes this.
  3. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    The BC547 driving 25mA Ic will have a beta at least 50-100.

    So assuming a beta of 50, you need half a mA into the base.

    The PIC output pin is maybe 4.5v when high, the base is 0.7v, so the resistor drops 4.5 - 0.7 = 3.8v.

    A 10k resistor will allow current of 3.8v / 10000 = 0.38mA.

    So yes it will probably work fine with 10k, but it is very close to the limit. A value of 4k7 or 5k6 would be a better choice I think.

    If your BC547 collector current (Ic) is more than 25mA, you will need to recalculate.
  4. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    While the PIC is capable of 25mA you fail to state what the LEDs themselves require.

    However... let's just look at the BC547 data sheet: VCE(sat) is spec'd at 600mV max for Ic=100mA and Ib=5mA. Operating in saturation is a good thing as it minimizes the power lost in the transistor. This device is listed to work with a gain of 20.

    Assuming a 5V supply on your PIC the output current thru a 10K resistor would be about (5-.7)/10K = .47mA.

    As .47mA << 5mA the resistor is too small for this application. A more suitable value would be:

    R = E/I = 4.3V/.005mA = 860 ohms.

    I would select a standard value of 820 ohms.
  5. Markd77

    Senior Member

    Sep 7, 2009
    If you are doing the same with a few pins of the PIC, each driving multiple LEDs, then a ULN2803 is a handy chip to use, it's got 8 500ma outputs and the inputs can be directly connected to PIC pins.