### Author Topic: High frequency (>40MHz) adjustable gain/offset circuit on op-amp input  (Read 11693 times)

0 Members and 1 Guest are viewing this topic.

#### microbug

• Frequent Contributor
• Posts: 525
• Country:
• Electronics Enthusiast
##### Re: High frequency (>40MHz) adjustable gain/offset circuit on op-amp input
« Reply #25 on: July 25, 2014, 03:29:07 am »
How much would the frequency response of the op-amp be affected by changing the gain? The op-amp I am using is the THS3001 (datasheet here). Digging further into the AD9850 datasheet, I found a formula which I could use for AGC:
x= (pi * Fclock) / Fout
amplitude = sin(x)/x

The results look about right, with Fclock at 1Hz the amplitude is pretty much 1 and at 40MHz it is ~0.82. If the frequency response of the op-amp is not too poorly affected by switching the gain, this could be easily compensated for in software.
« Last Edit: July 25, 2014, 03:32:28 am by microbug »
It's not your beliefs that make you a better person, it's your behaviour. — Greywoolfe  •  microbug.uk (not yet complete)

Just because I have lots of posts, doesn't mean I'm any good at this!

#### David Hess

• Super Contributor
• Posts: 9480
• Country:
• DavidH
##### Re: High frequency (>40MHz) adjustable gain/offset circuit on op-amp input
« Reply #26 on: July 25, 2014, 05:06:22 am »
How much would the frequency response of the op-amp be affected by changing the gain? The op-amp I am using is the THS3001 (datasheet here).
Assuming you stay within the gain-bandwidth product of the operational amplifier, the gain will not change much with frequency but the distortion will rise at both higher frequencies and higher gain.

Are you changing operational amplifiers?  Your schematic shows a THS4631.  Current feedback amplifiers like the THS3001 have some additional issues with variable gain.

Quote
Digging further into the AD9850 datasheet, I found a formula which I could use for AGC:
x= (pi * Fclock) / Fout
amplitude = sin(x)/x

The results look about right, with Fclock at 1Hz the amplitude is pretty much 1 and at 40MHz it is ~0.82. If the frequency response of the op-amp is not too poorly affected by switching the gain, this could be easily compensated for in software.
That is certainly feasible to do.  You could also slightly increase the gain with frequency after the DDS to partially compensate for the sin(x)/x response with a passive network.

I do not know the details of the AD9850 module but its anti-aliasing filter probably also lowers the output level with increasing frequency.

#### rob77

• Super Contributor
• Posts: 1848
• Country:
##### Re: High frequency (>40MHz) adjustable gain/offset circuit on op-amp input
« Reply #27 on: July 25, 2014, 05:20:21 am »
this is (attached) the latest (few days ago) output from my ad9850 DIY FG while doing something. beefed with 20X gained THS3091 or THS4631 (cant remember which one precisely its been too long, i believe its THS3091 its a good opamp for this type) ignore blue channel 2 its the dut output. look at the yellow output... 1st picture averaged, 2nd picture peak detect both at

that looks really good to me
one question.. what regulators are you using to make the power rails for the THS4631 ? are you using the recommended TPS7A4901 & TPS7A3001 or are you using just some generic voltage regulators ? i'm seriously considering to build the output stage for sine with that THS4631.

#### microbug

• Frequent Contributor
• Posts: 525
• Country:
• Electronics Enthusiast
##### Re: High frequency (>40MHz) adjustable gain/offset circuit on op-amp input
« Reply #28 on: July 25, 2014, 05:38:22 am »
@David Hess I am using the THS3001, although I could switch if it will be a problem. I think you may be mixing up people; I have not posted a schematic yet.
It's not your beliefs that make you a better person, it's your behaviour. — Greywoolfe  •  microbug.uk (not yet complete)

Just because I have lots of posts, doesn't mean I'm any good at this!

#### David Hess

• Super Contributor
• Posts: 9480
• Country:
• DavidH
##### Re: High frequency (>40MHz) adjustable gain/offset circuit on op-amp input
« Reply #29 on: July 25, 2014, 06:39:09 am »
@David Hess I am using the THS3001, although I could switch if it will be a problem. I think you may be mixing up people; I have not posted a schematic yet.

I saw the schematic and assumed it was yours.

There are all kinds of ways to implement this design which will work well and have insignificant variation in performance.  I have to say that looking at the results, I am happy to stick with my analog function generators.

#### Mechatrommer

• Super Contributor
• Posts: 8832
• Country:
• reassessing directives...
##### Re: High frequency (>40MHz) adjustable gain/offset circuit on op-amp input
« Reply #30 on: July 25, 2014, 06:46:54 am »
what regulators are you using to make the power rails for the THS4631 ? are you using the recommended TPS7A4901 & TPS7A3001
i'm using my diy bipolar psu nothing fancy just 50Hz transformer, diodes and LM324, i can say very poor performance. using LM317/LM337 voltage regulator should give better psu output whats critical is the decoupling capacitor at the opamp side. i also put bigger capacitor >100uF at the power input, maybe all those did the trick.
if something can select, how cant it be intelligent? if something is intelligent, how cant it exist?

#### microbug

• Frequent Contributor
• Posts: 525
• Country:
• Electronics Enthusiast
##### Re: High frequency (>40MHz) adjustable gain/offset circuit on op-amp input
« Reply #31 on: July 25, 2014, 06:54:57 am »
Will the THS3001 be OK with variable gain or should I switch to some other (non-CFB) op-amp?
It's not your beliefs that make you a better person, it's your behaviour. — Greywoolfe  •  microbug.uk (not yet complete)

Just because I have lots of posts, doesn't mean I'm any good at this!

#### Mechatrommer

• Super Contributor
• Posts: 8832
• Country:
• reassessing directives...
##### Re: High frequency (>40MHz) adjustable gain/offset circuit on op-amp input
« Reply #32 on: July 25, 2014, 07:15:07 am »
if you can find VFB its better but THS3001 should be ok. the only issue i have looking at my record is its higher output impedance 10ohm. you can add 40 ohm to fullfill 50ohm output impedance but not sure how the 10ohm wiggles, if its stable 10ohm then its should be fine. just a note, if you thinking to put trimpot as variable gain, put it in the ground side from feedback. putting it in feedback loop (opamp side) is a definite no no. but even in the ground side i will not advice to put a trimpot there, but i havent tried. and forgot one more important point, dont forget to heatsink the CFB, CFB can run hot in no time, worst it can burn if it has no internal heat protection, i burnt few of them.
if something can select, how cant it be intelligent? if something is intelligent, how cant it exist?

#### microbug

• Frequent Contributor
• Posts: 525
• Country:
• Electronics Enthusiast
##### Re: High frequency (>40MHz) adjustable gain/offset circuit on op-amp input
« Reply #33 on: July 27, 2014, 06:25:11 am »
I have ordered a THS4631 and its two companion voltage regulators. It is the version with the thermal pad for improved heat dissipation.

I have attached a screenshot of one of the eight bits of my gain selection circuit – does it look OK? I went for a latching relay over a reed relay because of the lower power consumption; eight reed relays at 500ohms each draw 80mA.

I have found a 100MHz comparator (AD8611TLV3501 – more suitable, datasheet attached) for the square wave.
« Last Edit: July 27, 2014, 06:55:41 am by microbug »
It's not your beliefs that make you a better person, it's your behaviour. — Greywoolfe  •  microbug.uk (not yet complete)

Just because I have lots of posts, doesn't mean I'm any good at this!

#### microbug

• Frequent Contributor
• Posts: 525
• Country:
• Electronics Enthusiast
##### Re: High frequency (>40MHz) adjustable gain/offset circuit on op-amp input
« Reply #34 on: July 27, 2014, 09:17:26 pm »
On second thoughts, with regards to amplitude control and AGC, I think I will use a fixed gain (75) op-amp circuit. The output of the AD9850 will go into a peak detector feeding into my MCU, which will calculate the appropriate minimum attenuation (0-5.7dB). I will use an 8-bit R-2R attenuator between the AD9850 and the op-amp. This allows for less complex AGC as I don't need to calculate the theoretical output voltage, but rather measure the observed output.

To adapt my current circuit, I just need to add a resistor to ground on pin 3 of the relay (see attached image). I'm concerned about spike protection: I can't put two diodes directly across the coil. I was thinking about doing something like the attached image, but this depends on the spike occurring after the relay has latched back (1-2ms). Other suggestions welcome!
It's not your beliefs that make you a better person, it's your behaviour. — Greywoolfe  •  microbug.uk (not yet complete)

Just because I have lots of posts, doesn't mean I'm any good at this!

#### rob77

• Super Contributor
• Posts: 1848
• Country:
##### Re: High frequency (>40MHz) adjustable gain/offset circuit on op-amp input
« Reply #35 on: July 27, 2014, 09:36:22 pm »
don't forget the DC offset introduced by those AD9850 modules, the higher the frequency, the higher the DC offset as (and lower the signal amplitude).
so a fixed gain amplifier after the module is not the best solution - the op-amp will bounce it's head (300mV DC offset will become >20V with gain of 75).

#### microbug

• Frequent Contributor
• Posts: 525
• Country:
• Electronics Enthusiast
##### Re: High frequency (>40MHz) adjustable gain/offset circuit on op-amp input
« Reply #36 on: July 27, 2014, 09:39:19 pm »
Sorry, I didn't explain all of it:

AD9850 module output -> DC blocking capacitor -> peak detector
AD9850 module output -> DC blocking capacitor -> attenuation network -> DAC offset -> fixed gain amplifier
It's not your beliefs that make you a better person, it's your behaviour. — Greywoolfe  •  microbug.uk (not yet complete)

Just because I have lots of posts, doesn't mean I'm any good at this!

#### rob77

• Super Contributor
• Posts: 1848
• Country:
##### Re: High frequency (>40MHz) adjustable gain/offset circuit on op-amp input
« Reply #37 on: July 27, 2014, 09:45:28 pm »
if ac coupled then it's ok
one fine day i'll finish mine - but i'm considering DC coupling all the way down to the BNC connector. so i need to make some kind of DC offset removal circuit, and probably some kind of AGC as well before the signal enters the output stage.

#### CarlG

• Regular Contributor
• Posts: 153
• Country:
##### Re: High frequency (>40MHz) adjustable gain/offset circuit on op-amp input
« Reply #38 on: July 28, 2014, 05:42:58 am »
Hi, I couldn't find any complete schematic so I'm not sure I get the picture right, but I gather relay pin 4 or 5 is connected to the OPA inverting input. This leads to a large capacitive load on the inverting input, probably causing the OPA to oscillate.

Have you considered using analog switches/muxes instead of relays? With a 1-to-4 mux you could get away with the cap load of the COM port on the inverting input (if you use two stages in series instead of 8 settings with one OPA). I've used this method to achieve programmable gain with CFB OPAs.

I've never used heat sinks on CFB OPA (or any OPA for that matter) and haven't had any problem with that.

#### microbug

• Frequent Contributor
• Posts: 525
• Country:
• Electronics Enthusiast
##### Re: High frequency (>40MHz) adjustable gain/offset circuit on op-amp input
« Reply #39 on: July 28, 2014, 07:37:52 am »
As it currently stands, there are 8 relays which switch in attenuation resistors of 0.1, 0.2, 0.4, 0.8, 1.6, 3.2, 6.4 and 12.8dB. The input is pin 4 on the first relay. The end of this attenuation network (pin 5 on last relay) is fed into the output of the DAC and the inverting input of the [fixed gain] op-amp.

The op-amp I am now going to use is the THS4631, which is a high speed VFB amplifier. The thermal pad is a pretty poor 'heat sink', but it will help get most of the heat into the copper of the PCB.

Looking at the wiki page which lists 74-series multiplexers, they all output a buffered high or low voltage as opposed to allowing the current to actually pass. When I looked at the few analog demultiplexers that are available, they all had large output (drain-source / collector-emitter) impedances which would mess up the attenuation. I think 74AC series logic would be fast enough for the frequencies, however, if there is a chip that would work. I would prefer an IC (or several) to all of these relays because they are £1 each on Farnell!

Sorry about the lack of info! The schematic I am making is pretty convoluted at the moment, so it probably wouldn't make much sense anyway. As a side note, I removed the two diodes in the relay circuits and replaced them with one common-anode dual 5.1V zener across the coil to suppress transients.

EDIT: here is the relay I will probably use. There is no mention of typical capacitance across the contacts, although I would have thought it would be fairly small. At these frequencies, though, it may still present a problem.

EDIT 2: I attached my work-in-progress schematic. The attenuation network at the bottom and most of the output stage is complete (I need to add the peak detector).
« Last Edit: July 28, 2014, 07:46:03 am by microbug »
It's not your beliefs that make you a better person, it's your behaviour. — Greywoolfe  •  microbug.uk (not yet complete)

Just because I have lots of posts, doesn't mean I'm any good at this!

#### rob77

• Super Contributor
• Posts: 1848
• Country:
##### Re: High frequency (>40MHz) adjustable gain/offset circuit on op-amp input
« Reply #40 on: July 28, 2014, 09:05:02 am »
i would suggest to save the PCF8574 by connecting the keypad with a single ADC input. the A6 & A7 ADC inputs got no digital circuitry, so you can't make use of them anyways 7 resistors and single ADC to interface the keypad. don't use the arduino single wire keypad - the author was trying to debounce the keypresses by time delay  (but probably he corrected the code in the meantime).

see the attached schematic and code.

Code: [Select]
char MyGetkey(void) { int av1 = 0, av2 = 0, i; float rv = 4700, rh = 1000, rb = 1000, tolerance = 0.02; // rv,rh,rb - see schematics float v, vc; //measured and calculated voltages char keys[4][4] = {{'1','2','3','A'},{'4','5','6','B'},{'7','8','9','C'},{'E','0','F','D'}}; //keypad layout for (i=0; i<8; i++) av1 += analogRead(KEYPAD_PIN); // average of 8 ADC readings av1 /= 8; delay(5);  //wait 5ms for (i=0; i<8; i++) av2 += analogRead(KEYPAD_PIN); // another average of 8 ADC readings av2 /= 8; if ((av1 == av2) && av1 != 0 ) {  // if the 2 averages match - it means the keypress already "settled"   v = (5.0 / 1023) * av1;   for (int rc=0; rc<4; rc++) {     for (int cc=0; cc<4; cc++) {       vc = (rb / (rv*rc + rh*cc + rb)) * 5.0;       if ( v >= (vc - tolerance) ) {         delay(200);  // delay for repeating keys during long press - can be implemented in the main loop.         return (keys[rc][cc]);       }     }   } } return('\0'); }

#### microbug

• Frequent Contributor
• Posts: 525
• Country:
• Electronics Enthusiast
##### Re: High frequency (&gt;40MHz) adjustable gain/offset circuit on op-amp input
« Reply #41 on: July 28, 2014, 09:06:59 am »
Thanks, I will!

EDIT: I just found my attenuation solution: ADG714  ADG734. 4 SPDT analogue switches, -3dB bandwidth = 160MHz, 2.5ohm typical on-resistance!
EDIT 2: Looks like it'll need powering with ±2.5V for AC signals...
EDIT 3: If you want to follow development, this is going on Hackaday Projects (along with EDA files, etc.). OpenGen – open souce handheld DDS wave gen (Hackaday Projects)
« Last Edit: July 28, 2014, 10:12:28 pm by microbug »
It's not your beliefs that make you a better person, it's your behaviour. — Greywoolfe  •  microbug.uk (not yet complete)

Just because I have lots of posts, doesn't mean I'm any good at this!

Smf