Sie sind auf Seite 1von 5

Circuit Cellar, the Magazine for Computer Applications.

by permission. For subscription information, call (860) 875-2199, or Entire contents copyright ©2006 Circuit
Cellar Inc. All rights reserved.

FEATURE ARTICLE by Scott Armitage

Low-Cost 2.4-GHz Spectrum Analyzer

Forget dropping big bucks on a microwave spectrum analyzer.You can build your own for a
fraction of the cost. Scott walks you through the process of building an ATmega48-based
2.4-GHz spectrum analyzer.

I f you’ve shopped around for a stand how these transmissions relate to Even if you have more modest require-
microwave spectrum analyzer, you know your own communications. If you’ve ments, you must dig pretty deep into
that a basic unit costs around $3,000. ever had the experience of your Wi-Fi your wallet to acquire the right equip-
The prices shoot into the stratosphere network going down while you were ment. In the past, if you attempted to
from there. Wouldn’t it be great if you talking on your 2.4-GHz cordless phone, build low-cost, hobbyist-grade spectrum
could build a basic spectrum analyzer you know what I mean. analyzers, you probably ended up with
for, say, $50 in parts? Well, that’s If you’re like me, you’ve had the a bulky systems based on off-the-shelf
exactly what I’ll be describing in this experience of designing wireless systems modules like cable TV tuners, which
article (see Photo 1). without a means to debug transmissions. cost several hundred dollars.
Is the transmitter sending its signal at
WHY A SPECTRUM ANALYZER? all? Is it transmitting on the correct PC CHIPS TO THE RESCUE
As UHF and microwave RF designs frequency? Using your 100-MHz oscil- You can thank the Pentium processor
become more popular, you frequently loscope on this 2.4-GHz signal will get line (and other similar chips) for some
need to “see” what’s being transmitted you nowhere. My spectrum analyzer interesting new capabilities in wireless
or received. Most of us are used to can go a long way in helping sort out circuits. How does computer technology
observing signals in the time domain these problems. affect RF circuits? In the constant push
with an oscilloscope; however, most If you need to carry out calibrated, for smaller feature sizes and faster clock
oscilloscopes don’t have the bandwidth traceable measurements, or if you need speeds, chips for high-volume products
to see microwave signals. In addition, to look for harmonics of 2.4 GHz, there’s like PCs set the standard for the semi-
they aren’t much help in determining no substitute for a high-end spectrum conductor fabrication processes used
what a signal looks like in the fre- analyzer with its high-end price tag. throughout the industry. This benefits
quency domain. This is where spectrum However, many aspects of wireless other chip product lines because smaller
analyzers come in. design and the process of conducting features mean more capabilities at
In a perfect world, all radio transmis- site surveys don’t call for these features. lower costs. In addition, the faster cir-
sions would be free from inter- cuits needed for today’s PCs
ference from other devices oper- allow microwave frequency cir-
ating on the same frequency. In cuits to be integrated onto a sin-
reality, though, many wireless gle chip that in the past required
devices must coexist in the many external components.
industrial, scientific, and med- Examples of state-of-the-art
ical (ISM) bands. These portions low-power ISM band circuits
of the frequency spectrum are are the recent offerings from
allocated for unlicensed, low- companies like Xemics, Nordic
power, short-range operation. Semiconductor, and Chipcon.
Examples of devices operating on If you’re familiar with conven-
ISM bands are cordless phones, tional radio circuits, you’ll look
Wi-Fi networks, Bluetooth at Figure 1 and ask, “Where are
devices, and cordless mice for all the tuned circuits?” Unlike
PCs. If you’re designing a wire- conventional tuners like the
less system that must coexist venerable superhet with its big
Photo 1—The spectum analyzer consists of a small RF receiver circuit con-
with these potential sources of nected to a PC via a USB port. A custom Windows software application con- IF coils, these new frequency-
interference, you must under- trols the hardware and displays the spectrum. synthesized chips require virtu-

18 Issue 189 April 2006 CIRCUIT CELLAR®

Figure 1—The ATmega48 microcontroller (U1) controls the RF receiver’s (U2) functions. U1 is connected via a UART connection to USB bridge chip U3. J1 enables the micro-
controller to be programmed in-circuit.

ally no external parts other than bypass of the signal it’s finding at each fre- that makes this chip possible.
capacitors, a crystal, and (sometimes) an quency (usually referred to as received In addition to the CC2500, you need
antenna matching network. signal strength indicator, or RSSI). an embedded processor to control it. I
In spite of these semiconductor Chipcon’s CC2500 chip meets all of chose Atmel’s ATmega48, which has
advances, there are no dedicated, low- these requirements. 4 KB of flash memory and 0.5 KB of
cost spectrum analyzer chips on the The CC2500 is a low-power 2.4-GHz RAM (see Figure 1). Its SPI interface
market right now. But if a chip has the transceiver with a sophisticated packe- communicates with the CC2500. Its
right combination of features, you can tized data transfer and forward error UART allows data to be sent to and
use a radio chip intended for other pur- correction. Using the CC2500 is seri- from the ATmega48.
poses in your spectrum analyzer design. ous overkill for this application, Now that you’ve identified the hard-
The basic approach for a swept-tuned because you only need a receiver (not ware that will acquire the spectrum, you
spectrum analyzer is to tune a single- a transceiver). You don’t even need to need a user interface to control the hard-
chip radio receiver to a given frequency, demodulate and receive data. But, the ware and to display the results of your
measure the signal strength, tune to the benefit is that it has a sensitive receiv- spectrum analysis. Rather than trying to
next frequency, and so on until you’ve er with digital tuning and digital RSSI. reinvent an embedded system keyboard
acquired the signal strength at all fre- In case you’re wondering if such a and display, I decided to use a commer-
quencies in the spectrum. Plotting the powerful chip will fit your budget, cial PC. You could use a hand-held
spectrum is relatively straightforward how does $2 per chip sound? You can device such as a Pocket PC or a larger
after you have the data. thank all the people demanding cheap machine running a desktop operating sys-
PCs for the semiconductor technology tem. I used a laptop running Windows.
WHICH COMPONENTS? You also need a way to
To build my spectrum connect the PC to your
analyzer, you need a receiver microcontroller. Fortunately,
that’s sensitive to frequencies this is easier than it was a
higher than your range of few years ago. Silicon
interest (see Photo 2). If Laboratories (formerly
you’re like me, you’re Cygnal) makes a USB-to-
interested in the 2.4-GHz UART bridge chip called
ISM band, which extends the CP2102. Like the radio
from 2.40 to 2.485 GHz. receiver part of this design,
The chip must be digitally the CP2102 has a high
tunable. You also need a Photo 2—The spectrum analyzer circuit board includes a Chipcon CC2500 transceiver level of integration, requir-
way to know the strength chip. An Atmel ATmega48 processor and a CP2102 USB interface are also on board. ing only a couple bypass CIRCUIT CELLAR® Issue 189 April 2006 19

Photo 3—The accompanying Windows application displays the 2.4-GHz ISM band spectrum. The display updates
continuously.You can adjust the horizontal and vertical scaling as well as the center frequency and sweep speed.

capacitors. Just connect the CP2102 to my circuit includes a 200- to 50-Ω

the ATmega48’s UART and send serial balun to couple it to the CC2500.
data back and forth to the PC. In addi- The simple software that runs on
tion, the CP2102 has an on-chip voltage the ATmega48 passes commands from
regulator that you can use to power the the PC to the CC2500 and sends
rest of your circuit, so no batteries or responses back to the PC. This code,
power supplies are needed. Everything written in C, compiles to just 1 KB,
is powered from the PC’s USB port. well within the 4-KB flash memory
size in the microcontroller. I used an
PUT IT ALL TOGETHER ImageCraft ICCAVR compiler along
The PCB layout for this design is with Atmel’s AVR Studio programming
trickier than those for low-frequency tool, although other vendors’ tools
circuits. Pay special attention to the would work too. There is a six-pin
layout of the RF section containing the header on the board that’s configured to
CC2500 chip. use Atmel’s standard ISP programming
Chipcon provides a useful reference interface. This allows the ATmega48’s
design on its web site. I adapted flash memory to be programmed in-
Chipcon’s layout into a PCB that also circuit with a tool like the STK500 or
incorporates the USB and microcon- the AVRISP, both of which are avail-
troller functionality. The RF portion of able from Atmel.
the board has topside and bottom-side To help deal with the somewhat
ground planes for a solid RF ground. This complex 60-plus registers in the
enabled me to use a conventional two- CC2500, Chipcon offers free SmartRF
layer PCB. Like many other modern cir- configuration software, which helps
cuits, most of the chips I used were only determine the settings to program into
available in surface-mount packages. No its registers. For this project, I fixed
wire-wrapping allowed in this project! the receiver bandwidth at 843 kHz
The CC2500 is configured for a 200-Ω (the maximum that is supported). The
balanced antenna interface. This can CC2500 allows the center frequency
be directly connected to a suitable of its receiver to be set easily by defin-
PCB loop antenna. For better perform- ing channel spacing and channel regis-
ance, I used a whip antenna. In con- ters. The center frequency is equal to
junction with my 50-Ω whip antenna, the base frequency plus the channel

20 Issue 189 April 2006 CIRCUIT CELLAR®

number multiplied by the channel PUT IT IN PLAY
spacing. For this application, I set the The Low-Cost Spectrum Analyzer
base frequency to 2,400 MHz and the (LCSA) PC software is a 32-bit
channel spacing to 333 kHz. By setting Windows application that should run
the channel to a value between 0 and on any reasonably modern PC (see
255, I can tune the CC2500 over the Photo 3). It has modest memory
range of 2,400 to 2,485 MHz. This requirements. There is no special
covers the entire range of the 2.4-GHz installation process. Just double-click
ISM band. the LCSA icon.
Slightly complicating things is the Prior to using the software for the
fact that you must recalibrate the first time, you must install a driver for
CC2500’s signal-processing path each the CP2102 USB chip. This is easy in
time you change frequencies in your Windows XP. Let Windows’s Add
sweep. Rather than take the time to do Hardware wizard search the Internet
this during the sweep, my software pre- for a driver after plugging the spectrum
calibrates and stores the calibration con- analyzer into the USB port. Alternately,
stants. Later, during the actual measure- you can tell Windows to use the
ment sweep, the software transfers the Silicon Laboratories driver, which you
calibration settings back to the CC2500. may download from the Circuit Cellar
This enables the system to jump from FTP site.
one frequency to the next in as little as After plugging in the spectrum ana-
100 µs. A complete sweep of 250 meas- lyzer, installing the CP2102 driver,
urements can be done in 25 ms. In and running LCSA, the software
many cases, it’s preferable to sweep should immediately begin acquiring
more slowly than this so you don’t data and showing you the 2.4-GHz
miss intermittent signals. ISM band spectrum in real time. You
The CP2102 USB interface has driv- can open the Options dialog box to
ers that make it look like a built-in adjust the amplitude and frequency
serial port to any PC it is plugged into. scales. Toolbar buttons allow you to
Any PC-based software that can con- turn on and off Peak Hold, color
nect to a serial port can connect to the amplitude bars, and the white and
CP2102 just by pointing it to the cor- black backgrounds. The Save menu
rect COM port number. You need soft- item will export a comma separated
ware on the PC side to control this value (CSV) file of the currently dis-
serial port and graph the results. played spectrum.
I used Microsoft Visual C++ 6.0 to In the simplest situation, you can
create this PC software. Like its more perform a single sweep of the band
expensive test equipment counterpart, and see the spectrum almost instantly
my spectrum analyzer software enables on the screen. However, this works
control of the sweep speed, center fre- well only for continuous wave (CW)
quency, frequency span, and peak hold signals in which the spectrum is
modes. There is also a way to export always the same from one instant to
captured spectra to a spreadsheet for fur- the next.
ther analysis or plotting. You can also In most ISM communication proto-
write serial port code in Excel or some cols, the carriers are turned on and off
other data collection software instead of and/or hop to different frequencies
using the PC application I designed. during a transmission. Table 1 shows

Technology Modulation Channel center frequency Channels Channel Channel

bandwidth spacing
Wi-Fi (802.11b) DSSS 2,412–2,472 MHz 13 22 MHz 5 MHz
Bluetooth (802.15.1) FHSS 2,402–2,480 MHz 79 1 MHz 1 MHz
ZigBee (802.15.4) DSSS 2,405–2,480 MHz 16 3 MHz 5 MHz
Wireless USB DSSS 2,402–2,479 MHz 78 1 MHz 1 MHz
Cordless phones Varies 2,400–2,483 MHz Varies Varies Varies
Microwave oven Pulsed CW ~2,400–2,500 MHz – – –

Table 1—Check out how these transmitters operating in the 2.4-GHz ISM band (DSSS, FHSS, and CW) compare to
each other. CIRCUIT CELLAR® Issue 189 April 2006 21

some of the differences a) 0
make your microwave radios
between popular 2.4-GHz –10 work properly in the pres-
protocols. For protocols –20
ence of other signals in a
labeled as direct-sequence –30 crowded spectrum.

spread spectrum (DSSS) or –40
As I explained, my circuit
frequency-hopping spread –50 is designed for 2.4 GHz.
spectrum (FHSS), you –60 However, Chipcon recently
must use special tech- –70 released a pin-compatible RF
niques to get a true picture –80 transceiver (C1100) that oper-
of the frequency spectrum. –90 ates from 300 to 900 MHz.
If a transmitter is hop- –100 You can adapt my circuit to
ping between different fre- 2,400 2,410 2,420 2,430 2,440 2,450 2,460 2,470 2,480 perform spectum analysis for
quencies as you are scan- the UHF ISM bands using
ning across the frequency 0 the CC1100. I
spectrum, you might miss –10
a transmission at a partic- –20
Author’s note: You may
ular frequency if you are –30
order a bare circuit board for

monitoring a different fre- –40

this project or a completed
quency at that moment. –50
and tested spectrum analyz-
For this reason, the micro- –60
er at
controller can be instruct- –70 /LCSA.html.
ed to over-sample several –80
times at each frequency
and save the highest value 2,400 2,410 2,420 2,430 2,440 2,450 2,460 2,470 2,480 Scott Armitage (scotta@dune
it finds at each frequency. Megahertz owns Dunehaven
This is controlled by the 0 Systems, which is based in the
Sweep Time parameter in –10 Minneapolis area. He provides
the PC software applica- –20 hardware and software con-

tion. Slower sweep speeds –30 sulting services to many com-

–40 panies, primarily in the areas
mean more samples are
acquired at each frequen- of medical product design and
cy in the hopes of moni- embedded systems. To e-mail
toring that frequency Scott, type “Circuit Cellar” in
when the transmitter is –90
the subject line to get past the
transmitting on that fre- –100
spam filter.
quency. 2,400 2,410 2,420 2,430 2,440 2,450 2,460 2,470 2,480
In practice, you’ll try to Megahertz
strike a balance between Figure 2a—Even at a distance of 30′, the sensitive receiver can detect a signal leak-
sweeping so fast that trans- ing from a microwave. Such signals can disrupt Wi-Fi communications in the area. To download the code and
missions are missed and b— The spectrum of a 802.11b access point operates on channel 9. The 22-MHz trans- additional files, go to ftp://
mission centered at 2,452 MHz is visible, as are some side lobes. c—Take a look at
sweeping so slowly that the spectrum of a Bluetooth-enabled PDA searching for nearby devices (a so-called
the transmission ends Circuit_Cellar/2006/189.
“inquiry sequence”). During an inquiry, a subset of the 79 possible Bluetooth channels
before the sweep is com- are used. The channels are visible as peaks in the spectrum.
plete or that the screen SOURCES
updates become too sluggish. shape of the spectrum to be accumu-
ATmega48 Microcontroller
Typically, you’ll need to capture the lated after many sweeps of the fre-
Atmel Corp.
spectrum for somewhere between a quency band. The maximum ampli-
few seconds and a minute to com- tudes at each frequency in the spec-
pletely acquire a pulsed spectrum. trum are saved until Peak Hold mode CC2500 Multichannel RF transceiver
Alternately, the spectrum analyzer can is turned off. Chipcon
be put into Zero Span mode, during
which it rapidly refreshes the ampli- RESULTS ANT-2.4-CW-RCT-RP Antenna
tude at one particular frequency. I made the charts in Figure 2 in
Linx Technologies, Inc.
In addition to adjusting the sweep Excel after exporting the spectrum
speed, you can remember the highest data from the Windows software
value you have found at each frequen- application. Hopefully, you can CP2102 USB-to-UART Bridge
cy. This is done by using the Peak appreciate how useful scans like Silicon Laboratories, Inc.
Hold feature, which allows the true these can be when you are trying to

22 Issue 189 April 2006 CIRCUIT CELLAR®