Using NPN-PNP transistors to run a LED array

Go To Last Post
23 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi All,

I am attempting a binary clock,and are having some doubts on whether the schematic will end up blowing all my LEDs. I hope I can explain it sufficiently from what I think is happening.

Did up a rough schematic in EAGLE and attached the png file.

Ok, here goes:

The LEDs each draw 20mA, and the current is provided by one PNP connected to the +5V source and base is connected to a pin on the microcontroller

The PNP is actually a Darlington pair with hFE(gain) of 1000.

Supposedly I provide a current of 0.12mA to the base of the PNP and the output provides 120mA of current to the 6 LEDs.

Now the individual LEDs are "selected" to be lit up by each of the 6 NPN transistors connected to it. Similarly, the base is connected to a pin on the microcontroller.

A current of 0.08mA will be passed into the base, with a hFE of 250, an output current of 20mA should flow through it to ground (I think)

Now the question is, let's say I activate the PNP transistor and it starts providing 120mA of current to the array, and I activate only the first NPN transistor below.

As I understand, only one LED (connected to the activated NPN transistor) will light up.

However, will the whole 120mA start rushing through it, or will the NPN transistor limit the current flow to 20mA?

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If you provide 0.12mA to the base of the PNP, the output may provide up to 120mA. R2-R7 are your current-limiters.

/Martin.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

current limiting resistors on the base of the transistors need to be added

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks for the replies,

just to confirm, if I fix a value of the resistors to obtain 20mA, I should only switch on one LED at a time? Else if I turn two on the current through the LEDs will be halved to 60mA right?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

No - each LED will take 20mA, the current through the PNP will be n*20ma where n is the number of LEDs lit.

I'd use a ULN2x003 darlington array chip instead of all the NPN transistors - a much neater solution and no base resistors needed. You still need the current limiting resistors on each LED though - and they would go between the LED and the collector of each darlington.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

edwardchuajh wrote:
The PNP is actually a Darlington pair with hFE(gain) of 1000.
Not if it's the 2N3906 you've drawn - a small signal PNP transistor with a min hfe of 30 and a max of 300. Unless you have selected a specific transistor from a batch, you need to design your circuit with hfe=30

See also http://www.kpsec.freeuk.com/tran... for how to do the design...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
current limiting resistors on the base of the transistors need to be added
Not needed here as there are resistors in emiters.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

MartinM57: Thanks for the info! I have been thinking of how I can fit a ULN2803 in too..

But I have trouble deciding what value of resistor I should be using. If I do not have any current limiting resistors on the base of the array.

Regarding the 2N3906, pardon the mistake, I was lazy to change in thus I stated its supposed to be a Darlington pair with hFE 1000 instead of the 2N3906 in the schematic =)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I would guess that you will end up with 4 digit select lines. And 8 segment lines for your common anode LEDs.

You will end up multiplexing the display, so each of the 4 digits is lit for 1/4 time. So the digit driver will be sourcing 4 * steady segment current * # of segments in this digit.
The segment drivers will be sinking 4 * steady segment current.
Typical figures may be up to 0..160mA and 0..20mA for a steady segment of 5mA.

If you use a ULN2803 for the segments and a resistor of 150R in each segment line. I am guessing 5mA steady-state current and 2V voltage drop over each LED. A more efficient 7 segment may use less current.

Your R8 base resistor could be 1K0 to 15K and still confidently saturate your PNP Darlingtons. When you want a transistor to saturate (turn on fully), you just ensure that you have at least 2 * necessary base current. i.e. > 0.32mA

A common rule of thumb for designing to saturate is 10 * worst-case base current. e.g. the transistor with the lowest hFE and display with highest Vcc and resistor with lowest value (0.95 for a 5% rsistor)

It does not matter if you have "too much" base current.

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks all, I will re-do the schematic and put it up soon =)

Really appreciate the help =)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
Not needed here as there are resistors in emiters.
So how many volts will be across the LEDs when the transistors are turned fully on? (hint less that 1/2V most likely)

Now if the circuit was a common collector circuit it woud be another story. ie tie the collecter directly to +5V and put the LEDs in the emitter side in series with the resistors.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
Now if the circuit was a common collector circuit it woud be another story.

Here the transistor works as a current stabiliser. The current is determined by R value.
Look at the attached picture.

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

But the base will NOT have 0.2mA as it is described in the original drawing above without series resistors in the base, it will have 0 or 5V.
The emitter will be 0 or 4.3V (5-0.7). The collector will be at about 0.3V from VCC. The leds will NOT light up.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

js:
Aha!!
Now I realised my mistake.

If Ue = 4.4V then at best there remains only 0.6V for Led.
I do not know why I did not see it before.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
remains only 0.6V for Led.
Correct. The transistor would be fully saturated so it would probably have a few hundred mV drop between emittter/collector leaving even less for the led.

Now if you remove the led from the collector and put it in series with the emitter/resistor and tie the collector directly to VCC you can control the transistor directly from the I/O pin into the base, saving 1 resistor, as the base will just take enough current to turn the transistor on and all the current willl flow from the collector into the emitter > led > resistor.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

js:
Yes, with common collector it will work.

A question came to my mind.
Can a transistor with common collector be fully saturated?

With common emiter the necessary base current is Ic/Hfe.
For a good saturation we put into base several times more current than Ic/Hfe .

But with common collector how we get base current over Ie/Hfe?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I can't remember all those details anymore..or even what I had for lunch. :lol:

What we have is an emitter follower circuit, so the emitter will follow the base less VBE or about 0.7V.
Provided that the source can supply enough current into the base then you will have the collector at the same voltage as the base when driven with a 1 from an I/O pin. (If the collector is at VCC)

Therefore VCE would be the same as VBE, not necessarilly fully saturated but close enough.

The important thing is that we have CURRENT gain ie the base will need to provide minimal current (ICE/the gain of the transistor in emitter follower mode) or for 20mA and a gain of 100 = 0.2mA.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi all,

I re-did the schematic with a ULN2803, however the ULN2803 doesn't seem to have a basic EBC connection, and it seems to have an inbuilt 2K7ohms resistor.

Can I change the values of the resistors coming out from the MCU pins to restrict current into the input pin of the ULN2803 to a value of 0.02mA such that the a current of 20mA will flow through it?

Lastly, in the setup, are resistors R1-R6 neccessary? If so, what value should it be?

This is a bit too confusing to me with my bare basic knowledge of electronics, really glad you guys can help =)

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I suggested a value of 150R for R1 .. R6.
You need NO resistors at all between the AVR and the ULN2803.

R8 can be 10K
R9 can be 1K0

Obviously R8, R9 are duplicated for each 7 segment display. I would guess that you will multiplex several 7 segment displays. Each segment 'a', etc is connected together. You only need R1 .. R7 for a 7 segment display. Each common anode goes to your '2N3906' sic.

I am a little confused as to why you only appear to have 6 segments.

I would suggest that if you google for the schematic of any multiplexed 7 segment, you would get a real-life example to copy.

Several AVR dev boards have 7segment displays.

Quote:
Can I change the values of the resistors coming out from the MCU pins to restrict current into the input pin of the ULN2803 to a value of 0.02mA such that the a current of 20mA will flow through it?

The chip already has internal resistors. You can treat it as a voltage controlled device. You supply 5V or 0V to turn an o/p on or off. Resistors R1 .. R6 limit the current. The ULN2803 would quite happily supply 500mA otherwise.

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You don't really need to use a darlington for the PNP if you don't want to. You can use a half decent PNP without too many issues, just increase the base current sourcing a little more. (eg use a BC807 and a set R8 to 1k, R9 to 10k.)

You don't really need the series resistors running from the MCU to the darlington array either, however, there is no need to remove them either.

R1-R6 are necessary, these are used to bias the current in the leds.

oddbudman

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi david, oddbudman, thanks for clarifying, I think I am finally starting to get how it works.

Sorry if I did not state my current situation. I am attempting to build a binary clock, based on this schematic:

http://davestech.blogspot.com/2008/01/simple-binary-clock-project.html
http://lh5.google.com/codesuidae/R5ACTcoP16I/AAAAAAAAA5Y/kUYOEdPPoIc/s800/binclockschematic.png

But instead of that I want to use a ULN2803 to save space. And I gather by doing so I might have to "reverse" it somehow since now the NPN side is providing the power and not the PNPs. The schematic I attached previously is just a section of it, to understand how the whole transistor thing works.

Hope I made sense!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am still confused about the 6 segments.

Regarding the schematics. Normally you would put the 150R limiting resistors in the collector line rather than the emitter line. Look at the data sheet of the ULN2803.

I am sure that there are some better projects than the one you have linked to. I had rather assumed you wanted a clock readable by humans!

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

haha I wanted a binary clock only readable by some!

Each row of the LEDs simply represent hours, minutes, seconds from the top. eg. a 5bit, 6bit, 6bit register

However I think after this long thread I am starting to get an idea of how I should proceed, and will do up a prototype and let you guys know!

Or come running back if I get stuck again too =)