Post Go back to editing

can Adam-Pluto be used as cheap experimental scalar or vector network analyser ?

Hello,

I just purchased the Adam-Pluto and my goal is to use it to make simple rf measurements between 70 MHz and 3 ghz. I just want to measure frequency response of my rf filters, inductance , frequency of resonance of my LC and stup circuits, amplifier gain , impedance  etc....I realize that the dynamic range and frequency stability of the adalm-Pluto is limited , but this is for experimental  purposes at home not for professional use in a professional rf lab.

Are there Vector or even simple Network Analyzer applications that I could use with the Adam Pluto for that purpose ? I have zero knowledge of GNURadio and MathLab and I wonder is such nice applications exists already and if people use them ? Maybe it is not even feasible or not attractive to do with the adalm Pluto for reasons that I do not understand . It googled ad it seems to me very little rf tools apps exists for the Adam Pluto in fact  (apart from the IIosclioscope) I am not too sure if I should dig in deep in GNURadio or MathLab to get such tools or if some clever guy developed an offstheshelf van or sna application for the Adam-Pluto already or if I should just forget this idea 

thank you for your help 

Regards 

Peter

  • I've used the Pluto SDR (together with a MiniCircuits directional coupler) as a reflectometer to measure the return loss for antennas in the 70MHz-6GHz range. I programmed it in Matlab - you don't need to be an expert to do this, but you do need to have access to a recent version of Matlab that supports the Pluto.

    Here is a graph of the return loss v. frequency for the little antenna supplied with the Pluto:

    You can see antenna resonance at about 800MHz and another one at about 3.5GHz. 

    The next figure shows the scan for a WiFi antenna:

    So, the Pluto works quite well as a scalar network analyser. Note, though, that you need a decent directional coupler. The MCL unit costs a few hundred dollars, but the Pluto can save you a huge amount of money compared to a 6GHz spectrum analyser.

    I've pasted the Matlab code below.  (I'm not a Matlab expert, so it may well be possible to improve on this.)

    Hope that helps.

    Neil.

    _________________________________________________________

    %% Pluto SDR Reflectometer Scan (March 2018)
    % Use Pluto SDR with a Mini-Circuits ZHDC-10-63-5+ directional coupler
    % Create a 5kHz baseband tone with txrepeat()
    % 1. Drive OUT port of directional coupler with Tx
    % 2. Attach DUT to IN port
    % 3. Sample the reflected signal at COUPL port with Rx
    %
    %% SETUP:
    % Parameters for frequency scan:
    cfstart=70e6; % Start frequency
    cfstop=6000e6; % Stop frequency
    nstep=594; % Number of frequency steps
    cfreq=linspace(cfstart,cfstop,nstep);
    cal=zeros(nstep,1); % Array for calibration amplitudes
    amp=zeros(nstep,1); % Array for DUT amplitudes
    rl=zeros(nstep,1); % Array for DUT return loss

    tx = comm.SDRTxPluto; % SDRTxPluto system object for transmitter
    tx.CenterFrequency=cfreq(1); % Tuner frequency in Hz
    tx.Gain=-30; % Transmitter gain in dB (-89.75 to 0 dB)
    tx.BasebandSampleRate=1e5; % DAC sampling rate in Hz
    % Generate the 5kHz test tone:
    sw = dsp.SineWave;
    sw.Amplitude = 1;
    sw.Frequency = 5e3;
    sw.ComplexOutput = true;
    sw.SampleRate = tx.BasebandSampleRate;
    sw.SamplesPerFrame = 5000;
    txdata = conj(sw()); % Use conj() to generate the lower sideband

    rx = comm.SDRRxPluto; % SDRRxPluto system object for receiver
    rx.CenterFrequency=tx.CenterFrequency; % Tuner frequency in Hz
    rx.GainSource='Manual'; % Disables the AGC
    rx.Gain=30; % Tuner gain in dB (-4 to 71 dB)
    rx.BasebandSampleRate=tx.BasebandSampleRate; % ADC sampling rate in Hz
    rx.SamplesPerFrame=1000; % Output data frame size
    rx.OutputDataType='int16'; % Output data type
    ndec=4; % Decimation factor

    %% SCANS
    % Check that the PlutoSDR is active:
    if ~isempty(findPlutoRadio)
    fmin=0;
    df=rx.BasebandSampleRate/rx.SamplesPerFrame;
    fmax=rx.BasebandSampleRate/ndec-df;
    freq=linspace(fmin,fmax,rx.SamplesPerFrame/ndec)/1000; % freq in kHz
    index=sw.Frequency/df+1;

    %% CALIBRATION LOOP:
    %
    input('Remove DUT - then press any key')
    for n = 1: nstep
    txfreq=cfreq(n);
    tx.CenterFrequency=txfreq; % Tuner frequency in Hz
    tx.transmitRepeat(txdata); % Repeated transmission
    rx.CenterFrequency=tx.CenterFrequency; % Tuner frequency in Hz
    for m = 1:10 % Read multiple times to clear the Rx buffer
    data = rx(); % Fetch a frame from the Pluto SDR
    end
    ddata=decimate(double(data),ndec);
    spec=ifft(ddata); % Signal amplitude at 5kHz is in spec(51)
    cal(n)=abs(spec(index));
    figure(1);
    plot(1e-6*cfreq,cal);
    xlabel('Frequency / MHz');
    ylabel('Amplitude');
    title('Reflectometer Calibration Scan');
    drawnow;
    end

    %% Measure the reflection from the DUT:
    %
    input('Attach DUT - then press any key')
    for n = 1: nstep
    txfreq=cfreq(n);
    tx.CenterFrequency=cfreq(n); % Tuner frequency in Hz
    tx.transmitRepeat(txdata); % Repeated transmission
    rx.CenterFrequency=tx.CenterFrequency; % Tuner frequency in Hz
    for m = 1:10 % Read multiple times to clear the Rx buffer
    data = rx(); % Fetch a frame from the Pluto SDR
    end
    ddata=decimate(double(data),ndec);
    spec=ifft(ddata); % Signal amplitude at 5kHz is in spec(51)
    amp(n)=abs(spec(index));
    rl(n)=20*log10(amp(n)/cal(n)); % DUT return loss
    figure(2);
    plot(1e-6*cfreq,rl);
    xlabel('Frequency / MHz');
    ylabel('Return Loss / dB');
    title('PlutoSDR Reflectometer: DUT Scan');
    drawnow;
    end
    %% RELEASE SYSTEM OBJECTS:
    release(rx);
    release(tx);
    else
    warning(message('plutoradio:sysobjdemos:PlutoRadioNotFound'));
    end

  • Hi Neil,

    Thank you you for your reply and for the code. Yes you convinced me that I should invest time playing with MathLab. Two last questions though : 

    1) how long did the frequency scan in your programme take ..? , I see from the code that you used 594 frequency steps between 70 and 6000 ghz. I am just curious to know  how fast the sweep went , is it real time or near real time performance ? Or does it take several seconds or minute to do the full scan ? 

    2) Have you considered using GNURadio instead of Matlab? I am trying to understand the rationale behind the choice of Matlab, is it for  ease of use and coding ? Performance ? I am asking because if I do this I will have to buy a Matlab license whereas GNURadio is free, so it is important for me to understand the possible advantages (if any ) of using Matlab instead of GNURadio for my specific purposes ( ie using the adalm Pluto As rf vna or sna )

    Regards

    Peter

  • Hello Peter,

    On my system (which currently uses Matlab 2017b), each scan with 594 steps takes about 90 seconds. That's slow compared to a proper spectrum analyser, but it's usable for this kind of reflectometer measurement.

    By the way, here (hopefully) is the figure for the Pluto antenna that was somehow omitted from the above post:

    I used Matlab because our university has a site licence, and we already use Matlab for various scientific programs in the lab. If you only want to program the Pluto (and not use Matlab's many other features), then GNURadio might well be a better choice for you. 

    You would still need to get a directional coupler. The Mini-Circuits unit was the best I could find at a reasonable price that covers the Pluto's 6GHz bandwidth. (In fact, their 16dB coupler may have even better directivity than the 10dB coupler that I'm using.)

    Note that my measurements are all scalar, not vector. I haven't yet tried using the Pluto as a VNA. My program shifts the Tx frequency by 5kHz relative to the Pluto's local oscillator, and it then measures the amplitude of the reflected 5kHz baseband signal at the receiver, determined by Matlab using a FFT. In principle, the FFT contains phase info as well as amplitude, and that might be used to make a VNA. But phase changes in the transmitter and receiver chains may make this impractical. When I have time, I'll try to modify my program, just in case there is some useful phase info there.

    Regards,

    Neil.

  • Dear Neil,

    That is quite clear thanks.  

    I already have a 4 port directional coupler, a cheap model sold on eBay for 10-20 euros, but that is tested ok  up to 3ghz according to their owners. I think I will start with this before I invest into something more expensive and more performant. Thank you however for pointing to me this mini-circuit  model  tested ok up to 6 Ghz. 

    The price of the Matlab license is reasonable for a home user (about 100 eur), so it remains an option for me. I just need to analyse to which extend I will be able to use Matlab/Simulink  for other rf design/analysis/measurement purposes on the mong run. 

    If you are considering exploiting the phase info of the FFT transform for the purpose of experimenting with VNA, I would like to draw your attention on this open source VNA client/server application that has been developed for the "redpitaya" by Pavel Demin (The redpitaya uses the very same Zynq processor than the adalm-pluto). 

    http://pavel-demin.github.io/red-pitaya-notes/vna/

    I use this VNA application routinely and it works very well. However the redpitaya is limitted to 60 Mhz only, that is why I bought the adalm pluto hoping that a similar app would be developed by somebody someday.  The VNA server is coded in C and runs on  the Zynq processor while the client is coded in Python and runs on the PC. The server and client are communicating via Ethernet. I do not own the programming  skills to port the application to the Adalm-Pluto, otherwise I would just do it. 

    Thanks

    Regards
    Peter

  • Well, I just found this module by searching VNA & Matlab ?

    https://nl.mathworks.com/matlabcentral/fileexchange/68910-vna-impedance-measurement?s_tid=srchtitle

    if this Matlab module could work somehow with the adam-pluto, either offline after acquisition of data or real-time through simulink, it would actually address my needs.

    From what I understand though, this module would require additional code to run on the adalm-pluto or on the PC to feed it with the data needed.  Correct ?

    Regards

    Peter

  • Hello, Peter.

    Yes, your eBay directional coupler is certainly worth trying.

    Thanks for the link to the Red Pitaya VNA. It looks like it uses the 2 ADC channels on the Zync processor. But that's different from the Pluto, which uses a single Rx channel of an AD936x to handle the RF.

    The Matlab VNA script seems to be for converting parameters measured by an HP VNA. You can do this conversion anyway in Matlab (running on a PC). It can easily handle the complex numbers and the simple formulae. A fancier way would be to use conversion functions in the RF Toolbox (which also allows you to do S-parameter RF design of LNAs etc). That's a nice optional extra with Matlab, but it's not essential.

    To use the Pluto with Matlab, it's essential to have the Communications, DSP System and Signal Processing Toolboxes. These three toolboxes are not included in the basic home licence and add about another 100 euros to the cost.  You can try the free 30-day trial first to make sure that you're happy with Matlab.

    Hope that helps.

    Regards,

    Neil.

  • Hello, Neil,
    it is possible that with MatLab you provide an executable program from your Network Analyzer.
    I think you have created a great application here. Unfortunately I do not own Matlab.
    This application is very interesting for me to test self made antennas.

    Greetings Georg

  • Hello Georg,

    I just checked my MATLAB script with MATLAB's Application Compiler, but it cannot find the dependencies for some 'pcode' files, which contain proprietary code that drives the Pluto from MATLAB. I suspect that the dependency tree may be quite complex. (The script itself also has to be converted into a MATLAB function, but that is not difficult.)

    So, it may not be easy to make a standalone program, unless someone else can provide the required pcode file dependencies. I'll try again later in the week, when I have more time.

    Regards,

    Neil.

  • Hi Neil,
    I confirm that this would indeed be great to have an executable derived from your work. I just did not realised it was feasible, and buying the two MatLab licenses just for doing frequency response analysis seems to me disproportionate though I must confess I seriously considered it. I am sure there are many people like Georg and I who would love to use the PlutoSDR as a frequency response analyzer to tune filters and antenna, to measure amp gain, etc... I searched extensively the net and you are the only one who has developed something close to an SNA app this for the Pluto. There  is QSPECTRUM analyser, a nice spectrum analyser app based on SoapySDR but it lacks the functionality of a tracking generator unfortunately, 
    By the  way, regarding your scrip, I am not sure I understood if you are doing any form the calibration for easing the measurement of the return loss over a wide frequency range ? Have you foreseen something specific to try to simplify it  ?  Or does calibration have to be done entirely manually for every frequency of measurement ?
    Thanks
    Regards
  • Hello, Neil,

    thanks for your info. I would be very happy, like maybe many other users, if you manage to create an executable file.
    I wish you much success and wait for your info.

    Greetings Georg