FEATURE ARTICLE by Neal Martini Signal Generation...

7
12 Issue 182 September 2005 CIRCUIT CELLAR ® www.circuitcellar.com Nevertheless, it was a great learning experience. If you want to expand your electronic horizons a little, this is a good project to try. Before I describe my design, I’ll cover some of the things I learned that might help you under- stand some of the trade-offs I made. IMPEDANCE MATCHING Voltage standing wave ratio (VSWR) is an important term to understand when it comes to impedance matching at RF. In it’s simplest form, a VSWR = 1, which is sometimes written as 1:1, means that the source and load have a matched impedance such as a 50-source driving a 50-load. If a purely resistive load impedance were twice that of a purely resistive driving source impedance, as would be the case if a 50-resistive source were driving a 100-resistive load, then the VSWR would be 2:1. So why so much focus on imped- ance matching at RF? At RF, if there’s an impedance mismatch, some of the signal gets reflected back from the load to the driving source. A conse- quence is that some of the power that you wanted to deliver to the next stage in the circuit is reduced. For example, if you have a VSWR of 5:1, you lose 2.55 dB of your transmitted signal. Another consequence is that the sig- nal reflected back to the driving source can cause problems. For exam- ple, with a VSWR of 5:1, 44% of the power is reflected back to the source. In a high-power amplifier, this reflect- ed signal could be so strong that it damages the amplifier’s output stage. Another example is when you have a mismatch at the output of a mixer. I worked at home for a year and a half on a project that required a fre- quency source that generated sine wave signals in the 100- to 375-MHz frequen- cy range. I had access at a local universi- ty to high-quality Hewlett-Packard sig- nal generators, but going back and forth to the lab was a bit inconvenient. My first thought was to look on the Internet for an affordable signal gener- ator to suit my needs. Needless to say, only expensive generators were available. With many years of professional and hobby experience in lower frequency dig- ital and analog systems, I decided to ven- ture out and build my own RF signal generator. I realized that things were a little trickier at higher frequencies, but I was confident it would be fairly straight- forward. I had some experience with low-frequency narrowband mixing cir- cuits, so I thought I had a pretty good handle on frequency translation using mixers. So, I proceeded with reckless abandon. Boy, did I ever underestimate the task I was about to undertake! The more I dug in, the more I real- ized that almost everything is differ- ent when working at RF. The termi- nology (e.g., VSWR, compression points, frequency pulling/pushing, intermodula- tion distortion, and dBm) was foreign to me. Much more attention was given to design details like complex imped- ance matching and signal path leak- age. The way you breadboard, lay out the PCB, and test were—you guessed it—all different. Even the parts suppliers were companies that I wasn’t familiar with. And finally, and most important- ly, the difference between theory and reality was dramatic. The reflected signal gets sent back into the mixer and is remixed. This could produce spurious outputs. A table showing some typical VSWR val- ues and what the power loss/reflection would be for various mismatches is available, along with some other useful items, on the Circuit Cellar FTP site. As it turns out, most RF parts don’t have the typically used characteristic impedance of 50 . In fact, some parts are dramatically different. Take a simple low- pass filter for example. In the passband for the filter, the VSWR is typically 1.1. Pretty good! Well, not so fast. In the stop- band the VSWR of the filter typically can be 20:1 or worse. What that means is that almost all of the power (82%) outside the passband of the filter is reflected back to the driving source. If the filter were at the output of a mixer, the consequences of this mismatch could cause significant problems in the mixing process. So, what can you do if most parts aren’t the nominal 50 and you can’t live with the consequences? There’s plenty of literature available about using L/C networks to match impedances for narrowband designs. However, in wide- band systems like the signal generator described in this article, a common tech- nique is to use resistor pads between the mismatched impedances. Because they are purely resistive, they work their magic over a broad frequency spectrum. What happens with a resistor pad is that the signals that eventually will be reflected back from the load will be attenuated on the path forward to the load and on the return trip. This effec- tively alters the VSWR as seen by the source because a lower reflected signal FEATURE ARTICLE by Neal Martini Signal Generation Solution Tired of going to a local university lab to use a signal generator, Neal designed his own.In this article he explains how he built the PIC16F877A-based controller and RF module. Build an Inexpensive RF Signal Generator Circuit Cellar, the Magazine for Computer Applications. Reprinted by permission. For subscription information, call (860) 875-2199, or www.circuitcellar.com. Entire contents copyright ©2005 Circuit Cellar Inc. All rights reserved.

Transcript of FEATURE ARTICLE by Neal Martini Signal Generation...

Page 1: FEATURE ARTICLE by Neal Martini Signal Generation Solutionelectronics-diy.com/pdf/upb1507_schematic.pdf · 2011. 12. 24. · CIRCUIT CELLAR® Issue 182 September 2005 15 I resorted

12 Issue 182 September 2005 CIRCUIT CELLAR® www.circuitcellar.com

Nevertheless, it was a great learningexperience. If you want to expandyour electronic horizons a little, this is agood project to try. Before I describe mydesign, I’ll cover some of the things Ilearned that might help you under-stand some of the trade-offs I made.

IMPEDANCE MATCHINGVoltage standing wave ratio (VSWR)

is an important term to understandwhen it comes to impedance matchingat RF. In it’s simplest form, a VSWR = 1,which is sometimes written as 1:1, meansthat the source and load have a matchedimpedance such as a 50-Ω source drivinga 50-Ω load. If a purely resistive loadimpedance were twice that of a purelyresistive driving source impedance, aswould be the case if a 50-Ω resistivesource were driving a 100-Ω resistiveload, then the VSWR would be 2:1.

So why so much focus on imped-ance matching at RF? At RF, if there’san impedance mismatch, some of thesignal gets reflected back from theload to the driving source. A conse-quence is that some of the power thatyou wanted to deliver to the next stagein the circuit is reduced. For example,if you have a VSWR of 5:1, you lose2.55 dB of your transmitted signal.

Another consequence is that the sig-nal reflected back to the drivingsource can cause problems. For exam-ple, with a VSWR of 5:1, 44% of thepower is reflected back to the source.In a high-power amplifier, this reflect-ed signal could be so strong that itdamages the amplifier’s output stage.

Another example is when you havea mismatch at the output of a mixer.

I worked at home for a year and ahalf on a project that required a fre-quency source that generated sine wavesignals in the 100- to 375-MHz frequen-cy range. I had access at a local universi-ty to high-quality Hewlett-Packard sig-nal generators, but going back and forthto the lab was a bit inconvenient. Myfirst thought was to look on theInternet for an affordable signal gener-ator to suit my needs. Needless to say,only expensive generators were available.

With many years of professional andhobby experience in lower frequency dig-ital and analog systems, I decided to ven-ture out and build my own RF signalgenerator. I realized that things were alittle trickier at higher frequencies, but Iwas confident it would be fairly straight-forward. I had some experience withlow-frequency narrowband mixing cir-cuits, so I thought I had a pretty goodhandle on frequency translation usingmixers. So, I proceeded with recklessabandon. Boy, did I ever underestimatethe task I was about to undertake!

The more I dug in, the more I real-ized that almost everything is differ-ent when working at RF. The termi-nology (e.g., VSWR, compression points,frequency pulling/pushing, intermodula-tion distortion, and dBm) was foreign tome. Much more attention was givento design details like complex imped-ance matching and signal path leak-age. The way you breadboard, lay outthe PCB, and test were—you guessedit—all different. Even the parts supplierswere companies that I wasn’t familiarwith. And finally, and most important-ly, the difference between theory andreality was dramatic.

The reflected signal gets sent backinto the mixer and is remixed. Thiscould produce spurious outputs. Atable showing some typical VSWR val-ues and what the power loss/reflectionwould be for various mismatches isavailable, along with some other usefulitems, on the Circuit Cellar FTP site.

As it turns out, most RF parts don’thave the typically used characteristicimpedance of 50 Ω. In fact, some parts aredramatically different. Take a simple low-pass filter for example. In the passbandfor the filter, the VSWR is typically 1.1.Pretty good! Well, not so fast. In the stop-band the VSWR of the filter typically canbe 20:1 or worse. What that means is thatalmost all of the power (82%) outside thepassband of the filter is reflected back tothe driving source. If the filter were at theoutput of a mixer, the consequences ofthis mismatch could cause significantproblems in the mixing process.

So, what can you do if most partsaren’t the nominal 50 Ω and you can’tlive with the consequences? There’splenty of literature available about usingL/C networks to match impedances fornarrowband designs. However, in wide-band systems like the signal generatordescribed in this article, a common tech-nique is to use resistor pads between themismatched impedances. Because theyare purely resistive, they work theirmagic over a broad frequency spectrum.

What happens with a resistor pad isthat the signals that eventually will bereflected back from the load will beattenuated on the path forward to theload and on the return trip. This effec-tively alters the VSWR as seen by thesource because a lower reflected signal

FEATURE ARTICLE by Neal Martini

Signal Generation Solution

Tired of going to a local university lab to use a signal generator, Neal designed his own. In thisarticle he explains how he built the PIC16F877A-based controller and RF module.

Build an Inexpensive RF Signal Generator

Circuit Cellar, the Magazine for Computer Applications. Reprintedby permission. For subscription information, call (860) 875-2199, orwww.circuitcellar.com. Entire contents copyright ©2005 CircuitCellar Inc. All rights reserved.

Page 2: FEATURE ARTICLE by Neal Martini Signal Generation Solutionelectronics-diy.com/pdf/upb1507_schematic.pdf · 2011. 12. 24. · CIRCUIT CELLAR® Issue 182 September 2005 15 I resorted

14 Issue 182 September 2005CIRCUIT CELLAR®

www.circuitcellar.com

appears back at the source. Ofcourse, the VSWR is improvedat the expense of attenuation tothe wanted signal as well. Thisis tolerable in many cases, asyou’ll see in the RF generatordesign I’ll describe later.

The VSWR improvementusing resistor pads can be dra-matic. For example, a VSWR of20:1 can be changed to a VSWRof 1.59:1 with the addition of a 6dB pad. A table showing howvarious VSWR values can bechanged with different pads isposted on the FTP site.

REAL MIXERS ARE MESSYA classical mixer has two

input ports (RF and LO) and one out-put port (IF). Ideally, the sine wave FLO

at the LO port modulates the signalFRF at the RF port, and the output portIF contains FIF = FLO ± FRF. In the com-monly available double-balancedmixer (DBM) used in this project, thisresult is true; however, the outputalso contains undesired spurious out-puts (called spurs) that can cause distor-tion if they aren’t handled carefully.

Why are so many spurs produced?For one thing, the mixing action in aDBM is achieved by turning variousdiodes on and off to produce modula-tion. This process is called biphasemodulation. The mixer’s output can bemathematically modeled as follows:

[1]

With a DBM you’re basically modulat-ing the RF signal with a series of sinewaves that are odd harmonics of theLO, each producing signals at themixer’s output.

Let’s look at another source ofunwanted mixer output components.Real world RF mixers have signalleakage between all the three ports.This causes signals to appear at theoutput IF port located at the RF andLO frequencies. According to classicalcommunication theory, this isn’t sup-posed to happen in DBMs. This leak-age is unavoidable for RF signals.

The final source of spurs is generatedbecause the conducting diodes are non-

V

nnw t

OUT

LOODD

=V sin w tRF RF( ) ( )( )

πsin

Σ ( )4

1

linear. Although the nonlinearity isrequired to produce the wanted sum anddifference frequencies, the higher ordernonlinearities produce unwanted spurs.

The net result is that the mixer pro-duces output at various frequencies:

[2]

where m and n are integers. Figure 1shows how catastrophic this can be. Itshows the output of a spectrum ana-lyzer that was attached to the IF porton a DBM mixer. The LO and RF sig-nals were provided by two commerciallyavailable signal generators. FLO equals500 MHz. FRF is 700 MHz. Asyou can see, the output spec-trum is loaded with spurs thatwould cause problems in awideband system.

Hittite’s spur calculator isan excellent tool for predict-ing a DBM’s output(www.hittite.com). If youspecify the frequencies and thelevels of the RF and LOports, the tool will show youthe frequencies at which all ofthe spurs will occur and whattheir power levels will be.

Figure 2 shows an exampleof the output from theHittite tool. In this example,the LO is 1.5 GHz and the RFsignal varies from 1.5 to 2GHz. If, for example, youwant to know which mixerIF outputs will occur if the RFsignal is 1.7 GHz, you go to

FIF = mF nFLO RF± ±

1.7 GHz on the RF frequencyaxis and move up the graph ver-tically. Every line you cross isanother output that will be atthe IF port. The level of eachoutput signal is given in theboxes below the graph.

You can use this tool to comeup with a frequency plan foryour design. It will help youchoose things like the frequenciesand drive levels required for theLO and RF oscillators in order toget the IF results you want. It willalso help you plan which filteringis required around the mixer.

PROTOTYPING & TESTINGWhen there are 2-GHz signals

running around in a circuit, you haveno choice but to prototype with aPCB. I tried hand soldering and wirewrapping, but the results were chaotic.

You can get away with a two-layerPCB design as I did for this project, butfour layers are better. You have to usesurface-mount devices to achieve qualityresults.

At RF frequencies, components withaxial leads add too much inductanceand capacitance to be practical. I refusedto go any smaller than 0805-size SMTdevices because that was the smallest Icould handle with tweezers and magni-fying goggles. It seemed to work fine.

Figure 2—The LO signalis 1.5 GHz. The RF signal varies from 1.5to 2 GHz. The graph shows the different IF port outputs that willoccur as the RF frequency is varied. The level of each output signalis given in the boxes below the graph.

Figure 1—Take a look at an example of the frequency spectrum at the IFport of a real world DBM mixer. The LO signal and the RF signal were pro-vided by two commercially available signal generators (FLO = 500 MHz andFRF = 700 MHz). The output spectrum is loaded with spurs that wouldcause problems in a wideband system.

Page 3: FEATURE ARTICLE by Neal Martini Signal Generation Solutionelectronics-diy.com/pdf/upb1507_schematic.pdf · 2011. 12. 24. · CIRCUIT CELLAR® Issue 182 September 2005 15 I resorted

www.circuitcellar.com CIRCUIT CELLAR® Issue 182 September 2005 15

I resorted to water-solublesolder paste and a toasteroven for the reflow. I wasamazed at how well this sim-ple approach worked. I con-trolled the toaster oven’stemperature and timing man-ually.

Laying out a PCB at thesefrequencies can be tricky.Given the trace thickness usedby your PCB supplier, you needto use trace widths that pro-vide a 50-Ω system impedance.I needed approximately 100-miltrace widths for my PCB.

In addition to controllingtrace widths, try to keep themain signal path as close to astraight line as possible to minimizeany spurious modulations. If you needto make a right angle, it’s recommend-ed that you do it with two 45° steps.Even the size and length of a via is afactor at these RF frequencies, but Ichose to ignore this precaution with-out apparent consequences.

It’s also necessary to put an RF cir-cuit in an RF tight enclosure in orderto keep external signal sources outand the generated signals in. RF tightmeans no open holes in the box topass wires through (they would leakRF like crazy). It also means shieldedconnectors in and out for signal linesand pass-through capacitors for filter-ing DC supply lines. I obtained pass-through capacitors from a surplushouse for $1.50 each. It’s worthsearching for these because they canbe pretty costly.

Incidentally, if you study the infor-mation available online, you’ll findthat standard BNC connectors workwell at 2 GHz. The BNC connectorsand cables are cheaper and more readi-ly available than the higher frequencySMA counterparts.

A final note on testing and debug-ging an RF circuit. It’s best if youhard-wire shielded cable to test pointsrather than use pigtail leads. The para-sitics and extraneous coupling thatexist with unshielded lengths of wirewill produce confusing results.

Enough about all the gotchas! It’stime to move on to the RF signal gen-erator’s design.

ARCHITECTUREMy goal for this project was to

design a signal generator that pro-duces sine waves from 10 to 600 MHzat a constant output power level of 5dBm. Let’s take a look at how I did it.

The assumed load is 50 Ω, which istypical for RF systems. Talking aboutsignal levels in terms of decibels rela-tive to 1 mW (dBm) is common whenyou’re dealing with RF systems.Equation 3 is for converting frompower in watts to power in dBm.

[3]

A table showing the relationshipbetween power in dBm, RMS voltage,and power in milliwatts is posted onthe FTP site. The table assumes a50-Ω system.

The 5 dBm design specification forthis generator is equivalent to a 0.4-VRMS sine wave. This will produce3.2 mW when driving a 50-Ω load.

Figure 3 shows the overall architec-ture for the signal generator. It con-sists of two main modules. The RFmodule produces the 10- to 600-MHz5-dBm signal. The controller moduledirects the RF module’s actions.

The signal flow in the RF module isa straightforward mixing process. Thelocal oscillator is fixed at approxi-mately 1.5 GHz. The RF oscillatorvaries from 1.5 to 2.1 GHz dependingon the output frequency you wantfrom the generator. A voltage from themicroprocessor sent via a D/A converter

PowerPower

dBmwatts =

mW10

1log ( )

controls the RF oscillator’sfrequency.

I chose the high operatingfrequencies for the LO andRF oscillators in order tokeep unwanted spurs fromappearing in the desired IF out-put range of 10 to 600 MHz.Next, the outputs of the RFand LO oscillators were fre-quency divided down so themicroprocessor could measurethem. These divided-down sig-nals were 23- to 32-MHz digi-tal signals; they were routed tothe microprocessor throughtime windowing control logic.

Before the RF and LO oscil-lator outputs are mixed, the

signals are low-pass filtered to attenu-ate any harmonics present at theoscillator outputs. The RF and LO sig-nals are then mixed by the mixer andan assortment of signals appear at theIF output. This IF output is then low-pass filtered to eliminate most of theunwanted spurs. Following this, avariable-gain amplifier whose gain is

RF

÷ 64

÷ 64

fC = 2,250

LPF MixerIF

LPF

LPF

DAC TimeGate DAC

Display Microprocessor

Variable gain amplifier

fC = 490

fC = 2,250

Local oscillator

10 to 600 MHz5 dBm

Controlmodule

Up Down

RFModule

MHz MHz

MHz

Figure 3—A voltage from the microprocessor controls the RF signal frequency.The actual RF and LO frequencies are measured by the microprocessor. Themicroprocessor calculates the actual IF frequency and displays it. A voltage fromthe microprocessor controls the amplifier gain to maintain the desired output level.

Photo 1a—The PCB is approximately 2.5″ on a side. Itcontains mostly SMD devices. The DBM mixer is in thecenter, and the two VCOs are located on the left andright sides. The top part of the board is the divide-by-64circuitry. The lower part contains the IF amplifiers. b—Themodified demo board on the left is attached to the RFmodule in its RF tight enclosure. For the sake of clarity, Iomitted the shielded cables normally located betweenthe RF and LO BNC connectors on the RF module andthe controller.

a)

b)

Page 4: FEATURE ARTICLE by Neal Martini Signal Generation Solutionelectronics-diy.com/pdf/upb1507_schematic.pdf · 2011. 12. 24. · CIRCUIT CELLAR® Issue 182 September 2005 15 I resorted

16 Issue 182 September 2005 CIRCUIT CELLAR® www.circuitcellar.com

controlled by the microprocessoramplifies the RF signal. This analoggain control signal is supplied via aD/A converter driven by the micro-processor. An LCD shows the genera-tor’s output frequency. The up anddown push buttons enable you toselect the desired generator frequency.

RF MODULEThe RF module PCB is shown in

Photo 1a (p. 15). Figure 4 is a detailedschematic of the module.

To begin the design, I used theHittite tool to determine where in fre-quency I wanted to operate to mini-mize spurs. I chose to operate the mix-ing process between 1.5 and 2 GHz.

The first component I selected wasa Mini-Circuits SYM-25DLHW mixermainly because of its operating fre-quency range. I then chose a POS-2000A voltage controlled oscillator(VCO) for the RF and LO oscillators.The POS-2000A’s output frequencyrange is approximately 1.3 to 2.1 GHz.

Applying 0 to 20 V to the VTUNE inputcontrols the frequency. I selected thisVCO not only for its operating frequencyrange, but also for its output level. Itturns out that if you want good resultsfrom a mixer, you need to drive it at thesignal levels it was designed for. The

SYM-25DLHW mixer is designed to havea 10-dBm LO signal level and an RF sig-nal level that’s at least 10 dB below theLO (or around 0 dBm). The POS-2000Ahas an output level of 10 to 12.6 dBm,which makes it an excellent choice forboth the LO and RF oscillators.

The LO VCO’s output passes througha small 1-dB pad to help better matchimpedance to the low-pass filter. Iwould’ve liked to have used a larger padfor better matching, but I needed to keepthe LO signal level to the mixer at the10 dBm design specification.

The LO signal then feeds into a Mini-Circuits LFCN-2250 low-pass filter. Thefilter’s 3-dB cutoff frequency is 2.525 GHz.These LFCN-series filters are really slickseven-section filters contained in a tinyceramic package. They take up littleboard space and minimize the headachescaused by the parasitics associated withfilters constructed with separate SMTcomponents. The output of the LFCNlow-pass filter drives the mixer’s LO port.

The output of the LO VCO is alsotapped off via a 475-Ω resistor in orderto feed a UPB1507 prescaler. The inputto the prescaler must be between –15and 5 dBm to operate properly. TheUPB1507 prescaler divides the analogsignal by 64 and outputs a 1.6-VPP sinewave like output. This output is trans-

formed into a clean digital signal bythe high-speed TL714 comparator.

The RF signal path is similar. Themain difference, as I mentioned earli-er, is that the SYM-25DLHW mixer ismade to operate with an RF inputlevel at least 10 dB below the LO level.Two 6-dB pads are included to providethis attenuation. As an additional ben-efit, they provide excellent impedancematching in the RF signal path.

Incidentally, the pads in this circuitare also made by Mini-Circuits.They’re extremely compact and takeup little board space. As you can see, Iused a lot of Mini-Circuits compo-nents. The company is a quality sup-plier. The literature it provided wasexcellent, and the specifications avail-able on the company’s web site werethorough and accurate.

There is a pad at the mixer outputfor impedance matching. Matching atthe mixer output is critical. The sig-nal then passes through anotherLFCN-series low-pass filter with a 3-dB cutoff of 650 MHz. The filter’s out-put feeds into an Analog DevicesAD8367 variable gain amplifier, thepurpose of which is to maintain therequired 5-dBm output signal level asthe frequency varies. A control volt-age (0 to 1 V) on the AD8367’s gain pin

Figure 4—The two POS-2000As are used to generate the RF and LO signals in the SYM-25 DLHW DMB mixer. The variable gain is accomplished by the AD8367. TheUPB1507 prescalers provide the frequency division function.

Page 5: FEATURE ARTICLE by Neal Martini Signal Generation Solutionelectronics-diy.com/pdf/upb1507_schematic.pdf · 2011. 12. 24. · CIRCUIT CELLAR® Issue 182 September 2005 15 I resorted

18 Issue 182 September 2005 CIRCUIT CELLAR® www.circuitcellar.com

varies the gain from –2.5 to 42.5 dB. TheAD8367’s output is then amplified oncemore by a stage that uses a Mini-Circuits MAV-11 MMIC integratedamplifier. This provides a robust inter-face to the outside world. It’s includedbecause it’s cheaper and easier toreplace than the AD8367 if someone likeme abuses the signal generator’s output.

Table 1 shows the expected signal lev-els at various points throughout the RFgenerator. Two operating frequenciesare shown. These values were derivedfrom the detailed specification sheetsof the various components. The gain as afunction of frequency was initially setusing these values, but the measured out-put was consistently low by 3.2 dBm. Iadded a 3.2-dBm constant to the gainfunction, which enabled the microproces-sor to keep the RF signal generator’s out-put at 5 dBm. The gain function is astraight line fit to this adjusted data.

CONTROLLER MODULEThe controller module is shown in

Figure 5. I implemented this controller

on a Microchip PICDEM 2 Plus demon-stration board. The schematic showsonly the portion of the demonstrationboard that I used. I used the prototypearea to add the circuitry for controllingthe RF module. The additional 8- and20-V power supply designs are includedin the schematic for completeness, butbench supplies were used for the pro-totype. Photo 1b shows the modifieddemonstration board attached to theRF module in its RF tight enclosure.

The controller includes a MicrochipPIC16F877A microcontroller runningat 4 MHz. The MCU’s job is light inthis application, so its limited amountof horsepower didn’t matter too much.

As you can see in Figure 5, I includeda two-channel MCP4922 DAC to supplythe control voltages to the RF POS-2000A VCO and for the gain control tothe AD8367. The DAC’s outputs werebuffered using the TLE2142 low-noiseop-amp. I initially attempted to usethe PIC16F877A’s built-in PWMs withlow-pass filtering to produce the controlvoltages, but I wasn’t happy with theoutput’s purity. It turns out that theVCO and variable gain amplifier areextremely responsive to fluctuations onthese control lines. The buffered DACwith the associated MCP1541 referencesource perform quite well. They provideclean, stable signals to the control lines.

The LO and RF frequency measure-ments are made in a unique way. Thechallenge is to measure a signal that’sat approximately 30 MHz with amicroprocessor running at 4 MHz.

Figure 5—The controller provides the analog voltages for RF frequency control and IF signal amplifier gain. The measurement of the actual RF and LO frequencies is alsoperformed in the controller.

Signal levels (dBm)RF = 1.6 GHz RF = 2 GHz

VCO Output 11.5 10.14LFCN-2250 Output 5.17 3.63Mixer RF input –0.83 –2.37Mixer IF output –0.751 –9.82LFCN-490 Output –10.73 –13.68AD8367 Input –22.13 –25.08Mav-11 Input –7.6 –7.16RF Gen output 5 5

Table 1—The expected signal levels at various pointsthroughout the RF generator were derived from thespecification sheets for the various components. Twodifferent RF operating frequencies are shown.

Page 6: FEATURE ARTICLE by Neal Martini Signal Generation Solutionelectronics-diy.com/pdf/upb1507_schematic.pdf · 2011. 12. 24. · CIRCUIT CELLAR® Issue 182 September 2005 15 I resorted

www.circuitcellar.com CIRCUIT CELLAR® Issue 182 September 2005 19

This design uses the PIC16F877A’sinternal Timer0 with a built-inprescaler. The prescaler is specified at10-ns rise and fall times, which enableit to be clocked by an external sourceat up to 50 MHz. I gated the input toTimer0 for 1 ms and then used Timer0’scontents to calculate the frequency.

The process seems pretty straightfor-ward, but there was a problem. Timer0with its prescaler is 16 bits long, butthe microprocessor can read only thetop 8 bits. To determine the prescaler’scontents, I used the microprocessor topulse Timer0 until the prescaler over-flowed into the upper 8 bits of Timer0.The number of times you have to pulseto get to overflow enables you to identifythe prescaler’s initial content. ThePBasic pseudo code used to execute thisis shown in Listing 1 (p. 20). A simpleflowchart is posted on the FTP site.

A standard LCD and two push buttonsare included. I tried to keep the inter-face simple, so the only controls are anUp/Down frequency button. In responseto a request to change the frequency, themicroprocessor will increase or decreasethe control voltage to the RF VCO. Theoutput frequencies of the RF and LOVCOs are then measured in the afore-mentioned fashion, and the IF output fre-quency is calculated. Following this, themicroprocessor adjusts variable gainamplifier’s gain as a function of frequen-cy. The microprocessor then displaysthe IF output frequency on the LCD.

GOOD OUTPUT?A table showing an output compari-

son between the RF signal generatorand a commercially available genera-tor is posted on the FTP site. Bothgenerators were set to deliver a 200-MHz, 5-dBm signal.

All unwanted spurs of any conse-quence are pushed out of the 10- to600-MHz range of the generatorexcept for the pesky second harmonicof the desired output signal. As I pre-dicted with the Hittite tool, this com-ponent is down approximately 36 dBrelative to the wanted fundamental.

The expensive spread is better, but Ididn’t do too badly with respect toharmonic levels and total harmonicdistortion. Furthermore, the RF gener-ator’s output levels were well main-

tained across the frequency range to5 dBm (±0.5 dBm). A sample plot ofthe output spectrum is available onthe FTP site.

NEXT STEPSThis was a fun and challenging proj-

ect, but I feel like I’ve just seen theproverbial tip of the iceberg. I nowwant to evolve this design and contin-ue exploring the process of working atthese higher frequencies. I plan tocontrol the LO and RF oscillators’ fre-

quencies with phase-locked loops forbetter stability. I would like to useVCOs that operate at 5 V and havecontrol voltages of up to 5 V to simpli-fy the necessary power supplies. I’mgoing to look for a wider BW variable-gain amplifier in order to operate athigher frequencies. I would also liketo add true RMS detection to the gaincontrol loop for output level accuracy.Finally, I’ll probably add a full keypadinterface to the microprocessor in aneffort to create more flexibility when

Page 7: FEATURE ARTICLE by Neal Martini Signal Generation Solutionelectronics-diy.com/pdf/upb1507_schematic.pdf · 2011. 12. 24. · CIRCUIT CELLAR® Issue 182 September 2005 15 I resorted

PROJECT FILESTo download the code and additionalfiles, go to ftp://ftp.circuitcellar.com.

RESOURCESK. Maxon, “Have You Seen My NewSoldering Iron?” Encoder, SeattleRobotics Society, www.seattlerobot-ics.org/encoder/200006/oven_art.htm.

PCB Impedance Calculator, www.emclab.umr.edu/pcbtlc/microstrip.html.

SOURCESAD8367 Variable gain amplifierAnalog Devices www.analog.com

Spur calculatorHittite Microwave Corp.www.hittite.com

MCP4922 DAC and PIC16F877A MCUMicrochip Technologywww.microchip.com

LFCN-2250 low-pass filter, MAV-11MMIC integrated amplifier, POS-2000Avoltage VCO, and SYM-25DLHW mixerMini-Circuits www.minicircuits.com

www.circuitcellar.comCIRCUIT CELLAR®20 Issue 182 September 2005

of application areas. In addition toplaying racquetball and golf, heenjoys woodworking and travelingwith his wife. You may contact Nealat [email protected].

Neal Martini holds an M.S.E.E. fromthe University of Missouri, Rolla. Heis now retired after working 24 yearsfor Hewlett-Packard in the Inkjet andLaserJet printing businesses. Neal iscurrently pursuing several independ-ent product developments in a variety

Listing 1—The PBasic pseudo code shows how an approximate 30-MHz signal is measured using a relativelylow-power 4-MHz microprocessor. The design uses the PIC16F877A’s internal Timer0 with a built-in prescaler.

fhilo var word //Contains RF frequency after measurementmeasrf:

High PORTE.1 //Enable RF oscillator gateLow PORTA.5 //Disable t0ckl gateLowPORTE.0 //Force local oscillator gate output highTMR0=0 //Clear TIMER0PULSOUT PORTA.5,100 //Enable tockl gate for 1 ms Low PORTE.1 //Disable RF oscillator gatefhilo.byte1=TMR0 //Extract upper 8 bits of Timer0call extract //Extract value in prescalerRETURN

extract:For I=1 to 255 //Pulse Timer0 until prescaler overflowsPULSOUT PORTA.5,1If TMR0-fhilo.byte1=1 then goto done //Is there overflow?Next I //No

done: fhilo.byte0=256-I //Yes. 256 number of loop cycles = //prescaler value

Return

/pub/Circuit_Cellar/2005/182.controlling the frequency and level. I