Accountants and MBAs use spreadsheets to play “what if” scenarios with business and financial data. Can you do the same thing with electronic circuits? The answer–perhaps not surprisingly–is yes.
Consider this simple common emitter amplifier (I modeled it in PartSim, if you’d like to open it):
In this particular case, there are several key design parameters. The beta of the transistor (current gain) is 220. The amplifier has an overall voltage gain of about 3 (30/10). I say about, because unless the transistor is ideal, it won’t be quite that. The supply voltage (
Vcc) is 12 volts and I wanted the collector voltage (
VC) to idle at 6V to allow the maximum possible positive and negative swing. I wanted the collector current (
IC) to be 200mA.
Design by Math
So how do you select the values of the resistors? Start with
R3 at the collector. I specified that
Vcc=12 V so
R3 has to drop 6 V. If
VC had been, say, 9 V then the drop would be 12-9 or 3 V. I also said that the collector current,
IC, had to be 0.2 A. Ohms law, then, says
R3= 6/0.2 = 30 ohms.
The gain in this configuration is going to be
R4. So if the gain is 3 and
R3 is 30, it stands to reason that
R4 is 10. The current through
R4 is almost the same as
IC. It is actually related by the alpha of the transistor which is related to the beta. In a transistor like this, the alpha will be nearly 1.0. That means the emitter current will be equal to slightly more than the collector current. For a quick calculation, let’s assume they are the same so the voltage at the emitter is going to be 0.2 times 110 or 2 V.
The voltage at the base, then, needs to be about 0.7 higher or 2.7 V. Because the transistor model is accurate and it models a real transistor, I actually want to set the base voltage to about 0.8 V higher than the emitter and that’s 2.8 V. The base will look like the emitter resistor times beta in ohms (2220 ohms). So the voltage divider of
R2 really has 2200 ohms in parallel with
R2. To get the 12 V knocked down to 2.8 V needs
R1=202 ohms and
R2 to about 64 ohms. That’s it! You now know all the values and PartSim (or another circuit simulation tool) will show that it works. The 1 kHz signal is just for testing and you can see you get roughly a gain of 3 from input to output (along with a 180 degree phase shift):
Spread the Joy
While those steps aren’t very complex, it is tedious. Why not use a spreadsheet (download amp.xlsx from GitHub) to capture the algorithm? Then you can easily make changes and see the results instantly. Here’s an example:
What happens if you change the
IC to 0.1 A? Or the gain to 5? Or the input voltage to 24 V?
There are two cells that you probably won’t change much, so they aren’t under inputs, but they do affect the overall design. The first is the
Vbe drop. For a normal silicon transistor, this should be about 0.6 or 0.7 volts, dependant on temperature. If the real circuit or an accurate simulation shows a different voltage drop between base and emitter (for example, the base is at 2.8 V and the emitter is at 2 V), use that difference (0.8) in the parameter and you’ll get a better result.
The second cell is the current in the voltage divider (
R2). The total current through
R1 is equal to the current through
R2 and the base of the transistor. The base looks (more or less) like the emitter resistor multiplied by the beta of the transistor (which isn’t a very stable parameter). In theory, you could use a lot of different values of the voltage divider resistors to get the correct ratio. The spreadsheet assumes that the total current will be a fixed multiple of the expected base current. If you set this multiplier too low, you’ll get a negative resistance, so you’ll have to raise it.
In general, if you set the total current to, say, four times the base current, then
R2 will get three times the base current through it. A reasonable value is 10 which ensures that changes in the base current won’t affect the divider output very much.
Of course, the spreadsheet won’t pick standard resistance values. That’s fine for simulation, but if you are really going to build, you might want to get close values. For example, to use a 47 ohm collector resistor, you could adjust the quiescent voltage or the collector current. For example, try the example with a collector current of 0.127. That results in values of 47 ohms and 16 ohms, both standard 5% resistors. For the dividers, you can play with the current multiplier. Continuing on the example, setting it to 11 puts the divider in range of a 1.5K resistor and a 510 ohm resistor, both standard values. Remember, device parameters will vary along with part tolerances, so getting close is good enough (and if it isn’t, then you have a problem anyway because of variations due to the manufacturing of the transistor, temperature, and other effects).
Speaking of tolerances, it is easy to look at the effect of tolerance ranges using the spreadsheet. With a little work you could even repeat the math on a single spreadsheet to catch all the end cases.
Solve Your Problem
Many spreadsheet programs can also solve optimization problems. Next time, I’ll show you how you can use that in conjunction with models of your circuit to easily find component values.