SAN2PC : a Spectrum Analyzer to PC interface
(Updated April 30, 2010)

Introduction
Hardware Software Download Screenshots FAQ



April 30, 2010 : Here is a worthwhile contribution provided by Buck KC2HIZ :
- How to use the VASD1 S5 D12 DC/DC converter.
- A modification of the Drawsan program.



A full description of  this interface was presented in the November/December 2007 issue of the ARRL magazine QEX ("SAN2PC : a Spectrum Analyzer to PC interface", Roland CORDESSES, F2DC, QEX November/December 2007, issue No. 245, pp 24-29).

Click here to download this article (2.3 Mb pdf file), with permission of ARRL.


Introduction
.

The Spectrum Analyzer (SA) is an incredibly useful tool to the homebrewer. Unfortunately, it is very expensive when purchased new, so the SAs found in the workshops of many hams are of the secondhand type, or even home built. As a result, they often lack functionalities available on more modern equipments. For instance:
- It is not possible to store the displayed spectrum in a file for later computer processing.
- Getting a hard-copy of the displayed spectrum is not an easy job: Dedicated cameras are scarce and expensive and X-Y plotters cumbersome.
In order to solve these two points, I have recently designed and built a simple interface to connect my spectrum analyzer to a PC. This unit, named SAN2PC, digitizes analog spectrum data, then processes and transmits that data to a Personal Computer via the RS232 line.
SAN2PC automatically takes care of the spectrum analyzer scan time.
Any terminal program can be used to receive and store RS232 data in a file. This file can be processed afterward, or simply read by any spreadsheet program: The spectrum can then be displayed on the PC screen and a copy printed if needed.
SAN2PC has been tested on my HP141T analyzer,  but I think it could be used with other models and brands, insofar as they have analog spectrum voltage and pen lift signal output connectors. Limited tests have been conducted on a Tektronix 2755P.

I have also written a dedicated software (in the Python language) displaying not only the spectrum, but also the spectrum analyzer's settings (center frequency, scan width, bandwidth, etc...) on the PC screen. This picture can be stored in a file for future use or printed. The program runs under Windows XPTM and has been tested under Linux (the Python software I developed is not limited to the WindowsTM  world).

- The picture below is a view of SAN2PC,  easily standing on top of the HP141T : the W(aiting) and S(ampling) are LEDs showing activity of the interface, the N/C is a switch selecting Normal or Calibrate mode, and the red button on the right is the Start control (click on the pictures to enlarge).

       

- This is a look inside the unit : the PIC 18F2525 is in the center, the analog section on the left and the RS232 interface on the lower right.




- The rear panel below shows, from left to right, the power supply jack, the 2 coaxial cables connecting SAN2PC to the spectrum analyzer, the Baud rate switch and the RS232 connector.




1. Circuit description.

The heart of the circuit is a PIC 18F2525 processor associated with a simple analog interface : Click here to get the schematic diagram
SAN2PC is connected to the Vertical Output and Pen Lift Output connectors of the S.A (most  analyzers of the kind we are talking about have such output lines, usually intended for connection to an X-Y plotter).
As soon as the Pen Lift  Output is active (generally a high to low transition), ie, during the S.A sweep time, the Vertical Output signal is sampled  by the PIC internal Analog to Digital Converter until the end of the Pen Lift active state. The sampling period is automatically computed by the PIC from the Pen Lift duration.
About 1000 samples are stored for each S.A sweep time and then transmitted to the PC via the RS232 line.
- Remark : This 1000 samples number leads to an operating limit : when the ratio of the analyzer settings K = TotalScanWidth/Bandwidth is lower or equal to 1000, the RF level measured by SAN2PC is OK. When K becomes larger than 1000, the probability of sampling outside the spectrum amplitude peaks increases, thus leading to amplitude errors. 
March 4th, 2009 : A new software, SAN2PC rev 2.00, with more than 3000 samples/scan, is now available  Click here for more information

Construction :
- the circuit is built on a dual sided PCB, the upper (components side) remaining unetched while the lower (solder side) is etched using the artwork mentioned. The upper side is thus used as the ground plane (see the above inside picture). As most components pins must be insulated from ground plane, I use a large drill (6 mm or more) to remove copper around holes not connected to ground.
The photo below is a close-up of two insulated holes (upper part of the picture) and a grounded hole (lower part).


==> The PCB and  pre-programmed PIC are available from Far Circuits

- the file san2pc_gnd_holes.png shows the "grounded holes" and the two wire straps (in red).
- all components are regular ones except for R7, R8, R13, R14, R16 and C13, C14, C15, C16, C36, C37 which are SMDs and are soldered on the lower side of the PCB.
- the DC/DC converter (TMA0512D) is a low cost Single In Line Package made by "TRACO POWER", available from FarnellRadioSpares or other distributors. You could use an other type, but be sure that the pinout is the same : on some SIP converters, pin 4 (-Vout) and pin 5(Gnd) are swapped!
==> As mentioned in the QEX article, if the Vertical Output voltage of your analyzer is unipolar (positive or negative only), you could use a TS272 op amplifier (or equivalent), powered by a single supply (+6.6V), instead of  the TL82 and omit the DC/DC converter U7, the negative regulator U3 and its related components and the protective diode D7. Don't forget to connect U4A pin 4 to the ground plane.

Download the  PCB design (san2pc_w3c.pdf)  by clicking here. (This is a top side view)
The components layout is shown (san2pc_w3c_lay.pdf)   in this PDF file.

- An equivalent DC/DC converter available from Digikey  (part number is 102-1340) can be used instead of the TMA0512D : it is the V Infinity VASD1 S5 D12 .
Important note : Buck KC2HIZ tried it but had to use 1 uF in place of the 10 uF capacitors C1 and C2 connected at the + and - 6.6V converter outputs. 
Thank you for the information Buck.

- Joop, PE1CQP points out that the MAX232 needs 1uF capacitors : he is right. The chip I use in my own SAN2PC is a MAX232A and not the MAX232  shown in the schematic diagram. The MAX232A works well with 0.1uF caps. Thanks Joop.

2. Software.

2.1.1 The PIC embedded software.

The PIC program, named  san2pc.c,  is written in C language for easier development and debugging. I used the compiler proposed by Custom Computer Services (CCS). This compiler is easy to use and a lot of useful tools, as well as sample programs, are available as part of the package.
Programing the PIC was done with an home made programmer inspired by the ProPIC2  and using the WinPIC800 software.
==> The 1000 points  software revision  is  san2pc112.hexclick here to download it  and  Click here  to download the SAN2PC User's Guide (rev112_2).

2.1.2 A new improved SAN2PC rev 2.00 is now available (March 2009).

As above-mentioned, the 1000 samples number leads to an operating limit, when the ratio of the analyzer settings K = TotalScanWidth/Bandwidth is larger than 1000.
We can increase the samples number to mitigate this issue : however we are limited by the size of the PIC internal SRAM (#3900 bytes) and by the data transmission time from SAN2PC to the associated computer. 
Thus I modified the SAN2PC file format as follows :
- The samples number is now around 3000 points, compatible with the available PIC internal memory.
- There are no more any frequency information associated with each sample : each frequency is computed by the Drawsan program from the start and stop frequencies found in the header data : we thus save a lot of transmission time.
- The amplitude data for each frequency is now the A/D generated byte and not the RF power in dBm, thus saving transmission time too.
- The file format being different of the one generated by the first revision SAN2PC (e.g 1.14 and earlier) , Drawsan must have a way to know if  the file processed is a new or an old type. The header of the new data files is preceded by the figure '2' to point out that it has been generated by  a rev. 2.0x SAN2PC software.
- Because of the larger samples number, it is necessary to select a Spectrum Analyzer ScanTime/div equal or greater than 10 ms before running SAN2PC.

Click here to download the new 3000 points san2pc200.zip file  and  Click here to download the new SAN2PC  User's Guide rev 2.00_2

2.2.1 The PC plotting software.

The plotting program named Drawsan relies on the header of the file sent by san2pc via the RS232 line and stored on the PC hard disk : this header includes main analyzer settings (Reference Level, Center Frequency, Scan Width,...). I chose to write it in the Python language mainly because of the availability of a first class graphics library, Matplotlib available from the Sourceforge site.
This library emulates MatlabTM commands (but does not require MatlabTM) and creates very nice plots. The drawsan user has the opportunity to save the picture as a png, pdf or other formats file. 
==>
The 1000 points revision is drawsan114.zip (click here to download it)
- I would like to acknowledge Joe HOPSTER WB8DNO who wrote the interpolated frequency computation . 

Important note : Before using drawsan.py, you must install Python of course, but also the Matplotlib and Numpy libraries. 
==>
A Python Installation and Drawsan user's Guide (rev 2.2)  is available (Click here to download)   

2.2.2 The new Drawsan rev. 2.00.1 (April 2009).

This new version works only with 3000 points files created by the new SAN2PC rev. 2.00 and the user is warned if he tries to process an old file type with this new Drawsan.

Click here to download  the drawsan200_1.zip file

April 2010 : Contribution of Buck KC2HIZ : He wanted a way to perform several captures on the HP141T and then process them in a batch, without having to specify file names and 'save as.'
Thus he modified the Python source code and gave me the authorization to propose his work (Drawsan 2.01B) to other interested people. His batch file is included in the zip file.  Thank you very much Buck !!! Click here to download his Drawsan201B-Batch.zip

==> Your comments about the new SAN2PC and Drawsan programs are welcome !

Comparison : The pictures below show the same signal (Analyzer settings : Total Scan Width = 50MHz and Bandwidth = 30kHz ,  thus K # 1666) processed by the new SAN2PC 2.00/Drawsan 2.00  programs (on the left) and by the old ones (on the right). With the new method, there is no amplitude underestimation compared to that observed on the right (the first and second peaks on the right picture are 2 dB lower, while the third is 5dB lower, etc...).

                                              


February 2009 :
Important note about Python 2.6 : a new version of the Python language (V.2.6.x) is available since the beginning of 2009.
Unfortunately, the old version of Numpy (V.1.2.x) used with Matplotlib doesn't work with Python 2.6.x
Thus please, don't use Python 2.6.x until the new Numpy is available !

A Matplotlib tutorial is available at  : http://matplotlib.sourceforge.net/users/pyplot_tutorial.html

In order to check that your Python, Matplotlib and Numpy are ready to go, I strongly suggest you download (click here) the "A simple program" file and use it  before running drawsan.py.
When this little program works, you can start drawsan : if you don't have any spectrum data file, you can download the test1.zip file.


Sample pictures of  spectra plotted with drawsan.py are shown below (click on the pictures to enlarge).
The analyzer settings are automatically displayed in the upper part of the picture.

   

    

3. Download.

- QEX article (2.3 Mbytes PDF).
- Schematic diagram.
- PCB artwork.  (san2pc_w3c.pdf)
- Components layout. (san2pc_w3c_lay.pdf)
- Grounded holes and wire straps. (san2pc_gnd_holes.png)

- PIC Hex file. (san2pc112.hex)  (Nov. 26, 2007)
- SAN2PC User's Guide rev 1.12_2 (
==> updated : Jan. 29, 2010)

- New SAN2PC200.hex PIC zip file. (March 2009)
- New SAN2PC User's Guide rev 2.00_2
 (==> updated : Jan. 29, 2010)

- How to install Python and use Drawsan Guide (rev. 2.2) (450 kbytes PDF)
- Drawsan114.zip  Python program. (April 19, 2008)
Python program Drawsan200.1 zip file  (April 27, 2009)
- New : Drawsan 201B_Batch.zip courtesy of Buck KC2HIZ (April 30, 2010)
- Simple program Python test file
- Test1.zip file


4. FAQ
Not available now.

Conclusion.

This simple interface may help to solve the hard-copy problem associated with many secondhand spectrum analyzers. It also provides the user with a file for subsequent computer processing.
It could be probably used with others equipments, like network analyzers, that don’t have any printing function but only analog output connectors.



 Home