CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Transistor biasing

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Pezimyst



Joined: 20 Aug 2013
Posts: 2

View user's profile Send private message

Transistor biasing
PostPosted: Tue Aug 20, 2013 12:36 pm     Reply with quote

Hello everyone. I have an embarrassing "newbie" hardware question about transistor biasing with a PIC. When using a common NPN transistor as just a "switch" for higher currents than the PIC itself can handle, is there a preferred biasing method? Most examples & tutorials I've seen simply use a base resistor on the PIC outpt pin to drive into saturation, throwing the switch on hard and that's seemingly what I'm after. But I've seen two voltage divider resistors used for biasing, or occasionally some other more elaborate scheme. Is consistency between transistors and ambient (?) temperature drift such a problem that using a base resistor alone is a poor choice? If it has any bearing, my application requires making a few hundred devices which will be exposed to climates 10 - 35 C (50 - 95 F). Maybe a bit higher if out in the sun.
Ttelmah



Joined: 11 Mar 2010
Posts: 19326

View user's profile Send private message

PostPosted: Tue Aug 20, 2013 1:02 pm     Reply with quote

Remember that a PIC pin _always_ wakes up as an input. As such very high impedance.
A twin resistor network, ensures the transistor is 'off' when this happens. Also ensures that if the processor gets into an indeterminate state, the transistor defaults to 'off'.

How high is your current?.
What is the nature of the load (resistive, inductive etc.)?.

If there is any inductance present, then far more important, is what happens when the transistor switches 'off'. Any inductance _will_ result the terminal between the transistor and the load having a rising voltage, that will go up until something stops it. The transistor, or another component breaking down. This is why off the shelf transistor drivers will have trap diodes to control this.

If the current is more than a few hundred mA, then the beta of the transistor, may mean that a darlington is needed.

Best Wishes
temtronic



Joined: 01 Jul 2010
Posts: 9161
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Tue Aug 20, 2013 2:26 pm     Reply with quote

also...

depending on the load, a FET might be a better choice than a 'garden variety' NPN transistor

cheap...cost is always a factor

easy to use....especially the 'logic level' types..

tell us the load and we can better advise.

remember to 'overkill' the design ! Think like sending a satellite up,(now that there's no shuttle !).Spending a few extra pennies now will save you big bucks if( when) ANY units come back for service.

hth
jay
Ttelmah



Joined: 11 Mar 2010
Posts: 19326

View user's profile Send private message

PostPosted: Tue Aug 20, 2013 2:48 pm     Reply with quote

Worth also saying, that the cost of transistor arrays is usually less than the discrete parts.
Chips like the ULN2003D1013TR, give you seven transistors, with the resistors, and clamp diodes all in a SO16 package, and in even quite small quantities are under $0.30. Far cheaper to assemble and layout, than seven discrete transistors, fourteen resistors, and diodes....

Best Wishes
Pezimyst



Joined: 20 Aug 2013
Posts: 2

View user's profile Send private message

PostPosted: Tue Aug 20, 2013 4:35 pm     Reply with quote

Thanks very much for the info. The loads will be mostly small. Less than 100 mA on each pin (and only a few pins). Common things like an array of LEDs, etc. One pin will however have a nearly 1A load on it. But yes, I've been looking at a FET for that one.
asmboy



Joined: 20 Nov 2007
Posts: 2128
Location: albany ny

View user's profile Send private message AIM Address

PostPosted: Tue Aug 20, 2013 6:22 pm     Reply with quote

If using an N chan FET buffer - low side - source=gnd
always put a 20k resistor to ground from the gate pin/pic drive pin.

For an emitter follower NPN transistor pull UP -hi side collector +Vdd-
same deal -20k base to ground.

For a low side transistor switch - emitter ground Vss -
a divider of 2,
10k resistors with base tied to the split, and low side to ground - will work.

5.1k resistors for a LOW Hfe type part.

All 3 of these methods keep the load side OFF during PIC power up.
asmallri



Joined: 12 Aug 2004
Posts: 1634
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Thu Aug 22, 2013 4:14 pm     Reply with quote

Quote:
The loads will be mostly small. Less than 100 mA on each pin (and only a few pins). Common things like an array of LEDs, etc. One pin will however have a nearly 1A load on it. But yes, I've been looking at a FET for that one.


The trick is to ensure you operate the transistor as a switch (saturated) in which case VCE (voltage collector emitter) will be very low - typically rated at around 0.2 volts at 100mA load for a NPN switching transistor such as a 2N3569 giving a transistor power dissipation in this mode of 20mW.

asmboy wrote:

For a low side transistor switch - emitter ground Vss -
a divider of 2,
10k resistors with base tied to the split, and low side to ground - will work.

5.1k resistors for a LOW Hfe type part.


These resistor values are too high for a 100mA load. The DC current gain for a general purpose switching transistor varies between 40 to 300 with the typical being 100. At negligible load a PIC output is almost rail to rail however as the load increases the output voltage will no longer go rail to rail.

Lets look at a conservative example, assume you have a 5 volt PIC and assume the output voltage varies under the load between 0.2 volts (low) and 4.8 volts (high). The VBE voltage for a small silicon switching transistor is 0.7 volts. So when the PIC pin is high, the voltage across the bias resistor (between PIC output and the base of the transistor) will be 4.1 volts. With a worst case hFE of 40, we need as a minimum, 100/40 mA base current = 2.5mA. Therefore the maximum value of the resistor will be 4.1 Volt / 2.5mA = 1.64K. A value of 1.5K would ensure the transistor was saturated.

For the 1A load you have to consider at this current the hFE will be lower, and the VCE (voltage collector emitter) when the transistor is saturated will be higher. With a typical value of 1.1 volts at 1A this means the transistor will be dissipating 1.1 watt.
_________________
Regards, Andrew

http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!!
asmboy



Joined: 20 Nov 2007
Posts: 2128
Location: albany ny

View user's profile Send private message AIM Address

PostPosted: Thu Aug 22, 2013 6:47 pm     Reply with quote

Quote:

With a typical value of 1.1 volts


Actually, transistors with the biasing i showed a couple posts ago,
are pretty OK with currents up to or even a bit above 100 ma

there are plenty of cheap transistors with hfe of several hundred or more - at an Ic of 100 ma+

even a crummy part like the 2n3904 will do 100ma ,
Vce of .3v and hold a Vce of over 150 , for about 3 cents USD each

Check the On-semi datasheet - all you have to do is look.

for higher power only mosfets ONLY should be considered
gpsmikey



Joined: 16 Nov 2010
Posts: 588
Location: Kirkland, WA

View user's profile Send private message

PostPosted: Thu Aug 22, 2013 8:45 pm     Reply with quote

The problem with MOSFETS is trying to drive the buggers all the way on if you decide to run your PIC at 3.3v instead of 5v. Lots of 5v MOSFETS out there, but the 3.3v stuff is a bit tougher. The earlier posts are correct though, you need worst case Hfe considerations to make sure you drive the bipolar transistor into saturation (unless you want extra heating that is).

mikey
_________________
mikey
-- you can't have too many gadgets or too much disk space !
old engineering saying: 1+1 = 3 for sufficiently large values of 1 or small values of 3
asmallri



Joined: 12 Aug 2004
Posts: 1634
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Fri Aug 23, 2013 12:47 am     Reply with quote

[quote="asmboy"]
Quote:


even a crummy part like the 2n3904 will do 100ma ,
Vce of .3v and hold a Vce of over 150 , for about 3 cents USD each

Check the On-semi datasheet - all you have to do is look.


You also need to interpret the data sheet.

http://www.parallax.com/Portals/0/Downloads/docs/prod/oem/2N3904.pdf

It is not "safe" to design with typical hFE values, instead worst case values need to be taken into account. If you look at the collector saturation region graph (Figure 16) you can see that at 100mA IC, a VCE saturation voltage of 0.3 volts is not reached even with a base current of 10mA (effective hFE of 10). Looking at the same graph, a 0.4V VCE at 100mA load is achieved at 5ma base current with this base current being an order of magnitude higher than the base current you proposed. Note these graphs represent typical values not worst case.

Using your values for the bias resistors, gives an approximate IB of 4.1V/10K = 410uA which is not enough to drive the transistor anywhere near saturation at 100mA IC.
_________________
Regards, Andrew

http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!!
Ttelmah



Joined: 11 Mar 2010
Posts: 19326

View user's profile Send private message

PostPosted: Fri Aug 23, 2013 1:42 am     Reply with quote

The 'always assume the worst' lesson, is one that everyone here who designs anything, _will_ have had to learn.

It is so easy to have a prototype that apparently works fine, and then find that production units have chips/transistors/capacitors etc., that are closer to the 'worse case'. This is true with things like watchdog timings, brownout voltages, input switching levels, tolerances everywhere.

Listen to Asmalllri's comment on this, and make sure the design covers both ends of quoted specifications.

Best Wishes
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group