This project is a digital Automatic Gain Control (“AGC”) system using a PIC16F876 MCU. The ability to set the gain level in a circuit and have it control itself is a very useful function. This circuit is a building block of another project I am working on. A 30W power amp for either the PCS, iDEN or CDMA frequency bands. I will settle on one of those frequencies sometime soon.
Theory of operation: I needed to control the gain so the signals for a digital downconverter (DDC) and digital upconverter (DUC) would be in a specific range so the A/D that processes the IF of the mixers does not get over-driven by the amplitude of the input signals. Using a digital attenuator, logarithmic detector / controller, and a MCU with an A/D converter I was able to accomplish this task fairly easy with minimal components.
System Operation: The heart of this AGC system is the AD8313 logarithmic detector / controller. It is a demodulating logarithmic amplifier that converts an RF signal to an equivalent decibel-scaled value of DC at its output. The RF input is sampled by the AD8313 through a 20dB (TCD-20-4) coupler. The AD8313 is connected to the PIC16F876 A/D via an op-amp configured as a voltage follower. I used a 4.096VDC as the reference voltage giving me a step size of 4mV since the A/D is 10-bits. If the A/D reading is too high it starts turning on attenuators to decrease gain. If the signal is too high, the attenuators are turned off. I placed a red LED and a green LED in the circuit for when the signal is too low or too high (face it, everybody likes to see LEDs light up!). When the input signal is too low, the red LED is on. While the signal is too high, the green LED comes on. If the signal is within tolerance, both LEDs are off. The HMC273MS10G digital attenuator has a max attenuation of 31dB with increments in steps of 1dB. The amplifier used was a SGA-6389 SiGe HBT MMIC amplifier. The gain on this amplifier was roughly 14dB and provided a IP3 of +35dBm.
FIRMWARE: View .C (CCS PCW) file.
Future Use: The PIC16F876 has 8K of FLASH as well a bunch of I/O and A/D channels left for other operations. I may even use the USART of the PIC to be able to control the gain of the system via RS232. Could attatch a temp sensor to control the temperature of the overall assembly. If the amplifier gets too hot, turn a fan on. Or even use the AD8313 as a power meter of sorts. There are so many ideas I don’t want to list them all!!! Special note: Many THANKS goes out to Dale Botkin and Edson Brusque for suggestions with the CCS compiler!! This code as well as the little bit of schematic provided can be used as you wish. If you find it useful don't hesitate to drop me a line, I would love to hear about the uses of the AD8313 or PIC in AGC systems that other people have done.
Web Site last updated:04/14/03
Page operating since: 06/01/01
If you have any questions please contact me at:email@example.com