Showing results for 
Search instead for 
Did you mean: 

NPN transistor

If you are serious about doing this properly I would suggest that you go back to first principles with Shockley's Diode equation: and the Ebers–Moll model


I am pretty sure that what the guys at PSpice do.


If that doesn't suit, Use GerdW's suggestion of a multi-dimensional Lookup and interpolation.

iTm - Senior Systems Engineer
uses: LABVIEW 2012 SP1 x86 on Windows 7 x64. cFP, cRIO, PXI-RT
0 Kudos
Message 11 of 40

@Jay.kothari wrote:


      I was busy with my semester exams and now that they are done I am resuming work working on my project. I now want to make a .vi simulating the working of a transistor. Its an npn transistor and only simulations is required for now. I want to implement the output characterictics ie. Vce v/s Ic (collector current). The equations are Ic= [Vcc (Supply voltage- Vce)/Rc(approx 1k) ]. We change Vce to get different Ic for a particular value of Ib(base current). The file attached is what I want to achieve. The second file is the biasing diagram


I am stuck on a problem ie I cant find a way to change Vce which depends on Vcc and then change Ic to get the output characteristics. Please help.

it appears your transistor has a gain of 20 thereabout.  Ib x 20 = Ic.  Your base current will control the collector current.  Use a knob control to adjust your Ib, which will control everything else (i.e. Ib increases, Ic increases, Vce decreases etc.)  I may be off the mark from what you are wanting, but your problem doesn't seem that complex.  You just want to demonstrate the characteristic curve of the transistor, correct?

Reese, (former CLAD, future CLD)

Some people call me the Space Cowboy!
Some call me the gangster of love.
Some people call me MoReese!
...I'm right here baby, right here, right here, right here at home
0 Kudos
Message 12 of 40


           The guys at PSPICE have an inbuilt model that has the properties and working of a device say transistor or op amp defined. So they just need to pick the device and place them, wire them accordingly. Whereas my need is to make such a device. I hope you get it. And yeah, of course my working and study material are those two equations that you linked 😄



0 Kudos
Message 13 of 40


                The transistor gain (beta- b) is ranging from 20- 200. Ib is constant when we are plotting Ic v/s Vce. This is what the equations say. However internally Ib does play a role. This is what am facing as a problem.



0 Kudos
Message 14 of 40

A lazy engineer such as myself would look to see if you can make p-spice function calls (via .dll or command) from labview.


Why re-invent the wheel.


I suspect that this isn't in the 'spirit' of your project.


When I was at Uni I had do this problem in excel VBA.


It all boils down to the formulas you use.

Unfortunately in your case (curve tracing of what looks like a BC846) you can't use the simplified formula where you approximate ic=ie.


Do you have to account for Miller capacitance or is it a DC applicaation,





iTm - Senior Systems Engineer
uses: LABVIEW 2012 SP1 x86 on Windows 7 x64. cFP, cRIO, PXI-RT
0 Kudos
Message 15 of 40


           Sir, its my final year project. So I need to make a model 😞 . Also, can you explain me the how to use the .dll or command function. Am not aware of it so.


All the formulas are simple to study. But for implementation I guess, its a bit difficult cause we need to take care of the internal workings also.


Nah, only DC application for now. The basic one ie



0 Kudos
Message 16 of 40

the DLL function is pretty easy to use (do a search in the function pallette, read the help).


Select the DLL (spice.dll), Then Choose the function you want to use from the dropdown.


Labview is surprisingly easy to use in this respect.


If you have to do it from scratch,


I am still not sure how you get around using schockley's equation, Vbe varies with current (by about 10%) and can be a major contributer to your linearity.


My advice,

Step #1:

Figure out your formula,

Step #2:

Put your formula into a  .vi using Beta, Vin and your resistor values as inputs, Vc as the output.

Step #3

Place this VI in nested loops sweeping through your variable paramters (Beta, Bias resistors, Swamping resistor etc)

Step #4

Plot, log, or whatever form you need the data to be output out.



iTm - Senior Systems Engineer
uses: LABVIEW 2012 SP1 x86 on Windows 7 x64. cFP, cRIO, PXI-RT
0 Kudos
Message 17 of 40

I will certainly check the DLL function.


The equations for the 3 regions are

if (Vbe <0.6)

cutoff region

if (Vbe >0.8)

saturation region


if (Vbe = 0.6 or Vbe = 0.7 or Vbe=0.8)
Ib= 0.00002;
Ic= 200*Ib;
Vce= Vcc-Ic*Rc;

active region



Can you also send me a .vi which includes your steps !

0 Kudos
Message 18 of 40

Hi Jay,


given your description you will have a VI with just one case structure with 3 cases and some very simple formulas. It seems to be a nice work to actually learn LabVIEW (see this link).


I want to remark:

- Never compare floats for equality or you will fill other peoples retirement fund...

- Your "3 equations" don't define the whole working range! What happens for Vbe=0.65 or Vbe=0.75?

Best regards,

using LV2011SP1 + LV2017 (+LV2020 sometimes) on Win10+cRIO
0 Kudos
Message 19 of 40

I did not get any link ?


Sir, am increasing the value of Vbe in parts of 0.1 so I dont think I will ever come across 0.65 and 0.75.

Also, now you know what equations am using can you help me ?


0 Kudos
Message 20 of 40