# Make a real world example with a NPN Transistor

I have read a lot about transistors and I still cannot make my last example work. On the internet I see that transistors are primarily used as switches and as amplifiers.

## A) Use transistor as a switch

I want to open and close a circuit. For this example it is a 12 V lamp that I have:

The lamp is on all the time. In order to insert the transistor as a switch I do the following:

Now whenever my digital pin on Arduino is set to HIGH the light turns on.

## B) Use transistor as a amplifier

Here is where I am getting stuck.

I want to amplify the signal coming from my aduio cable that is connected to my phone. I connect my audio cable to my phone like this:

I soldered the tip of the audio cable to one cable and the middle part to another cable. I soldered it like that because when I connect those two cables to a speaker I could hear sound. Anyways when I connect those 2 cables to an oscilloscope this is what I get:

As you can see the voltage varies from about -0.2 volts to 0.1 volts. This is what I have tried to amplify the wave:

The voltage varies between negative and positive therefore I do not know what cable to connect to emitter or collector. I have bough a simple 12V speaker. How can I amplify that wave to make the speaker that I bought play louder? In short I just want to amplify the waves that I read on the oscilloscope. WHen I lower the volume on the phone the waves get smaller in amplitude. How can I increase the size of those waves even more?

• put the lamp between the collector and the +12 V Apr 18, 2020 at 1:20
• Your circuit is a gain-of-one buffer. Not an amplifier. But that circuit does let the low-power earphone-signal drive a high-watts loudspeaker. (Without the transistor, the loudspeaker's small ohms would "short out" the earphone signal.) The gain-of-one buffer stops the shorting-effect...but without actually amplifying the signal. Google: DIY HEADPHONE AMPLIFIER for lots of amplifier circuits. (One-transistor amplifiers work very poorly. Use several-transistor circuits, or an IC chip circuit instead.) Apr 18, 2020 at 2:42

Transistors have a current gain that lets them control a larger current between the collector and emitter than the current fed in to the base,

However it takes about 0.6-0.8V to get current to flow in to the base of the transistor, If you want an on-off switch you "saturate" the transistor, essentially make the current your feeding into the base * the "beta" (current gain) of the transistor larger than what your hoping to switch, this way the transistor is switched on as hard as it can be

To amplify a signal, instead your using this gain to vary how much current is flowing through the load it is switching, in cases like this where the signal amplitude is small, the usual approach is to "bias" the transistor on, by holding the base at about 0.6V with a weak pullup,

The signal you would then couple to the base with a capacitor, so that current from that bias pullup does not flow back in to your phone.

add something like a 100K potentiometer between your transistor base and 12V, and adjust it until the speaker has say 1V across it (this is to get something, later additions can be to improve it into a proper amplifier), feed in your signal to the transistor base with say a 10uF capacitor n series (polarity would be positive to the base), you should now hear the signal amplified, decreasing the resistance of that bias potentiometer will make the signal louder, but will increase how much current is flowing through the speaker when not doing anything

Edit: In your arduino example, I would strongly recommend you use some level of resistance to limit how much current can flow into the base, it should be atleast 440 ohms (5V - 0.6V base voltage) / (10mA max per pin of arduino) = 440 ohms. In reality it would normally be a higher value, as unless you're switching a very large load can saturate the transistor at a much lower base current.

Regarding the amplifier: transistors need some DC-current-flow so the amplifier can vary its internal currents and voltages as the music signal changes.

Thus we will add several capacitors to your circuit, so the source and the load do not upset the transistor's operating point.

1) Get a 3 volt or 6 volt battery. Connect the (-) pin of the battery to the emitter lead of the transistor. Use a NPN transistor such as 2N3904. Install 100 ohm resistor (brown-black-brown-gold/silver) between collector and the (+) of the battery. You may want to install a switch between the battery and the circuit, to not run down the battery.

NOW WE NEED TO BIAS THE TRANSISTOR into a useful operating point.

And once we'd done that, we'll still need to install DC_blocking capacitors on input and output, so our carefully established operating point remains as we designed it.

2) BIASING: this is the Lazy Man bias (works for bipolars and FETs, as long as the transistor is even just sort of OK). Get 2 resistors, of value somewhere between 3,300 ohm and 6,800 ohm. Not really critical. Solder them in series. That midpoint is a key part of the biasing. The resistors don't even have to be the same value, just have them within the range I suggested. So you have two resistors in series, with a midpoint.

3) more BIASING: attach one end of the 2_resistors to the base. Attach the other end of the 2_resistors to the collector.

4) more BIASING: turn on the power. Use a voltmeter if you have one, and measure across the collector_emitter pins. YOu should read about Vbattery/2. About. If less than 1 volt, probably something wrong. If reads the same as the battery, definitely something wrong.

5) So you have the collector_emitter voltage being approximately Vbattery/2. Now for that midpoint of the 2 resistors. Attach a 100uF capacitor from the midpoint to the (-) battery lead. This capacitor gets you higher gain, but its optional. Understanding why this cap is a big step in understanding circuit analysis, so just give it a try.

6) input DC blocking: install another 100uF cap from base to your audio source. have the (+) lead of the cap wired to the base.

7) output DC blocking: install a 470uF or 1,000 uF cap from the collector to the speaker. Wire the (+) lead of cap to the collector.

8) enjoy the music

9) ohhhh you need to wire the RETURN leads of the music source, and of the speaker, to the (-) of battery

Enjoy.

A. To operate a BJT type transistor as a switch, you need to have it operate between cutoff (open circuit) and saturation (closed like a switch). For this you would connect the transistor like shown:

Here Rc would be replaced by your lamp or if your lamp was an led then you’d keep the resistor in series to limit current. Also you’d want to make sure your BJT transistor can handle the current flowing through your lamp. For example if your lamp is 12V with 100 mA then you’d better have a transistor that is rated at 200mA or higher. Rb is a base resistor to allow enough current to drive the transistor on but not damage it. It’s value is determine usually by Rb=( Vin-0.7)/(Ic/beta) where Vin is input voltage like 5V , Ic is collector current and beta is dc current gain found on your transistor Datasheet for a specified collector current. Usually a value of Rb of 4.7k would suffice if you were driving an led or you can use 1k if a larger load.

B. For your amplifier situation. If you simply wanted to amplify your signal from your phone and make it larger to view on your oscilloscope then you could use a low gain common emitter amplifier like shown. If you want a full explanation of a design I recommend finding a pdf version of Floyd’s electronics devices book.

Source: Electronic Devices 9th Ed Floyd

Note: since your signal is about 300mV peak to peak, you don’t need amplify it by much, in the circuit shown I recommend removing the capacitor C2 as this will lower the gain to about 2 to give you 600mV peak to peak.

Now if you really wanted to amplify your signal coming from your phone jack to drive a speaker you wouldn’t be using a single transistor. In actuality you’d use a few transistors, maybe one or two to amplify to reasonable level then use power transistors to drive a speaker. Using a single transistor like you’ve shown wouldn’t give good results. An amplifier like that is called a class A Amplifier like the one I have shown but this can’t drive small resistor loads like a speaker because it would lower the gain to a level so low it wouldn’t be practical. Also even if it was designed to work with a speaker it would be terribly inefficient as too much power would be dissipating one the transistor. Power transistors connected in a class B or AB configuration is a better approach but I’m going to suggest another approach. I recommend using a power amp ic like the lm386 if you plan on driving a small low power speaker 1W Or 0.5W speaker from headphone. This ic is contains several BJTs inside which amplify and can drive a speaker. If you still want to try using transistors to drive a speaker I recommend looking online for schematic of a class ab power amplifier. Hope this helps.

EDIT: Assuming your headphone wires from your phone have right audio , left audio , and ground. You’d connect either left or right audio wire to input of amplifier labels Vin and connect ground wire to ground of circuit ( at bottom of R2 and RE). Also for the amplifier I forgot to mention you can connect a 100k resistor between Vout and ground. You then connect oscilloscope to Vout. As for the capacitors c1 and c3, (remove c2 as I mentioned earlier), c1 of 1uF is sufficient and c3 as 100nF would give good lower corner frequency.

Edit: thanks for reminding me to added sources for the images. I’ve added source or Link to each image.

• Can you please provide links or citations for the graphics you copied into your answer? We want to be sure to give credit to the original creator. Apr 18, 2020 at 13:21
• Going to try your solution shortly thanks for the help. Apr 18, 2020 at 14:23