How can I control amp gain digitally? - Page 1
Forum section: electronics / beginners

author: Saitama
author_rank: Contributor
timestamp: March 25, 2021, 11:49:50 am
content: Hello!I'm making a function generator with an AD9833. The output voltage is 0.65v and it needs an amplifier with variable gain to be useful. I thought of using a digital pot, but they are hard to get a hold of where I live and I read that they can't handle high(ish) frequencies. Then I searched internet and found about VCOs (Voltage controlled amplifiers), so I tried making one. The idea was to have a fixed gain amplifier and a voltage divider at the input; I used a MOSFET as a low side resistor (I hooked up a pot at the gate) and while turning the pot, the voltage did really change! The problem was that the output signal was DC and not what I started with. I am stuck on this part and I would really appreciate a tip or two.Thanks for reading!

author: werediver
author_rank: Contributor
timestamp: March 25, 2021, 04:07:10 pm
content: Quote from: Saitama on March 25, 2021, 11:49:50 amCan you show a circuit diagram corresponding to your experiment?

author: Kleinstein
author_rank: Super Contributor
timestamp: March 25, 2021, 04:16:08 pm
content: There are several options to vary the amplitude. A voltage controled amplifier is one idea. This usually is a special ready made chip. A DIY solution could be somthing like a long tailed pair differential amplifier with a variabe current level. Some gilbert cell mixers (e.f MC1496) can also be used this way.The are some multiplying DACs that are reasonable fast (e.g. up to a few MHz) that can be used. There are also some readimade switchable / programmabe gain amplifiers. On can do the gain switching (usually a few coarse steps) with parts like CMOS switches (e.g. 4053 ). Besides gain one can also build switchable attenuations. Especially for the coarse part relays are an option too.For fine adjustment some DDS chips allow to change the reference voltage over a limited range.

author: HB9EVI
author_rank: Frequent Contributor
timestamp: March 25, 2021, 04:39:33 pm
content: the AD9833 is is many ways a rather bad choice, missing amplitude control is one of it; I'd go with the AD9834 which allows amplitude setting via an adjustable current source, so it can be done with a DAC; digital pots are not very RF-capable. other option like already said is a VCA, that could be controlled by a DAC

author: David Hess
author_rank: Super Contributor
timestamp: March 25, 2021, 05:23:47 pm
content: Gain is usually better controlled by using switched attenuator sections and fixed gain amplifiers because varying the gain of the amplifiers directly also changes their frequency response.

author: prosper
author_rank: Regular Contributor
timestamp: March 25, 2021, 06:13:46 pm
content: I'm (slowly) working on the same thing. (https://github.com/prosper00/STM8-AD9833-Function-Generator) - An AD9833 controlled by an MCU. I decided that I didn't really NEED digital amplitude control at all, so I did it simply using a pot to set the gain of my op amp stage.In the future, I intend to build a peak detector circuit, and run the output of that to my uC's ADC, so that I'll be able to display to the user what the amplitude is currently at. I suppose I could then replace the pot with a FET of some sort, and use that as a voltage controlled resistor that I could then drive with a DAC or maybe filtered PWM... It wouldn't be very linear, but with the ADC watching things and providing feedback to the mcu, it might be feasible.

author: Kleinstein
author_rank: Super Contributor
timestamp: March 26, 2021, 07:50:08 am
content: The way of measuring the actual amplitude at the output and than readjust the amplitude is common in higher grade RF generators. However one still needs some controllable gain.For the coarse part switchable attenuators are often the best choice. Some extra attenuation at the output, so behind the final amplifier has some benefits: it gives some additional protection and an attenuator can give a more constant output impedance also to high frequencies (though not so much a problem with the moderate frequencies of the AD9833 or similar). Digital control includes manually operated switches.

author: Doctorandus_P
author_rank: Super Contributor
timestamp: March 27, 2021, 05:37:18 pm
content: I once was interested in AD9850 (or was it AD9852?)It also has a current input for setting the amplitude and with a (DC) DAC it could be regultated to quite low values, but this is not good practice.Better is to have an amplitude range in some limited range, and then use some attenuators after the signal is generated. These also attenuate noise, and maintain a decent sine wave.You only need a few of these. For example a -10dB, a -20dB and a -40dB relais based attenuators, get you down to -70dB without loosing signal quality. And you only use the amplitude control to fill in the gaps between the attenuators.