Need advices on driving a PNP transistor to switch higher voltage

Hello there,

I have been done with a 8x8 led array. Its a line scan array. Rows are driven by ULN2803 and lines are driven by BC558 BJT PNP transistors. Leds are common (20ma) 3mm ones. The goal was to have the digital logic and leds current supply separate from each other. The circuit works great powering leds with the Arduino +5v main power but if I try powering leds with higher voltages (from a external battery), things starts going weird like all NPN not switching properly. After some research I found that PNP are trickier to switch than NPN for higher voltages than whats used on transistor's base.

My question is: Whats the simplier way to achieve this? After some days trying and researching, the more feasible solution I could find was: PNP Transistor switching

Im willing about using optocouplers instead of two transistors to drive the NPN part, this way I can drive the NPN transistors with base and collector referenced to the same voltage (the led's power supply), trough the optocouplers. It's OK doing so? I mean, it should work ?

What are other alternatives for this, there's something simplier I can do to drive those NPN's?

Apreciate any help or tips.

Salute,
Rodrigo

Two ideas immediately spring to mind:

  1. Use a Darlington Pair Darlington transistor - Wikipedia

  2. use MOSFETs instead of BJTs.

My preference would probably be for option 2. N-Channel Enhancement Mode MOSFETs can be used in pretty much the same way as BJTs, but where a BJT switches by amplifying the current (and so aren't wonderful at low-side switching - high-side is preferred, using PNP), MOSFETs effectively vary the resistance. (BJTs are current controlled, MOSFETs are voltage controlled).

You can get "Logic Level" MOSFETs which switch on normal logic signals instead of requiring high voltages. Also, make sure that they are "Enhancement Mode" and not "Depletion Mode".

Failing that, just switch to PNP and do High Side Switching. Yes, you may well need to add a pull-up resistor to bias the base-collector junction to the right level to switch from a logic level, but that's no biggie.

I can't agree with majenko's advice for your situation. Neither mosfets nor darlington pairs will solve your problem, which is that you are trying to high-side switch a voltage that is more than the +5v Arduino Vcc. You need to level shift the drive to whatever switching device you use. Actually, darlingtons are generally a waste of time because they have a relatively high voltage drop. You're almost always better off using single transistors for low currents (say up to 0.5A) and mosfets above that.

The circuit you linked to (NPN transistor driving a PNP transistor) is suitable, although you can omit R4. You could certainly use opto isolators, although that seems like overkill to me. One other option is to use high side driver IC such as the UDN2981A octal high side driver, which can be driven direct from an Arduino pin just like the ULN2803. The snag with these is that they have a voltage drop of 1.5 to 2 volts (unfortunately, they have darlington output stages), so you need to allow for this when choosing your power supply voltage and/or LED series resistors.

PS - or you could just use a low dropout regulator to bring the supply down to 5v.

Hello majenko and dc42. Sorry for this delay, had to travel to work and no internet there (I swear =( )

I'm not very experienced with transistors and electronics in general. I'm taking some time to understand the transistor's world and all the info are very welcome, thanks for all the tips and information about the matter.
Actually my small led array works just great feeding it with the same +5v used to power Arduino, had just to adjust resistors for the optimal bright. Point is that I’m using this actual circuit to test other conditions, looking forward to projects I may want to execute, like a wider display to be powered into car’s 12v VCC. From the answers you guys provided I have now some residual questions about the subject:

Discovered that PNP BJT’s aren’t good to load voltages higher than the microcontroller’s supply voltage, used for the logic control wired directly into microcontroller. NPN ones are OK in this situation? For the information I could read looks like they are OK for this, so just a confirmation here.

For darlington pairs the above problem of different voltage loads doesn’t happen as it does for BJT’s? By the circuit diagram for darligtons sounds like this isn’t a problem but I’m still not sure about it.

I can’t understand well. I was reading materials about MOSFETS and seems that bipolar transistors are good in the task of amplifying current and MOSFETS are good in the task of amplifying voltages. What confuses me after reading stuff like http://ww1.microchip.com/downloads/en/AppNotes/00898a.pdf and others is that seems that MOSFETS are used to switch high loads so I can just ignore such comparison and fix only on the part datasheet for whatever plan I have? A point I see about MOSFETS is that they are voltage dependent do get saturate and this can be a problem while interfacing it from the logical part of the circuit, more like using intermediate transistors are needed to drive MOSFETS, so well yeah maybe this is a good point about avoiding MOSFETS if possible.

The UDN2981A is a good option but the PNP world is much more restrict than NPN one (I mean, parts are more difficult to find on regular market etc), so I may be using what I can find more easily that’s plain transistors or FETS or whatever easier to buy.

Steeping down the voltage and keeping things simpler sounds really a nice idea, the only problem I see on this is that all circuit possibilities (current), are subjected to the regulator limits.

Salutations !

Rodrigo

DanDare:
Discovered that PNP BJT’s aren’t good to load voltages higher than the microcontroller’s supply voltage, used for the logic control wired directly into microcontroller. NPN ones are OK in this situation?

No, they are no better. NPN bjts and N-channel logic level mosfets are good for low side switches where the low side voltage is Arduino ground. PNP bjts and P-channel logic level mosfets are good for high side switches where the high side voltage is the same as Arduino Vcc. If you want to low-side switch a voltage that is below ground (i.e. negative) or you want to high-side switch a voltage that is above Arduino Vcc, then you need to level-shift the drive to the base of the bjt or the gate of the mosfet. This level shifting is usually done by a bjt.

DanDare:
For darlington pairs the above problem of different voltage loads doesn’t happen as it does for BJT’s?

Exactly the same problem happens with darlingtons. Generally, a single bjt (for switching low currents) or a mosfet (for switching high currents) is a better solution than a darlington. At low currents, you don't need the extra current gain that a darlington provides. At high currents, the higher saturation of a darlington means it dissipates more power and gets hot, whereas a mosfet can ruin much cooler.

DanDare:
I was reading materials about MOSFETS and seems that bipolar transistors are good in the task of amplifying current and MOSFETS are good in the task of amplifying voltages.

A simplification is to say that bjts are current operated, and mosfets are voltage operated.

DanDare:
Steeping down the voltage and keeping things simpler sounds really a nice idea, the only problem I see on this is that all circuit possibilities (current), are subjected to the regulator limits.

Unless you actually need more than 5v to drive your LED array, stepping down the 12v to 5v is the simplest solution. If the required current is no greater than around 200mA then the Arduino's on-board regulator should be adequate. If you need more current, you could use a LM7805 regulator, which can supply 1A if you provide a suitable heatsink. Alternatively, you can buy ready-made switched mode regulators, such as the ones designed to provide 5v 500mA for USB devices from a 12v car supply.

Many thanks for all the explanations.

dc42:
...

No, they are no better. NPN bjts and N-channel logic level mosfets are good for low side switches where the low side voltage is Arduino ground. PNP bjts and P-channel logic level mosfets are good for high side switches where the high side voltage is the same as Arduino Vcc. If you want to low-side switch a voltage that is below ground (i.e. negative) or you want to high-side switch a voltage that is above Arduino Vcc, then you need to level-shift the drive to the base of the bjt or the gate of the mosfet. This level shifting is usually done by a bjt.

So instructions like http://www.ecs.umass.edu/ece/m5/tutorials/tip122_transistor_tutorial.html and Driving high power loads with transistors are wrong ? In the example of the link guy is driving a 12v fan. It can damage the Arduino chip ? I have been done this way since I read that :fearful:

Rodrigo

Ok,

Thinking more about it: "If you want to low-side switch a voltage that is below ground (i.e. negative) ... then you need to level-shift the drive to the base of the bjt" now I understand why http://www.ecs.umass.edu/ece/m5/tutorials/tip122_transistor_tutorial.html and Driving high power loads with transistors just works and are OK: Everything is grounded to same potential. No negative like in "below ground".

Use a ULN2804N or equivelant to drive the PNP pullup transistors. This will allow the pullup bank to operate at a voltage above the logic supply.
Bipolar transistors will need base limit resistors and a emitter-base shunt to ensure full turn off.

ajofscott:
Bipolar transistors will need base limit resistors and a emitter-base shunt to ensure full turn off.

If you mean the PNP transistors that are driven from the NPN transistors, then I agree with you. If you mean the NPN transistors driven from the Arduino that are used to drive the PNP transistors, then no, because the base drive resistor behaves as a shunt when the Arduino pulls the pin low.

The ULN serves as a high side driver for the PNP pullups. Although in the same family there are PNP source drivers in the same convient DIP packages.

DanDare:
Driving high power loads with transistors

If you need to drive voltage on the high side, this is all you need:

I have used this with an Arduino to PWM a TIP42A, and the circuit works great. I have used it to drive high-power RGB LEDs where the color channels are controlled by NPNs, whilst the high-side "dimmer" is run by the schematic above.

@knystol,

Check the dates on topics you respond to. This one has been inactive for nearly 3 years.

Moderator

Out of curiosity, what is the issue with replying to an old thread? I found this thread from google and found that link helpful.

Often the newer reply is asking questions of original posters who are no longer active, or offering suggestions on something that has long been closed out.