A few years ago, I gave a lunch time talk on Mathcad to my hardware engineers. During the talk, one of the engineers mentioned that he starts a Mathcad worksheet when he is reading a part datasheet. While he is reading the datasheet, he works on developing a mathematical model of the part he is reading about. I had to smile – I do exactly the same thing.
We have a new design in progress and this design is using a device known a demodulating logarithmic amplifier (I will use the term log amp here). I have never used this device before, so I wanted to work my way through the datasheet. Our radio-frequency (RF) application is ideal for this type of device. I thought it would be useful to give you a glimpse at how I go about learning how a part works by using a Mathcad mathematical model.
There are two general types of logarithmic amplifiers:
- True Logarithmic Amplifier
When analog designers think of a log amp, they think of these devices. These devices usually use the exponential characteristic of a semiconductor junction in a feedback loop to generate the logarithmic characteristic. While these circuits work well, they do not operate well at the high frequencies at which our designs must operate. The Wikipedia has a nice discussion of these devices and I will not pursue them here further.
- Demodulating logarithmic amplifiers
When an RF engineer thinks of a log amp, they think of these devices. They are known by a number of aliases:
These devices work by summing the outputs from a string of linear amplifiers hooked output to input. Just prior to summing , the amplifier outputs are passed through an envelope detector. This means that the demodulating log amps generate the logarithm of the envelope of the signal.
This post will focus entirely on the demodulating log amp approach. These are really the only option for a high-frequency application.
We have a classic application for a demodulating log amp:
- large dynamic range (45 dB)
- burst detection, which means that we need to detect the presence and measure the strength (level) of the RF signal.
- circuit needs to be able to switch within 1 μsec of the signal hitting our threshold level
For the work in this post, I will be using the Maxim 9933 RF-Detecting Control and RF Detector (yet another alias) as an example to motivate this discussion. This part represents the best of this technology available today. Here is a block diagram of this part.
My focus here is to explain how a chain of linear amplifiers can be used to generate a logarithmic transfer function.
Theory of Operation
Over the years, I have seen sets of amplifiers used to approximate many different functional relationships. For example, I have done a lot of work with a part designed by Javier Sanchez of Maxim (an analog guru) that uses three identical amplifiers to create a piecewise-linear approximation to a hyperbola (I will cover that little gem in a later post). The 9933 uses four amplifiers in series to create a piecewise-linear approximation to a logarithmic characteristic.
Let’s begin by defining what I mean by a logarithmic transfer function. Equation 1 shows the basic mathematical definition.
- VOut is the output voltage from the log amp.
- VIn is the input voltage to the log amp.
- V0 is a gain constant which can be set during device calibration.
- V1 is an input voltage scaling term, which is also set during calibration.
Demodulating Log Amp Block Diagram
I have googled the web and found at least four different approaches to using a series of amplifiers to approximate a logarithmic characteristic. Figure 2 illustrates the basic structure of the demodulating log amplifiers I have examined. All the implementation approaches have variations that make them different in the details, but they all generally function the same way.
Because these amplifiers are intended to detect power and signal envelopes, they include envelope detectors, summers, and low-pass filter. I will not discuss those circuit components because their implementation is straightforward and are covered in many places on the web (envelope detector, analog summer, low-pass filter).
Normally, amplifiers can be modeled as functions that multiply the input signal (current or voltage) by a fixed number. For my modeling here, I am assuming that the amplifiers within the log amp also multiply their input signals by a fixed number (called gain) but that also have output levels that will not exceed a specific voltage, which I call VLimit. Figure 3 illustrates the voltage output versus input transfer function. For this discussion, I will refer to the amplifiers within the log amp as limit amps.
Let’s first try to understand qualitatively how the amplifier works. Assume we are going to apply a steadily increasing voltage from 0 to the point where all the amplifiers are limiting. At very low input voltages, no amplifiers are limiting and the gain of the system is the product of all the amplifier gains. As the input voltage increases, the last amplifier in the chain limits and the total gain of the system now reduces by the gain of that amplifier. As the input voltage continues to increase, the amplifiers limit one by one and the overall system gain reduces. When all the amplifiers have limited the gain of the system is 0. Figure 4 shows how limit amps can be connected in series to create a piecewise-linear approximation to the logarithm function (Equation 1).
In Figure 4, I assume that the first amplifier has a gain of m−1. Generally, engineers would make all the amplifiers identical and simply attenuate the output of the first amplifier. This is an approach used by some logarithmic amplifiers and it makes for a simple derivation of logarithmic performance (shown below). There are other approaches, but I will only cover the system shown in Figure 4.
Modeling in Mathcad
Figure 5 shows the two models that I generated, one recursive and the other iterative. They are very similar and show how easily Mathcad models this type of circuit.
Both models produce the same answer. I did two models just to demonstrate equivalent, but different, approaches. Figure 6 shows the output from the model. It is very similar to the same graph published for the 9933.
While I model the amplifiers as having a “hard” clipping characteristic, real amplifiers have a “softer” clipping characteristic. It turns out that this “softer” clipping actually improves the circuit’s conformance to a logarithm function (I will not go into detail here). It is not often in engineering where the non-ideal characteristics of a component actually make an engineer’s job easier, but this is one case.
As shown in Figure 4, assume each of the amplifiers are labeled from left to right with numbers from 1 to N. Note how all but the first amplifier have gains of m. The first amplifier has a gain of m-1. Figure 4 shows the piecewise-linear approximation. The slope of the characteristic changes each time an amplifier saturates. We can compute the input voltage at which the kth amplifier saturates as shown in Equation 1.
where VT,k is the input threshold voltage at which the kth amplifier saturates.
We can compute the output voltage of the amplifier chain when the kth amplifier is saturated. If m>1, every amplifier after the kth will also be saturated. Equation 3 shows the details of the derivation. During the derivation, I normalize all the voltages to the value of the limit voltage, VLimit. Equation 3 shows the output voltage at the points where the amplifiers just reach VLimit ( VIn = VT,k).
|Define and .|
To show that Equation 3 describes a logarithmic characteristic, we can solve Equation 2 for k and substitute that expression into Equation 3. Equation 4 shows how Equation 2 can be solved for k.
We can substitute Equation 4 into Equation 3 to obtain Equation 5.
Equation 5 shows the input voltages at which each limit amplifier begins to limit. These are the input voltages at which the output voltage will exactly match the logarithm function. Note that the actual characteristic will deviate from that of a logarithm at input voltages that are not at the limit points.
Figure 6 shows a plot of my Mathcad model for the actual characteristic and the logarithmic curve that the limit points pass through.
I thought this was a good example to illustrate how a computer algebra system can be used by an engineer to develop insight into how the parts he is using work. I use this approach all the time. I will try to publish a few more of these analyses if people find them interesting.
(see part 2 for some further details)