# 2n2222a as a Switch

I just connected a very basic transistor as a switch circuit, and was trying to control it with a function generator with a schematic shown below.

simulate this circuit – Schematic created using CircuitLab

I set the function generator output to 1HZ , 5V peak(0-5v) PWM with 50% Duty cycle. However the circuit showed a weird behavior.

When the voltage supply was at 5V, I got an expected output across the Resistor with peak of 5V.

However the behavior started changing when I went above 5V. At 5.9V, the output was something like:

The amplitude of that ringing increases with input voltage. Any ideas on why this might be happening?

My Guess is that, it might be since the upper end of resistor becomes floating when transistor is OFF. If so, why does it show a clean output till 5V.

• This looks like a simulation. I'd check out the exact simulation parameters of the function generator and V1 to make sure there isn't a problem with those. Keep in mind that when the base is higher voltage than the collector, it acts more like a diode than a transister. Jan 14, 2014 at 1:15
• This is an oscilloscope probe shot. Jan 14, 2014 at 1:18
• Isn't the typical 2n2222a/2n3904 npn transistor used as a switch when in common emitter (load on the collector)? Or are you intentionally putting the load on the emitter? Jan 14, 2014 at 2:02

The output high voltage from the emitter of Q1 will never exceed Vb-Vbe. If the maximum base drive voltage is 5V, then the emitter will never be able to rise above approximately 4.3 volts when Q1 is saturated.

If the power supply increases to 5.9 Volts, then the transistor is operating in a linear region and the difference of 5.9-4.3 is dissipated across the CE junction. As soon as the emitter tries to rise up, it clamps off the base and shuts down a little until it reaches equilibrium. If the trace you show is of the actual circuit and not of a simulation, then the ringing is most likely cause by some noise source in the circuit as 1Hz is to slow for it to be a transient response.

The upper end of R1 never floats. It is bound by the Vbe junction of Q1.

If you wish to use a high side driver, then perhaps consider a PNP device. If you want a low side driver, then use an NPN device. this will free R1 from Vbe.

This is a commonly encountered gotcha in the analog world.

Emitter followers are prone to oscillation when there is a stiff (eg. bypassed) base source and some stray inductance kicking around, especially when they have a capacitive load (such as a scope probe). If you look at the arrangement, it's really a Colpitts oscillator!

Your oscillation looks to be relatively low frequency, but it's probably your digital scope lying to you (aliasing), as they are wont to do.

Try a series base resistor of 100 ~ 1000 ohms and I bet the oscillation disappears.