| / \ |\ / \ ---|+\ / \ | |--- /_+___-_\ ---|-/ | | |/
It is common in a physics lab to have devices with mismatched logic levels (voltage constraints). In my case, this is often some kind of signal generator producing a clock signal at a voltage (2V) that is too low for the trigger input (5V) of some other device.
You could of course buy a level shifter or small amplifier, but then you have to fill out some forms, wait for delivery, and not have electronics fun. So instead how can we make one out of teaching lab equipment?
If all you want to do is step down the voltage, you could try a simple voltage divider, but the output voltage will depend on the load. Trigger inputs are usually well defined high impedance loads, so a voltage divider would work (with some tweaking).
Our goal here is to use whatever is on hand to build a quick amp on a 5/12V power source. I'll first go through the design I used, before discussing generalisations and other configurations1
Table of Contents
My common-emitter amplifier
I wanted to take a 2V square wave signal to something with minimum below 0.7V and maximum above 3.3V. Phase changes did not matter. I first looked for an op-amp (see below), but couldn't find one. The first transistor I found was a BC247 NPN transisitor. I asked my AI friend2 what sort of amplifier I should build and it said a common-emitter amplifier with emitter degeneration. This sounds a little complex, but the principles are pretty easy to grok, and there are nice circuit diagrams on wikipedia. Note that this design is inverting (180° phase shift between output and input).
The AI became useless (and dangerous!) after this point, unless I gave highly informed questions. I recommend you use the AI to direct you to the right search terms, and never directly solder up a circuit design it gives you without some independent research.
The common-emitter amplifier (CEA) is so-named because the Emitter pin of the transistor is common to both the input and output (it is connected to ground across a resistor Re
), whereas the Base terminal is used for input (voltage set via a voltage divider) and the Collector terminal is used for output (with gain set by a resistor Rc
). I'll go through that again, but just note we need these components (see pic for reference):
- A 5V power supply,
- An NPN transistor,
- Resistors:
R1
,R2
,Re
andRc
, with values defined below.
This is a great circuit diagram for reference. Why the voltage divider? We need to set the Base voltage at the 'Base-Emitter On Voltage' [VBE(on)] value (~0.55V from the manual), i.e. the built-in voltage, which is
V₀ = kT/q ln(NaNd/nᵢ²)
For Na
(Nd
) concentration of acceptor (donor) atoms, and nᵢ
the intrinsic carrier concentration. We thus need this voltage to turn the transistor 'on' (otherwise the output would always be at the supply voltage), but too high and we'd get nonlinear amplification, which might blow the transistor.
The other two resistors set the gain in the circuit, with Re
serving to improve gain stability and reduce distortion. For a 5V source, the output (v
) for a given input signal (u
) is
v(t) = (5 V) − u(t) Rc / Re
i.e. a gain of Rc
/Re
. I find it helpful to think of the Base pin as a valve control, with main flow along the Collector-Emitter path. Small adjustments to the Base voltage cause large changes in this main flow, which we measure as a potential difference at the Collector. If we were to output at the Emitter, this would be called an emitter follower or common collector configuration, with current instead of voltage gain. In the present analogy, instead of measuring the potential (pressure) at the collector, we are measuring the flow in the 'output pipe' of the emitter.
So how do we choose our resistors?
- Choose current through collector:
Ic = 1mA
is reasonable - Choose
Vc
(potential at Collector) of 2.5V, i.e. leave ourselves maximum available swing.- Therefore voltage across
Rc
= 5V - 2.5V = 2.5V Rc
= 2.5V/1mA = 2.5kΩ
- Therefore voltage across
- For 2.5 gain: 2.5 = 2.5kΩ/
Re
⇒Re
= 1kΩ - At
Re
= 1kΩ withIe
≈ 1mA:Ve
= 1mA × 1kΩ = 1V- Need
Vb
=Ve
+VBE
= 1V + 0.55V = 1.55V
- Design voltage divider (
R1
,R2
) for 1.55V:- Choose current through divider (say 10×
Ib
, best practise) Ib
=Ic
/β
≈ 1mA/100 = 10µA- So divider current = 100µA
R2
= 1.55V / 100µA = 15.5kΩR1
= (5V-1.55V) / 100µA = 34.5kΩ
- Choose current through divider (say 10×
So we have:
Rc
≈ 2.4 kΩRe
= 1 kΩR1
≈ 33 kΩR2
≈ 15 kΩ
I ended up using
Rc
= 3.1 kΩRe
= 0.4 kΩR1
= 10 kΩR2
= 4.4 kΩ
R1
and R2
are at the same ratio (just what I had on hand), but I had to up the gain to get the required amplification to trigger my setup.
A bit more about amplifiers
So obviously my design above was inverting, what if we needed non-inverting amplification? One option would be to duplicate the amplifier (with half the gain each, if you like). Alternatively we could use an (inverting) op-amp, but then we'd probably not use the common-emitter configuration.
We can also loop the output of the amplifier back into the input with opposite phase i.e. subtracting from the input. This reduces the gain, however cancels any feedback, making the response of the amplifier essentially irrelevant, improving bandwidth, reducing distortion etc. Often op-amps are used in this way (see below).
In case you're working with ac signals, you might want to know about the bandwidth of these amplifiers. The frequency response can be understood as limited by the capacitance in the circuit, largely as a group or RC networks. You might think we have negligible capacitance in our circuit, but due to the Miller effect, the effective input capacitance gets multiplied by (1+A
) where A
is the amplifier gain. Thus there's usually a tradeoff between gain and bandwidth, especially in simple amps with direct capacitive coupling from input to output (like our amp above).
Other useful designs
MOSFET equivalent circuit
If you have a MOSFET instead of an NPN transistor, you could use the equivalent common-source amplifier configuration. The MOSFET amp will have a much higher input impedance, so is more useful for RF applications. I'm not knowledgeable enough about FET electronics to know if this circuit would easily work for a ~dc application.
MOSFET Level Shifter
FET translators/level shifting devices are designed to easily solve common translation issues, though you do need a voltage supply at each level. A MOSFET level shifter has advantages in that it has no consumption when idle, it is non-inverting, and is bidirectional.
Non-inverting Op-Amp config
If you have an op-amp, you're lucky! Perhaps the easiest 'custom' circuit for this application. Wire the signal into the non-inverting port, connect the inverting pin to ground through a resistor Rg
, and loop the output back to the inverting input through a resistor Rf.
The gain is then 1 + (Rf/Rg)
. You may need some extra room on the voltage supply (above 5V) to get a full 5V swing, or use a rail-to-rail op-amp.
If you want to shift the DC offset (+ or -), you can use a voltage divider with the midpoint on the inverting input.
Comparator
A comparator is designed to output either a high or low voltage based on two input voltages. You set a reference voltage, e.g. 1V, and if the input is above this the output will go to the positive rail (e.g. 5V supply), else ground (0V). Obviously this will only work for a square wave/digital signal. You can buy a simple comparator like a LM311, or construct one out of an op-amp (that old chestnut).
Essentially wire the op-amp in open-loop (no feedback) with the signal on the non-inverting input, set the reference voltage (switching point) with a voltage divider on the inverting input. Simples! If you're happy with a ~0.7V switching point, you can of course use just a simple NPN transistor, or use a pair of transistors as a differential pair to set a more precise switching point (compare the voltages at the two bases).
Outstanding Questions
- How could we make a fast electrical gating device? Basically a fancy
OR
gate with a TTL input. - How could we gate as above, but output the different gates to different output lines?
- How would we make a fast, high performance RF switch? Similar to above.
- How do you make a gated AOM driver?
References
-
I would like to note that I profess no expertise here at all: I have no formal training in electronics, and have been reading about amps for about two days. ↩
-
Claude 3.5 via openrouter and aider. ↩