Logarithmic amps

BrotherJoe

New Member
I've hit a bit of a clue wall and need a nudge. This is a bit more of an electronics question than a PicAxe question, but, it relates..

I've been working on a directional wattmeter to interface with a picaxe.

Initially the circuit was designed to drive analog movements and give forward/reflected *relative* readings.

I thought it'd be far more useful to make something and use the power of the picaxe's ADC to derive actual wattage.

Initially my plan was to scale my input voltage (after my RF detector) by limiting my coupling; but, I'd still have a limited range of input power that I could detect and derive.

Enter the Logarithmic Amp. I know there are specialized IC's to do this (AD8307 and 8310)...but I'm compelled to learn, and compelled to bang my head against this by making one out of discrete components. Additionally this will end up as a

I've started out by modeling a simple LogAmp using an op-amp with non-inverting input to ground, and a single supply. Output and Inverting input are tied with a diode, and I'm feeding my signal in through a 100k resistor.

The problem is; I'm having a hard time wrapping my head around what makes it go, mostly because I can't seem to make it go in SwitcherCAD.
My understanding is that I'll feed it some voltage (most RSSI IC's seem to go from some small V to 2.5V or so) and I'll get the log of that on the output.

Dr Acula initiated this with his excellent op-amp tutorial, so, maybe somebody can discuss the LogAmp as well and give me a hand? I feel like I need to see it work before I can start working on the ADC handling code on the PicAXE.

Thanks,

Joe
 

moxhamj

New Member
gbursseau's link explains the limitations of the log op amp. It is a great circuit for audio compression, but not so good if you want to measure things accurately eg watts.

I wonder about a simple op amp with a switchable gain of 1, 10 and 100 and 1000 (or more). For a few switches a 4016 could be used and for a larger number a 4051. This would give high resolution over a large range of values.
 

BrotherJoe

New Member
gbursseau's link explains the limitations of the log op amp. It is a great circuit for audio compression, but not so good if you want to measure things accurately eg watts.

I wonder about a simple op amp with a switchable gain of 1, 10 and 100 and 1000 (or more). For a few switches a 4016 could be used and for a larger number a 4051. This would give high resolution over a large range of values.


gbursseau did manage to find the one discussion of log amps that I hadn't stumbled upon.

I see them used an awful lot (the 8310 and the 8307 have app notes describing their uses for RF power detection). All of the IC versions have temp compensation and such as well as better performance at the low end of the dynamic range.

At this point I'm more fixated on making one work, rather than seeing it actually be used in my project!

Initially I thought it'd be a way to increase the range of my meter; granted my coupler is not likely to be a good choice for 1kw or something silly. I'm mostly targeting a range of ~1-150W. With a Cp of 22db, would be ~7V, which is too high. 26db is around 4.5V, which is probably safer.

Thanks

Joe
 

BrotherJoe

New Member
Joe,
Did you have Paul Kiciak's (N2PK) "Forward power & return loss (SWR) meter" in mind as a project.
No, but, that is very cool. This one is also very cool!
http://www.mydarc.de/DG8SAQ/NWA.html

How this all started is; we got a lot of snow, consecutively, and it was very cold here. I started to ponder a presentation for local radio club that'd let guys who haven't built anything build something, and, let me show off microcontroller usage. The beauty is that if these guys don't want to fuss with a micro, they can just replace my bits with analog meters (which I'm sure these guys have junqueboxes full of) and be happy!

What I came up with was a directional wattmeter; the coupler is very simple to make, and the detector section is also simple. Most WM's I've seen are driving analog meter movements and give relative measurement, which is fine. it's easy to calibrate an analog movement witha pot inline and have an idea of your foward/reflected power.

What about making the thing go into a PicAXE and compute *actual* forward/reverse power...There are things that do this: N8LP's LP-100, etc.. suddenly you're open to a lot of nifty stuff once you toss the micro in.

The coupler was easy, the code won't be hard, but, I got sidetracked on this when a friend who is an RF engineer says "why don't you use one of these parts; this is what we'd do.". So, I took a long sideways trek as I looked at logarithmic amps, when, really, for my use it's not really a huge win.

I'm not overly concerned with how much power I sapp from the mainline via the coupler, I'm not intending to really be a 1mW to 1W sort of tool, most of the guys in the club will be running 100W. I spose this means I don't need the dynamic range of something like the LP-100, which claims to go like 1W to 3KW.

I suspect the RF engineer is used to applications where you are wanting keep the Cp of the directional coupler very low; me pulling off .5W out of 100W isn't a huge deal, but, him pulling significant % off of mW is... so they need the sensitivity.

I looked at Dr Acula's idea is a clever one to solve the same issue. In the end, I may just go with the simple approach and scale my Cp so as to not overrun the picaxe ADC. Fewer parts, which is probably good for a project of this type.

Though; It'd be neat to get a simulation or a breadboard of a discrete log-amp to work, just because!

Joe
 

BeanieBots

Moderator
You are already on the right track for building your own log-amp.
The reason you have had problems is because for very small inputs the gain approaches infinity and to be stable it really does need dual power rails.
So, build yourself an inverting configuration amplifier with 100k input and diode feedback as you had before but use two diodes back-to-back and use proper dual rails. Also, and this is VERY important, use an op-amp which supports offset-null such as the trusty old 741.
Connect the input to 0v and trim the offset to give 0v on the output. This can be very touchy to do but is essential. I find adding a 10M resistor in parallel with the diodes helps a lot but does reduce accuracy for small input signals. A 10nF cap across the diodes also keeps noise down a lot but obviously reduces response.
So, now you have a log amp. Build another one so that you have two.
Now build an anti-log amp.
It's the same principle but the back-to-back diodes are at the front and the feedback is pure resistance.
Sum the two log-amps into a summing amplifier with a gain of about 10 on each input and feed the output of that into your anti-log amplifier.

Now you have an analog multiplier:D

Unfortunately, diode characteristics change considerably with temperature. To avoid this problem, fix all the diodes close to each other on a heatsink along with another diode. The other diode is used as a temperature sensor by fitting it in the feedback of yet another op-amp with a contact current flowing through it. That is then used to regulate the temparature of the heatsink by controlling the power into a resistor which is also fitted to the heatsink.
The temperature you control it to will depend on your local climate. You want to keep it as cool as possible but with enough degrees above ambient to cope with hot days. In the UK I usually go for about 35 - 40C.
If you have and can control a peltier pump, then regulate at about 20 - 25C.
Good luck.
 

BrotherJoe

New Member
Thanks Beanie; I'm awaiting 10" of snow. I suspect I'll have plenty of time to play with this.

I more or less gave up on using one in my project (more because it doesn't seem wise when there are other; better solutions).

The nag to make and see one work is too great to let it die, though.

Will post results of both projects.

Joe
 

leftyretro

New Member
Designing a decent log amp is not a trival task as I'm sure you will find out. Ham radio projects have been using various diode/op amp trick circuits for a long time. Some work well but usually only over a limited bandwidth or voltage range. Having tried a few simple log circuits over the years I was very happy when I finally took on a Analog Devices AD8307 project a while back. It is a very good log amp, a little pricey but well worth it in performance.

Lefty
 

BrotherJoe

New Member
I'm still working on this. At this point I'm now down to the code, rather than the circuit.

I had the standard fun trying to calculate SWR without the benefit of floating point...

This is where the simulator is really nice. I can do most of this when I'm elsewhere and still test it in the sim. Yay.

On the final design, I'm still leaning towards a LogAmp, and will use the 8307 or 8310, I think. Though, Dr. Acula gave me an idea with the switches, and I'm thinking about switchable attenuation, or, a digital pot on the input to the log amp.

I don't have much need to make the thing sample (off of the mainline, of course) 1KW or more (I'd be happy with up to a couple 100's of watts), I don't want to lose accuracy for that bottom end; say, below 5W.

Some of the initial hurdle is that 8bit ADC isn't enough. I'll probably go to 10bit ADC over 2.5V (which is the output of the AD83xx).

There are, of course, shielding and other issues. Some designs I've seen separate the coupler from the micro.

Thanks All,

Joe
 
Top