SERIAL PORT ANALOGUE TO DIGITAL CONVERTER FOR DSP ON PERSONAL COMPUTERS

Andy Talbot  G4JNT   and   Lee Wiltshire G0IAY    September 1996

INTRODUCTION

This note describes a simple interface for Personal Computers which has been designed primarily as a means for digitising audio and downconverted RF signals in order that Digital Signal Processing routines can be implemented on the PC.  It is optimised for either audio output from an SSB receiver with a upper frequency limit of around 3.4 kHz or the output of a 73 kHz LF direct conversion receiver where the signal is converted with a 70kHz local oscillator to the range 1.6 -  4.4 kHz.  The original idea was to use undersampling techniques on a well bandpass filtered 71.6 - 74.4 MHz signal with no separate downconversion hardware; the mixing function being inherent in the undersampling process with an effective downconversion of 7 x the 10 kHz sampling frequency..  At the time of writing this has not been implemented for off-air signals.


DESCRIPTION

The interface to the PC is via the serial COM port, this has been chosen as opposed to the potentially faster printer port for several reasons. Drivers for COM ports are available in most high level languages and these usually provide buffer memory for storage of  input data.  The timing information is inherently carried on the serial word by virtue of its being at a constant baud rate rather than having to use the PC to generate timing information in uncertain delay loops.  Earlier versions of this interface used an A/D converter on the printer port and it was soon found that a major part of the DSP software was tied up with signal timing overhead.

An 8 bit A/D converter is employed which theoretically gives an inherent limit to the digitised signal to noise ratio of around 40 dB (6 . N dB  - a 'fiddle factor').  It is possible to improve on this in software by averaging and decimation techniques but 40 dB is adequate for most basic signal processing applications; the recovered audio from typical amateur SSB receivers is frequently worse than this.

Two sampling rates are available - 10 kHz is used for downconverted RF (and undersampling of the 73 kHz band) with an allowed upper frequency limit of 5 kHz, ie anti-aliasing filters must provide at least 45 dB rejection for frequencies higher than 5 kHz.  This timing rate is exact allowing precise determination of frequency.  Alternatively a sampling rate of 7142 Hz (actually 1 / 140us) may be selected.  This is optimised for the audio output of SSB receivers where the IF filter provide almost brick wall attenuation of frequencies outside the 300 - 3400 Hz range.  These two sampling rates have a convenient (2 relationship so that by post averaging a continuous selection of sampling rates is available.



HARDWARE

This is designed around a PIC16C71 micro-controller chip which includes an on board 8 bit A/D  converter.  Figure 1 shows the circuit diagram.   By using a 4 MHz crystal, an instruction cycle of 1us is available which means that a loop exactly 100 cycles long is needed for 10 kHz sampling. A baud rate of 115200,  the maximum with which the PC can cope, is adequate for this sample rate since the whole word of 11 bits (1 start, 8 data 2 stop) can be sent in 95.5 us.

The data from the A/D converter is formatted into RS232 format of 1 start bit followed 8 data bits plus a stop interval consisting of the remainder of the loop time.  When 7142 Hz sampling is used, the loop is increased to 140 cycles in length.  The PIC software is kept simple with no subroutines and a minimum of jumps.  The delays are generated by NOP commands plus the time taken by the A/D read and RS232 formatting instructions. This leads to 0.5us jitter on the RS232 bit timing but this is well within the specification and no problems have been seen. The sampling rate is determined by reading the state of one of the PIC data lines, this is read continuously and the rate may be altered at any point during operation.

The PIC A/D converter needs an input in the range 0 - 5V and an op-amp is employed to give the level shifting and gain to suit typical audio drive levels of 10 - 100 mV.  The current consumption of both ICs is sufficient to allow them to be powered from the RS232 port with no need for a separate power supply, thus making a very compact unit which could be constructed as a module that plugs directly onto the COM port.

RS232 interfacing uses only the range 0 - 12 V; all modern PC serial interfaces can cope with this restricted signal voltage range and thus the need for special RS232 drivers and negative voltages is removed.  The two prototype units both worked satisfactorily  with a 10m RS232 cable between them and the PC although the interface was not designed with this in mind; a long audio cable is the preferable solution.

A single sided PCB employing through hole construction has been designed and the layout of this is given in figure 2.

Software for the PIC as well as the DSP software described below is available from G4JNT or G0IAY free of charge on receipt of a SASE and blank formatted disc.   Alternatively the software can be sent by EMail, contact either of the addresses below.

Programmed PICs are available for 8.00 each from the same source.  A limited number of undrilled PCBs could possibly be made on an individual basis, but please enquire before requesting these.


SIGNAL PROCESSING SOFTWARE

Currently programmes are available for the following functions.  All are written in Power Basic and have been tested on 486 66MHz and faster machines.  486 33MHz and the faster 386 machines may prove adequate although it might be necessary to keep to 7kHz sampling rate.  The programmes must be run  only in DOS, as the timing overhead used by Windows can cause the programme to lose data.  The routines have not been tested on Windows NT or '95. 

The programmes are in the public domain and all source code is available.  If any code is changed, converted to other languages etc. then please change the name of the programme to avoid confusion.


SPECDISP

Provides a straightforward spectrum display of received data.  Decimation (averaging) of the received data  allows sampling rates at submultiples of the basic rate to be used with an increase in the potential resolution.  Averaging of the frequency / power spectra allows further improvements in resolution.   Various display options such as log / lin as well as the averaging and decimation function can be altered during display.  The Fourier transform size can be selected between 32 to 8192 bins allowing frequency resolutions down to 0.87 Hz at basic sampling rates and lower with decimation of the input data.

PEAKSEAR

Similar to SPECDISP but includes routines to search for the peak signal in the displayed band and calculate its frequency and signal to noise ratio.

WFALL16

Gives a continuous time - frequency (waterfall) display with signal magnitude being represented by colour.  16 colour mode allows the full VGA resolution of 640 x 480 to be employed, but some juggling of the colour threshold and scaling is required to optimise the display for differing signal types and amplitudes.  

WFALL256

A colour waterfall plot employing the lower resolution but faster 256 colour mode.  Full scrolling of the screen is possible here, allowing pseudo real time off air spectra to be continuously observed.  It is possible to discern 1 WPM CW in less than 10 Hz bandwidth using this mode.

RDBLKFI

Stores raw digitised data to a disc file for subsequent off line analysis

WFLFI

Takes the stored data and gives a time/frequency/amplitude waterfall or 3d plot.



Contact Points

A C Talbot   G4JNT				L Wiltshire  G0IAY
15  Noble Road 				4 Cloverfield 
Hedge End					Lychpit
SO30 0PH					Basingstoke

Tel 
 01489 787424				0973 136008

Email
drassew2@interalpha.co.uk			leew@cylink.co.uk
(note change to that published
inRadCom)
