Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

ULN2803A driving LEDs - brightness problem

Not open for further replies.


New Member
Hi all,

I'm using PIC PortB outputs to drive the inputs of a ULN2803A 8-network Darlington array, each output of which is connected to a LED and series resistor to +5V. A simple diagram schematic is attached.

The problem I am having, as you hopefully can see in the animated diagram, is that the brightness level of the LEDs as a group drops slightly for every extra LED that is turned on. This is not normally noticeable to the eye at the full 5V as the brightness level remains sufficiently bright not to notice. However, if you use PWM to reduce the brightness of the bank of LEDs to say the 20% level (via extra circuitry not shown), you can definitely notice the drop in brightness for each extra LED turned on by the PIC. (A similar effect can be noticed when a limiting resistor is inserted after the 5V input, say a value of 1K, to produce a similar dimming level rather than using PWM.)

Could someone please suggest a reason why this might be happening and perhaps offer a solution to this? I've tried replacing the ULN with a bank of BCX38Bs transistors but the same result remains. I've also changed the LED supply voltage from 5V to 9V, again the LEDs all dim as a group when an extra one is lit up.



(I've exaggerated the drop in brightness in the diagram for clarity)
**broken link removed**
The problems could be,
1) Your power suplpy is weak and is not able to source the required current.
2) No resistors are required in between PIC and ULN2803. Directly interface it since its inputs are TTL compatible.
3) I have observed that ULN drivers sometimes require pull-ups to be connected to their inputs. Use 10k resistors for pull-ups.
I'd have to agree on the power supply as the probable culprit. I have a realy driver board using the same chip and see no effect on the led's when all 8 are being driven together. If you want a cheap power supply with some real power and stability, scavange an old AT PC power supply.
But what I really wanted to commend you on was your really neat animated diagram. Better than a thousand word explanation.

Thanks for your replies, guys.

The power supplies I've tried are:
(a) a 9V Duracell battery, brand new
(b) a slightly older and well used 9V battery
(c) my main 10V power supply capable of supply 2A, this is the pwr supply I'm using via a 5V reg to power the PIC side of things.
(d) the regulated 5V itself from the PIC side of things.

All these supplies have been substituted for the "+5V" in the diagram above, all with the same problem. Namely, the sequential switching on of LEDs causes them as dim slightly as a group.

With reference to kinjalgp's suggestion number 2 of not using resistors to the INputs of the ULN from the PIC, I've tried that also. A direct wire connection from PIC PortB pins to the INput pins of the ULN present the same problem.

I've just tried connecting the pull-up resistors suggested by kinjalgp in his point number 3, however this has the result of turning all the LEDs on all the time regardless of PIC port logic output state, since of course the INputs of the ULN are high all the time then (V+ thru pullup to IN).

I'm really stuck here, folks!

These are just simply 20mA or so red LEDs. Surely the power supply doesn't need to be beefy to drive 8 LEDs at a uniform brightness via a ULN?

Incidentally, I've tried this also using BCX38B transistors with their emitters commoned, also a CA3083 5-transistor chip (not Darlington). Same problem results for all of these methods.

Could there be some issue with the current drive from the PIC PortB pins? That is, when one PortB pin is switched "on", the current flow from that pin going onto the base (INput pin on the ULN) and then through the emitter is also helping to drive the LED? And when more PortB pins are "on" the current is divided between them now, thus less base-emitter current per node and less brightness is the result?

That means your PIC is not able to sink the amount of current provided by pull-ups. You may try increasing the resistor value to 47k.

Also it is not necessary to use 5V supply for ULN2803. You can directly use 9V or 12V supply. Accordingly change the value of LED series resistors.
It's very easy to check if it's anything to do with the PIC, simply unplug it, then link the PIC side of the resistors to 5V one after the other and see if the LED's vary in brightness then.
Thanks for your replies.

I've tried upping the pull-up resistors to a value such that they don't turn on unless the Port pin is on. Same dimming problem results.

I've tried Nigel's suggestion of testing the ULN by directly connecting the inputs to +5V and disregarding the PIC altogether. The attached image shows what I'm doing.

Unfortunately, the same gradual dimming effect is present even in this simple test circuit.

I wonder if someone might be able to replicate this simple circuit and tell me what results they get? I have tried changing the ULN chip to another one but the problem still persists. Unless I have a dodgy batch of ULNs, I don't know why this dimming effect should prevail when both the 5V supply for the inputs and the 9V supply to drive the LEDs themselves are well up to the job.



**broken link removed**
Remove that 1k from the common 9V line and put individual resistors in series with each LED to see if it works.

The combination of 1k and 330R forms a potential divider which will gradually decrease the voltage as more and more LEDs are turned on.
kinjalgp said:
Remove that 1k from the common 9V line and put individual resistors in series with each LED to see if it works.

The combination of 1k and 330R forms a potential divider which will gradually decrease the voltage as more and more LEDs are turned on.

With those values it wouldn't even be very gradual, it would really make the problem much, much worse - it's just the sort of thing that would cause your original problem.

Have you tried measuring the voltages?, connect the negative of a meter to the cathode (bottom) of one the LED's and the positive to the top of it's 330 ohm. Turn just that LED on and note the voltage, then turn all the rest on and see if the voltage changes (decreases) - make sure the 1K isn't there when you do this. Assuming the voltage changes, then try measuring from the cathode of the LED (positive lead) to GND (negative lead) and see if it changes (increases) there.
Chris, ive breadboarded a circuit similar to what you have but i could not dupplicate the problem you are having. Heres a schematic of my circuit:

**broken link removed**

Note that pin 10 is left unconnected, when it is connected to +V the LEDs that were off glowed dimly but it did not effect the LEDs that were on. Im assuming the problem is with your power supply. Did you use a common ground connection in your dual supply rails ?
I wonder why darlingtons are needed to drive LED?
I connect the anode of LED to PIC port through 1K resistor, and connect the cathode of LED to the groud; that will do
You can adjust the brightness by changing the resistor value. I have tried with some value, i guess 1K is just nice
Perhaps this has been mentioned, but as the number of LEDs in the on state increases, the total current demand increases. Because of that 1K resistor (whose purpose I dont understand) the voltage at the anode of each LED will be related to the number of LEDs active. This would cause the dimming that you see. What is the purpose of the 1K resistor?
Yes you guys are correct, of course. Silly me. The purpose of the 1K resistor was to reduce the general brightness level such that when switching on/off the LEDs the drop in brightness problem I was describing earlier was more noticeable to the eye. I realize I should have increased the 330R resistors individually now, but as they were hard-wired in to a stripboard circuit of LEDs I couldn't do so. My mistake.

(StupidDum): The ULN2803 darlington is used in this circuit to switch many things, not just LEDs. The LEDs were used as an example. They could also be driving lamps and motors in my eventual application. The problem was best hi-lighted by using LEDs as the drop in brightness could be easily observed.

(nettron1000): Many thanks for your test. For info, I am using a common ground rail yes, and I have to have the 9V plugged into the pin 10. If the grounds are not commoned then I get the same effect as you with the "off" LEDs being on at a low brightness. That is, until I put resistors between the 5V and input pins 1 to 8, when the off level brightness is reduced. I can only assume there is some current leakage between input and output pins. I don't know. I used 10k resistors (see diagram at very top of topic) and also 22k, to experiment.

Thanks to everyone who replied here, I appreciate your constructive help. I shall go away and read up about potential dividers!

Don't use 1K at all - just replace 330R resistors with 740 Ohm:
(9V-1.9V)/0.0094A=750 Ohm but resistors 680-820 Ohm will do just fine. The 1k resistor is the culprit as crust has already found.
Each LED draws ca 9.4mA when powered by 5V and with
330 Ohm in series:


In other words your power supply should be capable of at least
8*9.4mA=75.2mA just for the LEDs. This is pretty much out of league
for the tiny 9V battery. 9V batteries are very poor source when
demand exceeds some 15-20mA.
I have also experienced the same problem of drop in the led brightness resulting from the fact that some other leds(that arent required) are turned on.I used this ULN for switching purpose by controlling the amount of current via micro controller(MEGA8). What I found was that when only 1 input of ULN 8 series transistor was kept high (while others low), the output corresponding to ther inputs that were low also went low. i have tried this using the pull up resisitors of different values, but every timesame problem occured. There is one pin- free wheeling diode which i havent connected. Someone please tell where is the problem
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips