High side LED switching

Hey guys,

I'm using some RGB LEDs in my project, which have a common cathode. However, I'm also using 10 of them at once. My question here is twofold: can the picaxe source enough power to power all ten of these LEDs (20mA typical forward current per colour, obviously through resistors)?

If the picaxe can't source enough power to power all 10 LEDs, then the obvious solution is a transistor switching circuit. However, as the LEDs have a common cathode as mentioned above, the traditional NPN low side switching seems to be out the window. I also heard there were some difficulties using a PNP transistor to do the switching; so my second question is if the picaxe can't source enough power, what sort of switching circuit should I use?

Cheers guys
 

hippy

Technical Support
Staff member
Ten RGB LEDs will be 30 LEDs in total, at 20mA each the PICAXE would need to source 600mA; that is way above what any PICAXE can source -

http://www.picaxeforum.co.uk/showthread.php?11963-PICAXE-I-O-Current-Capability

I cannot advise on the high-side switching other than to say there are UDN high-side drivers and transistor solutions.

An easier solution may be to use common anode RGB LEDs and low-side switching or to choose SPI controlled LED controllers such as used in APA102-based RGB LED strips.
 
Possibly a stupid question - if you wired the LEDs in series with one another, wouldn't the total current be 20mA, since in a series circuit the current is constant throughout? And we're only going to be using one of the colours at a time; in fact, the blue colour isn't going to be used at all, the RGB LEDs were simply cheaper than bi-colour LEDs :)

In relation to the second point, Unfortunately other LEDs aren't much of an option... This is for a college project, and the college already sourced the LEDs for me, and the deadline for placing orders this financial year has passed... :-(
 

AllyCat

Senior Member
Hi,

Two problems with wiring the LEDs in series: Firstly, each LED drops around 2 - 3 volts, so 10 in series are going to need a supply of at least 20 - 30 volts! Secondly, how are you going to wire the two coloured LED chains independently in series, if they have common cathodes?

High side switching is only a particular complication if the "LED" supply rail voltage is higher than the PICaxe's supply rail (e.g. if the LEDs were to be wired in series). But if they both use the same supply rail (of about 4 - 5 volts) then you can simply use one PNP transistor (typically BC327) for each set, emitter to the supply rail, collector to the parallel set of LEDs. Normally, each LED needs a separate series resistor of around 100 - 180 ohms for 20 mA from a 4 - 5 volt rail.

200 mA per set of LEDs will need around 5 - 10 mA base current, so connect a resistor (something from 220 ohms up to 1k) between each base and its PICaxe output pin. Drive the output pin Low to switch on the LEDs.

If you don't have access to any "medium power" PNP transistors (or P-channel FETs), then NPNs (or N-channel logic-level FETs) are possible, but not as good or as convenient.

Cheers, Alan.
 
Two problems with wiring the LEDs in series: Firstly, each LED drops around 2 - 3 volts, so 10 in series are going to need a supply of at least 20 - 30 volts! Secondly, how are you going to wire the two coloured LED chains independently in series, if they have common cathodes?
That is what I call a fair point... and rather obvious with hindsight!!! oopsie.

So basically, I could simply wire up the PNP transistor in almost the exact same way I would an NPN transistor (obviously moving the LED & resistor), but "invert" the output from the picaxe - have the output high when I want to turn the LED off?

So I suppose my final question then is, since I have almost no experience working with transistors (I like my projects simple...), anyone know what size of base resistor I should use? I'm planning on using an 8550 transistor (TO-92 package)
 
I said that I was only using one colour at once - there are 10 RGB LEDs, yes the equivalent of 30, but only 10 will be used at once - either green or red. This means all the calculations can be done assuming 10 LEDs, since only that amount of current will be drawn at any one time.
 

lbenson

Senior Member
I said that I was only using one colour at once - there are 10 RGB LEDs, yes the equivalent of 30, but only 10 will be used at once - either green or red. This means all the calculations can be done assuming 10 LEDs, since only that amount of current will be drawn at any one time.
So you need to be able to switch 20 if blue is out of the picture. Will they be switched independently or all green, then all red?
 

inglewoodpete

Senior Member
I'm using some RGB LEDs in my project, which have a common cathode. However, I'm also using 10 of them at once. My question here is twofold: can the picaxe source enough power to power all ten of these LEDs (20mA typical forward current per colour, obviously through resistors)?
Check that figure of 20mA per colour with the data sheet. In many LEDs, 20mA is the MAXIMUM current per LED. 16mA is safer and you will be hard pressed to notice the difference in brightness.
 
For high sid switches the is the UDN2981A or the TBD62783A
See my recent post here:
http://www.picaxeforum.co.uk/showthread.php?29775-ULN2803A-UDN2981A-drop-in-DMOS-alternatives-to-consider
Mad others have mentioned each colour has a different forward voltdrop and needs a different value of series resistor to balance the currents/intensities.
I'm afraid I can only work with what I have at the moment - The deadline for ordering components into the college came and went unexpectedly the other day, so i can only use the components we have on hand. For transistors, that means 8550s.
 

AllyCat

Senior Member
Hi,

anyone know what size of base resistor I should use? I'm planning on using an 8550 transistor (TO-92 package)
The minimum current gain of the 8550 is about 70 (it's only quoted in the data sheet at 100 and 800 mA). So 200 mA (if 10 LEDs at 20 mA each) would need at least 3 mA base current. But that's for 1 volt drop across the transistor, to saturate it properly you should assume a gain of 20 - 40, so that's 5 - 10 mA. With a 4 volt drop (assuming a 5 volt rail and 1 v across the Vbe and the PICaxe output pin to ground), that would be 400 - 800 ohms, say 470, 560 or 680 ohms from the "preferred" (E12) resistor range. The standard "1/4 watt" (CR/MR25) power rating should be fine for both the base and all the LED series resistors.

The Forward voltages of the LEDs look to be about 2v (red) and 3.3.v (green), so each series resistor should be around 150 ohms (red) and 100 ohms (green), assuming a 5 volt supply rail.

Cheers, Alan.
 
Last edited:
I know... That's the obvious and simple solution... But the final plan was only handed to me once I'd ordered the components... And relays wasn't on that list. Grr. I have the spare outputs anyway, and plenty of space for the transistors to slot into place - and this is where I get technical.

This PCB isn't only doing this job, it's also going to be designed with a totally different function. The reason behind this is that I can get 3 PCBs of the same kind cheaper than two different ones. So the board is going to be reasonably generic, and do both functions at the same time. And since the second project uses MOSFETs, which have the same footprint as the transistors, it's already going to be there :)

I suppose, though, that transistors are more reliable in the long term, since this thing is going to be going to engineering exhibitions / school and recruitment events...
 

hippy

Technical Support
Staff member
I suppose, though, that transistors are more reliable in the long term, since this thing is going to be going to engineering exhibitions / school and recruitment events...
If it's that important it would seem there should be some scope for getting the appropriate components, an argument that it should be done properly. A high-side driver array shouldn't be that expensive.
 
I'd agree with you Hippy - but the college stopped placing orders, presumably so they can start collating accounts before the financial year ends. Unless I buy them myself, and I'm on an apprentice wage, I can't purchase any more parts... :-( the main reason for transistors is that I have a pack of about 250 of them sitting here doing nothing, and I don't have any relays... And the only relays in the college are currently built into Robot Wars robots. Yeah.
 

westaust55

Moderator
For the SS8550 transistor, albeit for a higher collector current, the effective hfe(sat) is only 10.

That is fairly typical where the gain in saturation is around 10% of the gain in the linear region.

Thus for say 20 mA LED current in the collector you need 2 mA in the base circuit to keep the Vce down to around 0.3 volts.
 

AllyCat

Senior Member
Hi,

It's really not possible to do a "serious" design calculation without knowing the intended supply voltage and perhaps more detals of the power supply in general. But just to drive a few LEDs doesn't need the transistor to be driven "hard" into saturation. Any residual saturation resistance can be considered as part of the series resistance, and/or the subjective loss in brightness will be neglible anyway.

The OP is planning to run the LEDs sufficiently below their peak current and the transistors are generously rated. So IMHO any issues of (un-) reliability are much more likely to be due to the "quality" of the soldering, connectors or PCB, etc.. This is probably a very good example for KISS (Keep It SimpleS). ;)

Cheers, Alan.
 
Top