High frequency (>40MHz) adjustable gain/offset circuit on op-amp input - Page 1
Forum section: electronics / projects

author: microbug
author_rank: Frequent Contributor
timestamp: July 22, 2014, 09:10:57 pm
content: I am designing a DDS (max 42.5MHz – thanks DJT) based on an AD9850 module. This module outputs a 0.5V pk-pk sine wave, which I wish to amplify, ideally to a level selectable by the user. I have a very high speed precision op-amp which is running on +-13V.Originally I was thinking of using two pots (one for offset and one for amplitude). IDK if this would work at all, but if I could I would prefer multi-turn wirewound pots for fine control. This would be ideal if it works, however I am conscious that a 5 or 10 turn pot at 42.5MHz is probably a very high impedance (please correct me if I'm wrong) inductor.My questions: will it work with a 5 turn wirewound pot (or a crusty one turn pot)?If not, I suppose I will have to use ganged switches or something to choose between 1.8V/3.3V/5V/10V and AC/DC.EDIT: Actually, this whole thing is controlled by a micro so I could put in several relays and switch in the gain resistors / DC blocking cap.EDIT 2: If one can buy a high bandwidth digipot, maybe that could be a solution.EDIT 3: What about a 74HC4051? Only just found it when googling...

author: retrolefty
author_rank: Super Contributor
timestamp: July 22, 2014, 09:32:01 pm
content: Well in professional RF equipment this often running the output amp at full fixed gain and using a programmable 50 ohm attenuator module to adjust the user output in fixed dbm steps at the operating range and resolution desired Mini-Circuits is one firm that makes such modules.That is probably a too expensive a solution for your project? Keep in mind that in RF one deals is output power, rather then voltage gain, assuming the signal is wired/connected to a 'matched' 50 ohm load.

author: fcb
author_rank: Super Contributor
timestamp: July 22, 2014, 10:15:53 pm
content: I would probably build an attenuator with reed relays, the leakage through a 4051 would be significant at those frequencies (although it might not matter in your design).Hittite Semi make some very nice digital attenuators (e.g. HMC472), although they maybe overkill (the 472 goes from DC to 3.8GHz), Digikey also stock them.I'd tackle the DC offset with a 12 bit DAC.

author: microbug
author_rank: Frequent Contributor
timestamp: July 23, 2014, 06:09:38 am
content: That sounds good. The HMC472 looks nice, although VQFN will be a pain! I'll use a stencil w. solder paste and hot air.If I need more than 64 steps (I'm thinking about this) I could make an 8-bit attenuator with reed relays as fcb suggested.Also, I foundthiswhich suggests a multiplying DAC. If there is a multiplying DAC with a high enough bandwidth, maybe that could be a solution?A DAC is a good idea for the offset.

author: David Hess
author_rank: Super Contributor
timestamp: July 23, 2014, 10:47:16 am
content: From the data sheet it looks like fine output level control over more than a 6 dB range can be achieved with the AD9850 by driving Rset (pin 12) with a current instead of using a resistor to ground.Since the AD9850 output is already a current, I would use diode or transistor current switching to multiplex the output for different output levels. How much output range do you need?

author: microbug
author_rank: Frequent Contributor
timestamp: July 23, 2014, 12:55:51 pm
content: My voltage rails are designed for +-10V max (max +-10V offset and max +-10V amplitude, though not both at once). I'm not exactly sure what you mean though...EDIT: Actually, I'll probably only have a positive offset...

author: David Hess
author_rank: Super Contributor
timestamp: July 23, 2014, 01:36:20 pm
content: Quote from: microbug on July 23, 2014, 12:55:51 pmI mean over how much range do you want to adjust the output level?Typical analog function generators can adjust their output from zero to full scale but the better ones also include one or more 10 dB and/or 20 dB attenuation steps for finer control at low output levels.Also keep in mind that in a simple (*) design, the maximum levels of the output amplifier includes the offset so a +/- 10 volt output would only allow a +/- 5 volt AC signal with up to +/- 5 volts of offset. Combining a +/- 10 volt AC signal with +/- 10 volts of offset would require an output stage capable of +/- 20 volts. That is not trivial to do at high frequencies which explains why high frequency function generators support lower maximum output levels.Do not forget the output termination. With a 50 ohm source termination, the output voltage will be cut in half when operating in a 50 ohm environment so a simple +/- 10 volt output stage actually becomes +/- 5 volts maximum combined signal and offset.(*) Check out the design of the Tektronix FG504 for an example of adding the offset after the output amplifier and attenuation. It is actually pretty easy to do if the DC offset is added in the form of a current directly into the output after the source termination.

author: microbug
author_rank: Frequent Contributor
timestamp: July 23, 2014, 08:10:51 pm
content: I don't have easy access to the AD9850's Rset pin as the chip is in a module. For this reason, I will use a fixed gain op-amp. I will have the output of the AD9850 going to a r2r (relay controlled) 8-bit attenuator, through a series DC-blocking cap and then, joining the output of a DAC, going into the op-amp.Will this cause any problems? Schematic en-route...EDIT: it would be easier to vary the op-amp gain than to create an attenuator network; I'll do that (again with relays).

author: retrolefty
author_rank: Super Contributor
timestamp: July 23, 2014, 08:20:18 pm
content: Quote from: microbug on July 23, 2014, 08:10:51 pmThe main problem I see remaining is that the AD9850 does not output a constant voltage/power but rather decreases with increasing frequency. Without some form of AGC feedback in your output circuitry you will never have a 'calibrated' output value.

author: microbug
author_rank: Frequent Contributor
timestamp: July 23, 2014, 08:21:38 pm
content: Ah, yes... I had conveniently forgotten about that...EDIT: suggestions for AGC? I didn't even know it was possible until googling. Perhaps a better solution is just to have fixed (trimpot calibrated) 1.8V, 3.3V, 5V, 10V and 20V pk-pk amplitude options.

author: CarlG
author_rank: Regular Contributor
timestamp: July 23, 2014, 08:30:51 pm
content: Maybe theAD835could be useful?

author: microbug
author_rank: Frequent Contributor
timestamp: July 23, 2014, 08:35:50 pm
content: I have no experience at all with AGC- could you explain further?

author: fcb
author_rank: Super Contributor
timestamp: July 23, 2014, 09:37:36 pm
content: An AGC of some description would be useful, although you could just have an output level meter on the unit. If you did need an AGC then I would do it in software and have an AGC on/off switch on the unit.Careful though you don't get caught up in "function creep".Why the AD9850 and not the AD9851?

author: rob77
author_rank: Super Contributor
timestamp: July 23, 2014, 09:44:52 pm
content: ate you using the cheap ad9850 modules from China ? if yes then anything above 10-20Mhz is hopeless...i built myself a dual channel signal generator with those - atmega + 1602 LCD + 4x4 keypad + 2x ad950 board from China, but haven't build any output stage for sine output yet.... (i've put the project aside for now)

author: microbug
author_rank: Frequent Contributor
timestamp: July 23, 2014, 10:15:31 pm
content: Yes I am using a cheap AD9850 module (@fcb- availability; these modules are dirt cheap). However, a friend let me use their fancy scope and I have found it's good enough up to 42.5MHz (the -3db filter cutoff). I will probably use a separate comparator because the built in one is useless above 1MHz.The project will eventually be on hackaday projects (I'm going to enter it for the prize) and will be completely open (i.e., public domain), so you can take a look at the finished project when it's done.

author: David Hess
author_rank: Super Contributor
timestamp: July 23, 2014, 10:37:49 pm
content: Quote from: retrolefty on July 23, 2014, 08:20:18 pmBecause its output follows a sinc response?Not counting the antialiasing filter, it looks like it will be down to 84% (about -1.5 dB) of the low frequency output at 40 MHz with a 125 MHz clock.

author: rob77
author_rank: Super Contributor
timestamp: July 23, 2014, 10:44:19 pm
content: Quote from: microbug on July 23, 2014, 10:15:31 pmactually the comparator is good enough - i'm getting a good square up to 25MHz from those using a 74AC14 as output stage for square, but the sine hopeless above 20Mhz - distortion is way too high, and the signal is getting atenuated with increasing frequency 1MHz - 1Vpp , 10MHz - 820mVpp , 20MHz - 640mVpp, 30MHz - 360 to 500 mVpp - the sine is really ugly at 30MHz , 40MHz...well it resembles a sinewave somehow (if you have a really good imagination) the output of that something at 40MHz is 240-300mVppso don't put too much hope to those modules - but upto let's say 20MHz with some output stage with AGC it might be good enough

author: Mechatrommer
author_rank: Super Contributor
timestamp: July 24, 2014, 03:41:15 am
content: Quotemy built in one is useless below 1MHz (spikes on rising and falling edges) and of couse useless above 30MHz, that range if you set the built in adjustable trimpot to the correct level.Quotewhat dso and sample rate you are looking the signal at? using averaging in DS1052E 100MHz BW i get "acceptable" sine up to the limit 40MHz @ 1GSps sampling rate.

author: microbug
author_rank: Frequent Contributor
timestamp: July 24, 2014, 06:49:21 am
content: The guy's scope which I used was an Agilent DSO-3000 series, so it's probably safe to say that it trumps the DS1052E. Likewise, I found that the output was 'acceptable' up to that 42.5MHz mark on the sine output. The guy explained that since DDSs have to sample the clock every time the output changes, higher frequencies will often show heavy modulation unless they are a factor of the clock frequency, even after passing through the antialiasing filter.Maybe my module is a different version to yours or something, @rob77. The sine wave at 40MHz is just very modulated, i.e., every other wave has a higher amplitude.In the finished thing I will use an external high speed comparator to generate a square wave.

author: DRT
author_rank: Regular Contributor
timestamp: July 24, 2014, 08:41:52 am
content: Being 'the guy' Microbug mentioned(I let him use my electronics lab), I can offer the following - The module he has exhibits fairly classical behaviour for a DDS clocked at 125MHz. The filter is not great, but below ~40 MHz the output is reasonable. The comparator does not seem capable of much more than a few MHz.

author: rob77
author_rank: Super Contributor
timestamp: July 24, 2014, 09:47:19 am
content: the trimpot on my boards is adjusting the duty cycle of the square wave - and as i mentioned - the comparator must be good enough if i'm able to "recover" a usable square by the 74ac14 output stage.the sinewave at 30Mhz is deformed (but still resembles a sine), but at 40MHz it's just rubbish.my scope is a hantek DSO1102B (100MHz , 1GSa/s)i'll post some pictures showing the modules, the device i built and the output waveforms - need to take the pictures, scale them and upload (in 1-2 hrs.max).

author: David Hess
author_rank: Super Contributor
timestamp: July 24, 2014, 12:24:41 pm
content: Quote from: microbug on July 23, 2014, 08:10:51 pmNo, it should work fine.QuoteUsually an attenuator is used with a fixed gain stage because changing the amplifier gain alters its frequency response.

author: Mechatrommer
author_rank: Super Contributor
timestamp: July 24, 2014, 12:38:52 pm
content: 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 40MHz...circuit picture still available here...but i dont recommend this method of direct trimpots to ad9850 output, there are better (need more component) method but i dont have time for that.

author: David Hess
author_rank: Super Contributor
timestamp: July 24, 2014, 01:01:27 pm
content: Offhand I do not see any major problems.The output level will be halved when driving a 50 ohm load. The operational amplifier is not going to produce +/- 10 volts when driving a 100 ohm load with +/- 12 volt supplies. Also, its rated output current would be marginal if it could produce +/- 10 volts into 100 ohms.

author: rob77
author_rank: Super Contributor
timestamp: July 24, 2014, 01:15:39 pm
content: Quote from: rob77 on July 24, 2014, 09:47:19 amsorry guys, apprently i was wrong... i was playing with my unfinished signal generator today (i put it aside some time ago as mentioned earlier) and actually it wasn't the AD9850 module... it was the square wave output stage affecting the ad9850 modules through the supply rail (i realized this when i killed the square output by accident) pictures attached as promised - the recorded waveform is not that bad at 40MHzit's still very low Vpp and it has a DC offset bigger than the actual signal itself, but it can be usedunfortunately i can't post the distorted waveform right now, but i'll capture it once i replace the killed 74AC14 (and before i'll make any modifications to the device).i will definitely make dedicated linear regulators for the AD9850 boards and a dedicated supply rail with few chokes for the 74AC14 (and perhaps place the 74ac14 to a can underside of the board)

author: microbug
author_rank: Frequent Contributor
timestamp: July 24, 2014, 05:29:07 pm
content: 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 (datasheethere). Digging further into the AD9850 datasheet, I found a formula which I could use for AGC:x= (pi * Fclock) / Foutamplitude = sin(x)/xThe results look about right, with Fclockat 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.

author: David Hess
author_rank: Super Contributor
timestamp: July 24, 2014, 07:06:22 pm
content: Quote from: microbug on July 24, 2014, 05:29:07 pmAssuming 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.QuoteThat 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.

author: rob77
author_rank: Super Contributor
timestamp: July 24, 2014, 07:20:21 pm
content: Quote from: Mechatrommer on July 24, 2014, 12:38:52 pmthat looks really good to meone 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.

author: microbug
author_rank: Frequent Contributor
timestamp: July 24, 2014, 07:38:22 pm
content: @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.

author: David Hess
author_rank: Super Contributor
timestamp: July 24, 2014, 08:39:09 pm
content: Quote from: microbug on July 24, 2014, 07:38:22 pmI 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.

author: Mechatrommer
author_rank: Super Contributor
timestamp: July 24, 2014, 08:46:54 pm
content: Quote from: rob77 on July 24, 2014, 07:20:21 pmi'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 outputwhats 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.

author: microbug
author_rank: Frequent Contributor
timestamp: July 24, 2014, 08:54:57 pm
content: Will the THS3001 be OK with variable gain or should I switch to some other (non-CFB) op-amp?

author: Mechatrommer
author_rank: Super Contributor
timestamp: July 24, 2014, 09:15:07 pm
content: 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.

author: microbug
author_rank: Frequent Contributor
timestamp: July 26, 2014, 08:25:11 pm
content: 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.

author: microbug
author_rank: Frequent Contributor
timestamp: July 27, 2014, 11:17:26 am
content: 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!

author: rob77
author_rank: Super Contributor
timestamp: July 27, 2014, 11:36:22 am
content: 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).

author: microbug
author_rank: Frequent Contributor
timestamp: July 27, 2014, 11:39:19 am
content: Sorry, I didn't explain all of it:AD9850 module output -> DC blocking capacitor -> peak detectorAD9850 module output -> DC blocking capacitor -> attenuation network -> DAC offset -> fixed gain amplifier

author: rob77
author_rank: Super Contributor
timestamp: July 27, 2014, 11:45:28 am
content: if ac coupled then it's okone 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.

author: CarlG
author_rank: Regular Contributor
timestamp: July 27, 2014, 07:42:58 pm
content: 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.

author: microbug
author_rank: Frequent Contributor
timestamp: July 27, 2014, 09:37:52 pm
content: 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:hereis 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).

author: rob77
author_rank: Super Contributor
timestamp: July 27, 2014, 11:05:02 pm
content: 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 anyways7 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:char MyGetkey(void) {int av1 = 0, av2 = 0, i;float rv = 4700, rh = 1000, rb = 1000, tolerance = 0.02; // rv,rh,rb - see schematicsfloat v, vc; //measured and calculated voltageschar keys = {{'1','2','3','A'},{'4','5','6','B'},{'7','8','9','C'},{'E','0','F','D'}}; //keypad layoutfor (i=0; i<8; i++) av1 += analogRead(KEYPAD_PIN); // average of 8 ADC readingsav1 /= 8;delay(5); //wait 5msfor (i=0; i<8; i++) av2 += analogRead(KEYPAD_PIN); // another average of 8 ADC readingsav2 /= 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);}}}}return('\0');}

author: microbug
author_rank: Frequent Contributor
timestamp: July 27, 2014, 11:06:59 pm
content: Thanks, I will!EDIT: I just found my attenuation solution:ADG714ADG734. 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)