Back to : BJT Transistor Spice Mode | Home

excel

http://www.analogservices.com/excel.htm

Introduction Although SPICE models of integrated circuits are often supplied by vendors, models for discrete components can be difficult to get. Since SPICE uses roughly 40 different parameters to describe a BJT, generating a model seems a daunting task. However, if the BJT will be used only in its forward active region, then its data sheet often contains enough information to create an useful model. The rest of the parameters aren't needed and can be left at SPICE default values. The Excel [1] Spreadsheet provided here streamlines the process of converting BJT data sheet information. Click here to download it as a .zip file. The static SPICE parameters found are

IS -- Saturation Current NF -- Forward Emission Coefficient BF -- Max. Beta NE -- Leakage Emission Coefficient ISE -- Leakage Saturation Current IKF -- Upper Current Corner

The dynamic SPICE parameters found are

MJE -- Base-Emitter Junction Grading Coefficient CJE -- Zero-Bias Base-Emitter Depletion Capacitance VJE--Base-Emitter Built-In Potential MJC -- Base-Collector Junction Grading Coefficient CJC -- Zero-Bias Base-Collector Depletion Capacitance VJC -- Base-Collector Built-In Potential TF -- Ideal Forward Transit Time

In addition to finding the parameters, the spreadsheet also creates a text file of a SPICE .MODEL statement that incorporates the parameters. The remainder of this note explains how to use the spreadsheet. An example using a 2N5190 is given. An appendix is also included to present the theory behind the spreadsheet. Graphical techniques to find at least the static SPICE parameters have been suggested or demonstrated in [2] and [3]. However, by using the Excel Solver feature and a least squares fit to several values of (HFE, Ic), you get better results. To use the technique you need a BJT data sheet with at least the following information: 1. A graph of HFE versus IC (collector current). 2. A graph of VBE versus IC in the forward active region. 3. A graph of Ccb and Ceb versus reverse junction voltages. Fortunately, these are often provided in data sheets. If you know the value of the Early voltage (SPICE parameter VAF) this is also helpful. It can be found from a plot of IC versus VCE or from a known value of HOE (small signal output resistance) at a given IC.

1 of 10

07/06/2010 8:01 PM

excel

http://www.analogservices.com/excel.htm

Your downloaded file should be called "BJT.XLS" and should contain 3 sheets. The first is used to fit the HFE versus collector current, and is used to find IS, NF, BF, NE, ISE, and IKF. The second fits Ceb versus emitter-base reverse voltage, and is used to find MJE, CJE, and VJE. The third fits Cob versus collector-base reverse voltage, and is used to find MJC, CJC, and VJC. Note that Ceb(0) (zero bias) = CJE and Ccb(0) = CJC. Fitting HFE To fit HFE data use Sheet 1. An example of the use of sheet 1 is given in figure 1. The values you need to enter are at A8 through D8, B13 through C13, A16 through F16, and A19 through F19. Seed values are also needed at J8 through K8, L10, and M8. Excel Solver varies J8 through K8, L10, and M8; to minimize the quantity at H34. The L10 value is entered as nanoamp and scaled to amps in L8. If you haven't used Solver, read the information that comes with Excel.

Figure 1 -- Example Sheet To Fit Beta Variation with Collector Current Initially, you can leave the seed values at J8 through K8, L10, and M8 as they are. Then perform the following step-by-step procedure for fitting HFE versus IC.

2 of 10

07/06/2010 8:01 PM

excel

http://www.analogservices.com/excel.htm

STEP 1: The first step is to select two pairs of values of VBE and IC from the graph of VBE versus IC. The two that you pick should be in a region of low IC (low collector current). Usually, HFE is increasing with IC at these values of collector current. The VCE at which the graph applies must be high enough that the transistor is not in saturation (not "ON"). For the 2N5190 there is a graph of VBE versus IC at VCE = 2 volt. From the graph choose (IC,VBE) = (0.005 amp, 0.5 volt) and (IC,VBE) = (0.02 amp, 0.555 volt). The first pair is entered at B8, B13; the second pair at C8, C13. STEP 2: Enter the VCE (2 volt) at A8. STEP 3: Enter the Early Voltage (VAF) at D8. The BJT data sheet often will not have this. Reference [2] states that it will usually be between 50 and 200 volt. If the data sheet has HOE versus IC, then choose a point on this curve and calculate the Early Voltage as VAF = ICX/HOE, where ICX = IC at the chosen point, etc.. Otherwise, if no data is available, set VAF (at cell D8) to 100. The spreadsheet will now have calculated parameters IS and NF. STEP 4: Now pick several pairs of HFE and IC from the graph of HFE versus IC. These should surround the collector current that you expect to use. (The collector current doesn't have to have a low value, like it did in STEP 1.) Put them into A16-F16 and A19-F19. You don't need to use 6 pairs of points. You can probably figure out how to modify the spreadsheet to use fewer of them. STEP 5: Invoke Solver. It should adjust the numbers at J8, K8, L10, and M8; and minimize cell H34. The values in row 31 ("Calculated Beta Values") should be quite close to what you have in row 16 ("Entered Beta Values"). If row 31 isn't very close to row 16, then maybe you've bumped up against one of the constraints. The quantities at J8, K8, L10, and M8 all have constraints associated with them. If you feel that a constraint is incorrect for the transistor you're trying to model or if Solver always seems to bump up against one of the constraints, you might try changing it. If one or more of the values J8, K8, L10, or M8 is not changing during the minimization of H34, this is often a sign of a scaling problem. (Or an ill-conditioned problem if you are a mathematical type.) Solver thinks that it has already reduced the error in the unchanging cell to an acceptable level. This can sometimes be fixed by having Solver adjust a different cell that is a scaled version of the desired one. Once you feel you have found a minimum value for cell H34, you should probably change a few of the seed values in J8, K8, etc. to see if Solver is able to find a smaller minimum at H34. Unfortunately, Solver will sometimes converge on a local rather than a global minimum. You probably won't be able to get a perfect fit. Keep in mind that if your HFE is off by 10% this is still far better than the manufacturing variation in the transistor. Checking the Example HFE Fit

3 of 10

07/06/2010 8:01 PM

excel

http://www.analogservices.com/excel.htm

Using the values of IS, NF, BF, NE, ISE, and IKE found in the example, and the entered value of VAF, a PSPICE [4] simulation was run. VCE is stepped from 0 to 10 volt in with increment = 1 volt. The netlist is shown in figure 2. Iin, the base current, can also be stepped by changing its value and re-running the simulation (not very elegant).

.bjt1 * check on spreadsheet values found for 2N5190 transistor. Iin 0 1 50e-3 q1 2 1 0 npn5190 v1 3 0 0 v2 3 2 0 .model npn5190 npn(is=1.65e-8 vaf=120 bf=253 ne=3 ise=5.02e-8 +ikf=0.403 nf=1.53) .dc v1 0 10 1 .print dc i(v2) .end

Figure 2 -- SPICE Netlist to Check BETA If this is done, we get the graph of figure 3. The data sheet values of HFE have been included for VCE = 2 volt.

Figure 3 -- HFE Variation With Collector Current In this instance, there obviously shouldn't be much difference between the simulation and the data sheet, since the spreadsheet uses the same, or nearly the same, equations as SPICE. Fitting Ceb The SPICE parameters found so far are static (DC) parameters. Dynamic parameters will be found

4 of 10

07/06/2010 8:01 PM

excel

http://www.analogservices.com/excel.htm

next. For the emitter these are MJE, VJE, and CJE. To find these parameters, use Sheet 2. You need a graph of Ceb versus reverse-bias VBE. Junction capacitance will typically decrease as reverse voltage increases. In the forward active region, the base-emitter junction will not be reverse-biased. However, the SPICE model expression for the forward-biased base-emitter junction includes a term containing MJE, VJE, and CJE. Therefore, it is helpful to have these. An example of the use of Sheet 2 for the 2N5190 transistor is shown in figure 4.

Figure 4 -- Example Determination of Emitter Dynamic Parameters Voltages are entered into row 5. The corresponding capacitances are entered into row 7. Seed values must also be entered into A17 through C17. Values of Ceb, based on the SPICE model, are calculated in row 10. Differences between calculated Ceb and data sheet Ceb appear in row 13. Cell E17 contains the sum of the squares of the Ceb differences. Excel Solver is used to minimize cell E17 by adjusting cells A17 through C17. The step-by-step procedure follows. STEP 1: Select several pairs of capacitance and voltage from the curve of Ceb versus reverse VBE. Enter the voltage from each pair into row 5; the capacitance into row 7. STEP 2: If seed values are not already present in A17 through C17, they must be added. Figure 4 presents some guidance on seed values. STEP 3: Invoke Solver to minimize cell E17. The calculated values of Ceb in row 10 should become approximately equal to the entered values in row 7. If they don't, then the seed values in A17 through C17 may have to be changed. Or the constraints on values in A17 through C17 may need to be adjusted. All of the same advice given in step 5 of the previous section on HFE Fitting applies. Notice that the spreadsheet finds CJE in picofarads. This must be changed to farads for SPICE or else units of "p" must be used.

5 of 10

07/06/2010 8:01 PM

excel

http://www.analogservices.com/excel.htm

Fitting Ccb To fit Ccb use Sheet 3. The first 17 rows of sheet 3 are the collector counterparts of the emitter values from sheet 2. Sheet 3 is used in the same way as sheet 2. An example sheet 3 for the 2N5190 transistor is shown in figure 5.

Figure 5 -- Example Determination of Collector Dynamic Parameters Notice that the spreadsheet finds CJC in picofarads. This must be changed to farads for SPICE or else units of "p" must be used. Getting TF TF, the SPICE Ideal Forward Transit Time parameter is found in row 20 of sheet 3. It doesn't use Solver. Instead, there is simply an analytical relationship between the transistor fT (unity-current-gain frequency) and TF. To find TF, you have to have a value for fT from the data sheet. fT is entered into cell A20. TF is calculated and put into cell C20. A complete sheet 3, that includes this information added to that of figure 5 is given in figure 6.

6 of 10

07/06/2010 8:01 PM

excel

http://www.analogservices.com/excel.htm

Figure 6 -- Example Determination of Collector Dynamic Parameters and TF Writing a SPICE .MODEL Statement Once all parameters have been determined using Sheets 1, 2, and 3; you can automatically create a file that will contain a SPICE .MODEL statement incorporating the parameters you've found. You do this by selecting (clicking ON) cell A1 in Sheet 1. If A1 is already selected, then move off of it and then back on to write the file. The file will be called "bjt.mod" and will be located in the same directory as the "Save As" directory that you use for bjt.xls. An example of the file using the 2N5190 transistor is shown in figure 7.

.model my_transistor my_polarity(VAF=120 IS=1.65347684366753E-08 +NF=1.5259274470941 BF=252.65154358247 NE=3 +ISE=5.02493455231571E-08 IKF=0.402925734377646 MJE=0.455657922718413 +CJE=326.725285178431p VJE=0.4 MJC=0.444745500406268 +CJC=311.946201352123p VJC=0.639621801953999 TF=7.95775387622191E-08)

Figure 7 -- Example BJT.MOD File You will have to change "my_transistor" to the correct model name and "my_polarity" to either NPN or PNP. Polarity To use the spreadsheet assume that the transistor is NPN, regardless of what it actually is. All of the SPICE parameter values end up being positive and SPICE changes signs appropriately when it runs. Some PNP transistor data sheets may have negative values. For example, there could be a graph of negative IC values versus negative values of VBE; or a graph of HFE variation versus negative values of IC. Although this is technically correct, it gets in the way of a uniform method of calculating parameters. If you come across one of these data sheets, just remove the minus signs when entering spreadsheet data. References

7 of 10

07/06/2010 8:01 PM

excel

http://www.analogservices.com/excel.htm

1. 2.

EXCEL Spreadsheet, Microsoft Corporation. PreSpice User's Guide, Intusoft, San Pedro, CA, chapter 6, 1991.

3. Antognetti, P., and Massobrio, G., eds., Semiconductor Device Modeling with SPICE, McGraw-Hill, 1988. 4. PSPICE, Version 8, Microsim Corp.

Appendix -- Theory Static Parameters The Gummel-Poon model used by SPICE is concerned primarily with getting the transistor HFE (forward current gain) to vary correctly with collector current. Generally HFE starts out low at low collector current, increases to a maximum, and then drops back down as collector current increases. The model divides the collector current into three regions: low, mid, and high-current. It assumes that HFE is increasing in the low-current region, is constant in the mid-current region, and is dropping in the high-current region. The model parameters essentially define the breakpoints for this curve and its value at mid-current. The model assumes the collector current in the forward active region (reverse bias terms are neglected) to be given by

eq (1) where Vt = 0.026 volt, NF = SPICE forward emission coefficient, Is = IS = SPICE Saturation Current, and QB is given by

eq (2) Q1 is a depletion layer stored charge factor and Q2 is the excess majority carrier base charge factor. Q1, in turn, is given by

eq (3) where VAF = SPICE Early voltage. In the spreadsheet, this is approximated by

eq (4) where it is assumed that VBC = -VCE.

8 of 10

07/06/2010 8:01 PM

excel

http://www.analogservices.com/excel.htm

Q2 is given by

eq (5) where IKF = SPICE parameter = breakpoint between mid- and high-current regions. This can be approximated by

eq (6) We see that IC is related to VBE through equations 1, 2, and 6. In equation 1, as VBE increases, IC also increases initially. Then when Q2 becomes sufficiently large, further increase in VBE causes an increase in QB, which causes IC to drop. The base current, IB, is given by

eq (7) where BF = SPICE maximum forward Beta = HFE in mid-current region, ISE and NE are remaining SPICE parameters defined above. This is approximately

eq (8) Combining equations 1, 2, and 6 yields

eq (9) Equations 8 and 9 have the common factor VBE. If VBE is eliminated between the two, the result is one relationship between IC and IB. But IB can be eliminated through IB = IC/HFE. The result is an equation that contains the HFE dependence on IC. In the spreadsheet the eliminations of VBE and IB are carried out indirectly. In STEP 1 of the procedure, the two pairs of VBE and IC are chosen at low IC where QB is approximately equal to Q1. Thus, equation 1 is in effect with QB = Q1. This allows an analytical determination of NF, since

eq (10)

9 of 10

07/06/2010 8:01 PM

excel

http://www.analogservices.com/excel.htm

In STEPS 2 and 3, Q1 is determined analytically from the entered values of VCE and VAF. One of the pairs of (VBE, IC) is then used with the known Q1 to calculate IS, using equation 1. In STEP 5 Solver adjusts the values of BF, NE, ISE, and IKF to minimize the squares of the differences between the known HFE (from data sheet) and HFE calculated through equations 8 and 9. Dynamic Parameters The equations for dynamic parameters with junctions reverse-biased are

The small contributions from forward bias terms are omitted. VBE and VBC are of opposite sign to VJE and VJC, so that CBE and CBC drop with increasing magnitude of reverse voltage. Sheet 2 is used to choose the best fit CJE, MJE, and VJE. Sheet 3 is used to choose the best fit CJC, MJC, and VJC. The equation relating TF to fT is approximately

In sheet 3 TF is calculated from the data sheet value of fT. For more information on how Analog Services, Inc. can help solve your circuit/system problems, call or e-mail us today.

VOICE 612-927-7112 home

FAX 612-929-7503

E-Mail: [email protected]

10 of 10

07/06/2010 8:01 PM