CW radar using Red Pitaya
This post documents the procedure from acquiring noisy, distorted CW radar data through drawing conclusions for the next steps in Red Pitaya radar development.
1. Read data
Read the data into the computer memory appropriately. GNU Radio complex is single-precision float, marshaled as real/imag pairs of 4 byte floats.
- Matlab: read GNU Radio complex data with read_complex_binary.m that reshapes and casts the data appropriately.
- Python:
numpy.fromfile(filename,'complex64')
An example command from the piradar
program is
./PlotSpectrum.py exercise.bin 100e3
where we see the 60 Hz periodic interference, which we model in the next section.
If the sinusoids are not clearly and cleanly present, or the audio playback doesn’t sound like a pure sinusoid, something is very wrong–stop at this point and fix the problem.
2. Understand signal defects
Signal defects may come from software and/or hardware.
They may have subtle or visible effects.
An empirical model was created based on the appearance of ADC clipping in the time and frequency domain in the piradar
program SimADCclipping.py
./SimADCclipping.py
This model gives the basis to build filters suitable for preprocessing before using subspace estimation of close-spaced CW sinusoids typical to CW radar with Red Pitaya or any other such instrument. Without filtering, the subspace estimator homes in on the forest of 60 Hz “fake” targets.
3. Filter (pre-process) raw signal and down convert
One can create remarkable filters in the simulation or analytic space. Whether they can be realized in a real system depends on the CPU/FPGA power available in the real system and if they require excessively precise frequency/phase control and the like. Here’s let’s assume we can use a FIR filter with order 4096 taps to reduce signals greater than +/- 60 Hz from the CW radar center frequency by about 20 dB and much more reduction beyond that. The center frequency chosen is for a radar baseband center frequency of 10 kHz.
./FilterDesign.py 9950 10050 100e3 -L 4096 -m firwin -o cwfir.asc
The text file cwfir.asc
contains FIR filter coefficients used in the next step.
FIR filters are used in perhaps the vast majority of electronic devices. In contrast with IIR filters, which are generally realized with far fewer taps (less computational effort) for a given specification, FIR filters have linear phase in-band, while IIR filters in general do not.
The signal_subspace
program has both a Python and Fortran implementation of a FIR filter.
However, there is also a filter built into scipy.signal.decimate
.
This offline analysis used SciPy’s filter.
4. Measured signals
After downconversion, the signals look like the following, with and without target. How much to downconvert is driven by the bandwidth of your signal. Downconversion will act like a shift register for the analytic signal in frequency. Downconverting your signal might take place most effectively in multiple steps if extreme ratios are involved, such as might occur in software defined radar. This is where RFNoC or custom FPGA programming can conserve immense amount of data bandwidth and CPU/RAM resources by downconverting in the FPGA.
If the desired signal bandwidth is 50 Hz or 5 Hz, in general you don’t need the immensely higher sample rate that is the lowest sample rate the software defined radar is capable of providing. So even on the CPU portion of the processing, further downsampling might conserve further CPU/RAM resources. Particular analyses such as those using the Goertzel algorithm might benefit from particular sample rate choices.
{% include gallery id=“gallery” caption=“Red Pitaya CW Radar at 47 MHz, mostly stationary human targets.” %}
{% include gallery id=“gallery2” caption=“Red Pitaya CW Radar at 47 MHz, cyclically moving human target at 2-3 meters standoff distance.” %}
5. Estimate target Doppler
Human activity generates a range of Doppler frequencies in general for any radar. If measuring on very short time scales relative to human motion, the Doppler frequency extent may still be finite due to arms & legs swinging vs. body trunk motion. Simple products such as motion-detecting lights in the 2.4 and 5.8 GHz global license-free bands use analog filters.
One might also consider DFT-based methods, and look for the expected frequency bins to exceed a certain power threshold as a detection.
Subspace Frequency Estimation
ESPRIT subspace estimation in signal_subspace/tests/test.py:test_esprit()
is approximately O(M3), where M is “block length”.
The block length parameter M informally controls the amount of CPU power applied to find the sinusoids.
Lower SNR or more closely spaced sinusoids require a larger M, with the penalty that computation time increases O(M3).
However, where there are not pure sinusoids, such as the range of frequencies generated by human motion, alternative target detection methods may be more appropriate.
6. output measurements
The CW mode typically measures moving targets only. The targets manifest as sinusoids displaced in frequency–positive shift for targets approaching the radar antenna, and downward shift for targets moving away from the antenna. When looking at a plot of the time-domain radar signal, zoomed out far enough to see several cycles of the Doppler frequency (e.g. several seconds displayed), the frequency differences show up as a sinusoidal varying of the signal envelope.
One could imagine 4 or 5 frequency bins, from low to high frequency, something like:
- lowest frequency bin must be discarded, as it will pickup the noise of the transmitter, and very slowly moving objects like the window shades moving in the breeze.
- someone breathing, rocking/turning in their seat, or exercising.
- someone walking
- someone running
- fans spinning, cars driving by.
The frequency and width of the bins is chosen based on the user application. DFT, FFT, Goertzel, etc. may be suitable analysis methods. CFAR methods can be used in the frequency bins to mitigate false measurements.
Subspace Frequency Measurements
The subspace estimator outputs two vectors. The first vector is the frequency estimate and the second vector is the corresponding singular value. The larger the singular value, the higher the confidence in the frequency estimate. This can be used as a qualifier to discard unlikely targets. Also, targets outside a plausible Doppler shift (or range, for FMCW) can be discarded by inspection.