Have you ever wondered exactly what is going on in the 2.4GHz WiFi and ISM band around your house. What channel is it best to set your wireless router to? Why are you getting such poor performance across your WiFi network? Is your neighbour on the same frequency?
Just what is out there? This neat little gadget will sniff the airwaves and give you a graph of the signal strength vs frequency across the entire band. It connects to your computer by USB 2.0 and with the companion Windows software you can display the spectrum or save the raw data to an Excel compatible file for some more number crunching.
It uses just two significant components, a radio module from Cypress Semiconductor and a PIC microcontroller from Microchip. Total cost to build it should be less than US$30.
The 2.4GHz Band
The 2.4GHz ISM (Industrial Scientific Medical) band is often called the WiFi band because it is used for WiFi networking (ie, 802.11 b/g/n). This band is unlicensed, meaning that you and anyone can transmit on it. As a result it has been used by a multitude of products including video transmitters, portable telephones, Bluetooth devices, wireless keyboards, toys and so on. Because you cannot see what is going in the band on you can experience strange behaviour from your wireless gadget. All of a sudden your wireless keyboard skips characters, is it because someone is using a portable phone on the same frequency?
The biggest victim is WiFi networking. This needs a lot of bandwidth, is always transmitting and is sensitive to interference. This is why people often cannot get a decent range from their wireless network and give up in disgust.
This scanner will draw a graph on your computer screen showing you the activity across the band and indicate the best frequencies to use. If you use a laptop you can also wander around and identify the culprits that are clogging the airwaves.
How It Works
Internally the scanner is very simple. It just contains a radio receiver and a microcontroller…
The radio receiver is the Cypress CYWUSB6935 Radio SoC (System on a Chip). This is a complete low power radio transmitter/receiver chip for the 2.4GHz band and is controlled by a microcontroller over a synchronous serial (SPI) interface. The microcontroller can write to various registers in the chip to set things like operating frequency and can read other registers to retrieve data from the chip.
This chip is designed to operate over the 2.4GHz band and has the ability to listen on a frequency for any other devices that may be already using the frequency. This is to help the microcontroller select a suitably free frequency before transmitting. The chip reports the signal level as a number typically up to 30, with zero representing no signal. We use this facility in this project - simply put, the microcontroller instructs the module to step to a frequency and measure the signal level at that frequency, when done it steps the chip to the next frequency and instructs it to measure the signal level there. And so on, right across the band.
We actually do not use the transmit/receive function, which is normally the chip's main purpose in life.
The microcontroller used in this project is the Microchip PIC18F2550 which integrates the complete USB 2.0 functionality. The microcontroller sets the radio chip to a frequency, reads the signal level from the chip, stores the value in its internal memory and steps on to the next frequency. This continues until the complete 2.4GHz band is covered. The 18F2550 then sends the data off to your computer using USB and your computer, using custom software, displays the resultant spectrum.
Physically the scanner is just a small box hanging on the end of a USB cable.
The Circuit
The circuit is the simplest part of this project. Click on the image or go to the download section at the bottom of this page for a full scale drawing.
The PIC 18F2550 microcontroller is a 28 pin part with a built in USB 2.0 interface. As mentioned before, the chip integrates everything connected with the USB including a 3.3V regulator, memory buffers and the USB transceiver. All that you need to do is to connect the USB cable to pins 15 and 16 of the chip and place a capacitor on pin 14 to help smooth the inbuilt 3.3V supply.
The clock for the microcontroller is derived from the 20MHz crystal with the two 15pF capacitors providing the correct loading for the crystal. Internally within the 18F2550 the 20MHz is divided by 5 to give 4MHz and then used to synchronise a phase locked loop (PLL) oscillator running at 48MHz. This is the main clock used within the microcontroller and is used to drive both the USB interface and the CPU. Running at 48MHz this is a speedy little chip so we do not have any issues with performance.
The ISCP connector is there so that I could reprogram the 18F2550 without pulling it out of its socket. It is mostly used for prototyping so you can leave it out if you want. Note that the 10K resistor on pin 1 of the 18F2550 is still needed to pull the reset line high.
Power for the circuit is drawn from the +5V supplied by the host computer on the USB cable. The whole circuit only draws a few tens of milliamps so it is not a significant load. This 5V is dropped to about 3V by three 1N4001 diodes to provide power for the Cypress CYWUSB6935 chip which is mounted on a small PCB (the CYWM6935 module). Each diode will drop about 0.7V resulting in a total voltage drop of about 2V. This is a crude way to derive a 3V supply but it is low cost and does the job without any hassles.
The CYWUSB6935 chip has protective diodes on its inputs, which clamp the signal line to its power supply (3V). This means that we can drive it with 5V signals from the microcontroller with series resistors to limit the current. This is the purpose of the 3.3K resistors, they limit the current in the clamping diodes to less than a milliamp when the PIC's output goes to 5V.
CYWM6935 Module
The CYWUSB6935 chip comes in a tiny package designed for machine assembly and is virtually impossible for a mortal wielding a soldering iron to solder. Fortunately Cypress have assembled it into the CYWM6935 module along with two aerials, a crystal and a few capacitors. The connector used in the module is still rather tiny and non standard (or rather it does not use the 0.1" grid that we know and love), but it can be soldered to. For details of the CYMUSB6935 chip and CYWM6935 module go to here.
Parts Listing
- 1 x Microchip PIC18F2550-I/SP microcontroller programmed with the firmware available in the download section at the bottom of this page.
- 1 x Cypress CYWM6935 radio module,
- 1 x 20MHz crystal
- 3 x 1N4001 silicon diodes
- 4 x 3.3K resistors (quarter or half watt)
- 1 x 10K resistor (quarter or half watt)
- 2 x 15pF ceramic capacitors
- 1 x 100nF multilayer ceramic capacitor 1 x 220nF polyester capacitor
- 1 x 100uF electrolytic capacitor (6V or higher)
- 1 x 28 pin IC socket
- 1 x USB cable with a type A connector on one end
- 1 x UB5 jiffy box
Part 2 - Firmware and Sowtware