Friday, December 13, 2013
2 4GHz WiFi ISM Band Scanner Firmware and Sowtware Part 2
2.4GHz WiFi & ISM Band Scanner. Description and Schematic Part 1
PIC Firmware
The firmware running on the PIC18F2550 was written for the CCS C compiler and uses the CCS USB protocol stack, which in turn appears to be derived from Microchip code. At the top level it is quite simple, it just repeatedly steps through the frequency range taking readings.
For each frequency it takes repeated readings until it gets what seems to be a consistent value. It then saves that value and moves on to the next frequency. When it has finished running through the band it sends off all readings to the computer over the USB. The CYWUSB6935 chip steps 1MHz at a time and the band is 85MHz wide, so the number of readings sent to the computer is 85. Despite the repeated measurements needed to get a consistent reading the chip achieves quite a good performance, about 4 complete spectrum scans every second.
The firmware and source code for the 18F2550 is available from the download section below.
Windows Software
The software running on the computer was written in Visual Basic 5. It is not particularly sophisticated, for example it keeps polling the USB interface to see if new data has arrived and that uses up a lot of CPU time. But, you dont generally use the scanner for a lot of time and you would not normally be running computer games at the same time, so this inefficiency is not of great importance.
The software on the computer saves the set of readings into an array. When it comes to drawing the spectrum display on the screen it steps through all the saved readings for each frequency looking for the highest reading, and it is that highest reading that it draws on the screen for that frequency. As a new reading is received the oldest reading in the array is discarded. The slider on the screen controls how many readings are saved for each frequency, the default is 350 readings which represents about 90 seconds of data.
All this means that the delay has a "memory" and one high reading will hang around for 90 seconds until it is flushed out. This is done because devices normally hop around in frequency and it would be hard to see what frequencies were popular unless there was some way of holding on to the reading for a while. You can see this in action when there is a noise spike. That spike would remain on the screen for (say) 90 seconds then disappear. But a device that communicated on that frequency (amongst others) would in most probability revisit that frequency within the 90 second period and that would place a new high value into the array of values for that frequency.
By adjusting the slider you control the size of this array and consequently the amount of time that it would take to flush a reading out. Smaller numbers flush more quickly, larger ones take more time. You can pause the display by clicking on the Pause button. Clicking on it again will clear the array and start a new collection. This is also a handy way of clearing everything to restart with a fresh display.
The Export button will export the current set of readings to a .csv file which can be loaded into a spreadsheet like Excel.
As usual, the software and source code is available for download below.
C# Version of the Software
A reader, Jim McCullers in the USA, took up the challenge of porting the desktop software to a more modern environment. The code he wrote compiles under Microsoft Visual C# 2010 Express (the free version) and is also available for download below.
He did not make any major changes to the structure or look but created a new version of the MPUSBAPI to suit C# and made it into a class. The mpusbapi.dll module must be in the same directory folder as the executable so you will notice that he has copies in both the debug and release folders.
Plugging It In
Because the scanner uses standard USB it can be connected to any computer, although the software is written only for Windows XP, Vista and Windows 7.
Before you plug the scanner in you must install the software first. This is available in the download section below. Failure to install the software first will result in Windows identifying the scanner as an "Unidentified Device".
During installation of the software a device driver is installed and it is this that helps Windows identify the scanner. After you have correctly installed the software and plugged in the scanner you should see the device show up under "Other Devices" in Device Manager as shown on the left.
When you fire up the desktop software (ISMScanner.exe) you should see the message in the software window stating "Connected to Geoffs 2.4GHz Scanner". If you get "Scanner not found" then the scanner is not plugged in or not working.
The firmware running on the PIC18F2550 was written for the CCS C compiler and uses the CCS USB protocol stack, which in turn appears to be derived from Microchip code. At the top level it is quite simple, it just repeatedly steps through the frequency range taking readings.
For each frequency it takes repeated readings until it gets what seems to be a consistent value. It then saves that value and moves on to the next frequency. When it has finished running through the band it sends off all readings to the computer over the USB. The CYWUSB6935 chip steps 1MHz at a time and the band is 85MHz wide, so the number of readings sent to the computer is 85. Despite the repeated measurements needed to get a consistent reading the chip achieves quite a good performance, about 4 complete spectrum scans every second.
The firmware and source code for the 18F2550 is available from the download section below.
Windows Software
The software running on the computer was written in Visual Basic 5. It is not particularly sophisticated, for example it keeps polling the USB interface to see if new data has arrived and that uses up a lot of CPU time. But, you dont generally use the scanner for a lot of time and you would not normally be running computer games at the same time, so this inefficiency is not of great importance.
The software on the computer saves the set of readings into an array. When it comes to drawing the spectrum display on the screen it steps through all the saved readings for each frequency looking for the highest reading, and it is that highest reading that it draws on the screen for that frequency. As a new reading is received the oldest reading in the array is discarded. The slider on the screen controls how many readings are saved for each frequency, the default is 350 readings which represents about 90 seconds of data.
All this means that the delay has a "memory" and one high reading will hang around for 90 seconds until it is flushed out. This is done because devices normally hop around in frequency and it would be hard to see what frequencies were popular unless there was some way of holding on to the reading for a while. You can see this in action when there is a noise spike. That spike would remain on the screen for (say) 90 seconds then disappear. But a device that communicated on that frequency (amongst others) would in most probability revisit that frequency within the 90 second period and that would place a new high value into the array of values for that frequency.
By adjusting the slider you control the size of this array and consequently the amount of time that it would take to flush a reading out. Smaller numbers flush more quickly, larger ones take more time. You can pause the display by clicking on the Pause button. Clicking on it again will clear the array and start a new collection. This is also a handy way of clearing everything to restart with a fresh display.
The Export button will export the current set of readings to a .csv file which can be loaded into a spreadsheet like Excel.
As usual, the software and source code is available for download below.
C# Version of the Software
A reader, Jim McCullers in the USA, took up the challenge of porting the desktop software to a more modern environment. The code he wrote compiles under Microsoft Visual C# 2010 Express (the free version) and is also available for download below.
He did not make any major changes to the structure or look but created a new version of the MPUSBAPI to suit C# and made it into a class. The mpusbapi.dll module must be in the same directory folder as the executable so you will notice that he has copies in both the debug and release folders.
Plugging It In
Because the scanner uses standard USB it can be connected to any computer, although the software is written only for Windows XP, Vista and Windows 7.
Before you plug the scanner in you must install the software first. This is available in the download section below. Failure to install the software first will result in Windows identifying the scanner as an "Unidentified Device".
During installation of the software a device driver is installed and it is this that helps Windows identify the scanner. After you have correctly installed the software and plugged in the scanner you should see the device show up under "Other Devices" in Device Manager as shown on the left.
When you fire up the desktop software (ISMScanner.exe) you should see the message in the software window stating "Connected to Geoffs 2.4GHz Scanner". If you get "Scanner not found" then the scanner is not plugged in or not working.
Downloads
Firmware - HEX programming file v1.0, Firmware - source code v1.0 - download
Windows software v1.0 Installation (Visual Basic Version), Windows software v1.0 Source code (C# Version), Windows software v1.0 Source code (Visual Basic Version), Windows driver for Vista and Win 7 32/64 bit systems - download
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.