Spectra, spectrograms and LNA gain

139 views
Skip to first unread message

Graeme Jury

unread,
Dec 29, 2019, 1:56:05 AM12/29/19
to Hermes-Lite
Hello Group,

I have been having an interesting holidays. I made contact with Christoph DL1YCF who did a pull request for a fix for the intermittent RF out while transmitting from an HL2 using Linux and he really enthusiastically offered to make piHPSDR fully HL1 and HL2 compatible and had already been working with Johan PA3GSB on the Radioberry project which had made him aware of the Hermes-Lite. It appears that John Melton and Christoph have been collaborating on the piHPSDR project.

I asked him if he could look at the LNA gain and use the atten slider to adjust it and sent him the code that Taka had done some time ago and in about 2 or 3 days he invited me to clone his git and try his code as he did not have an HL2 and was using my guess of +16 on Quisk being S9 on a scale of -12 to +48 so he went for +28 on a 0 to 60 scale for the LNA to match the scale of other supported radios. I measured the result and fired back some screenshots and it appeared that I was 3 dB out and it was adjusted for +25 = S9 and this is how it stands now.

The action of the LNA gain slider was not as I expected in that the signal level did not change with gain. That is I expected as the LNA gain was reduced that the signal and background noise would reduce and vice versa but this was not the case and the signal to noise remained the same on the spectrum and spectrogram displays and the noise level altered plus the level on the spectrogram did not match the spectrum level and the S meter. I queried Christoph on this and received the reply below which I would be really interested in receiving comments from those more knowledgable than me.

Note that if you are moving the „RXgain“ slider, the S-meter reading as well as the peak in the spectrum should stay
where they are. What changes is the noise floor of the „internal“ (mostly ADC) noise. This goes up when reducing the
gain and goes down when increasing the gain, as it should be.

IMPORTANT NOTE: you cannot do any reading from the „peak“ in the spectrum. This is the energy *density* and depends
on the sample rate, pixel resolution etc. etc., the only meaningful data is an integral over the energy *density*
with a given width, this is how spectrum analyzers work and this corresponds to the „S meter reading“, which states
that the integral over the peak is -70 dBm, correctly corresponding to S9+3 dB.

For an „infinitely sharp“ peak (a delta function, if you are physicist/engineer/mathematician) it must be infinitely
high and infinitely narrow. In the real world, the peak has some finite width and therefore some finite height, but
this height is not defined, only the integral is.

SO EVERYTHING IS CORRECT, except that the „magic constant“ needs to be changed from 28 to 25, indicating that in the
original setup, the position of the RxGain slider for „correct S meter reading“ was +13 rather than +16 dB.

A further email contained the following message and a couple of screen shots from his simulator which may be of interest to developers. Christoph is happy for me to post any of our private correspondence on our list as per group policy.

I have now stored the „HL calibration value“ in a variable, so this can in principle be different
for HL1 and HL2 (one could go even further and make this user-adjustable). According to you measurements,
the calibration value is changed from 28 to 25.

 Here the screen-shots from piHPSDR running with a simulator (that is the hpsdrsim program that is now
included in the piHPSDR source code tree).
They look very similar to your values, except that the noise floor should be
higher for a „real“ HL since my simulator simulates the ADC noise of a 16-bit ADC and HL only has
12-bit. See how the signals (synthesized by the software to have -73 dBm in each peak) stay where they
are but the ADC noise goes down if cranking up RXgain. Of course, any noise from the antenna would
behave as the signals do, stay where they are).

73, Graeme ZL2APV



Bildschirmfoto 2019-12-28 um 15.30.59.png
Bildschirmfoto 2019-12-28 um 15.31.21.png

Steve Haynal

unread,
Jan 3, 2020, 10:51:02 PM1/3/20
to Hermes-Lite
Hi Graeme,

I think different software behaves differently. Quisk behaves as you had expected, but PowerSDR and piHPSDR adjust the display based on the LNA gain setting or input attenuation.

73,

Steve
kf7o

Matthew

unread,
Mar 25, 2020, 2:45:24 PM3/25/20
to Hermes-Lite
Dear group,

I have been looking at the LNA and S meter in linhpsdr code. I have mostly been familiarising myself with the various LNA options in the protocol and playing with different settings in linhpsdr code.

I have been pondering over the following statement:

Note that if you are moving the „RXgain“ slider, the S-meter reading as well as the peak in the spectrum should stay
where they are. What changes is the noise floor of the „internal“ (mostly ADC) noise. This goes up when reducing the
gain and goes down when increasing the gain, as it should be.


As Steve notes, different software behaves differently in this respect. I have had a signal generator out and I've been measuring signals and noise. Quisk operates in a manner that makes sense to me. SparkSDR and linhpsdr behave per the statement above.

I feel like I am missing some basic DSP knowledge here. Can someone explain (or provide a link to explanation) in simple terms why the peak remains fixed, and reducing gain, increases the noise floor? On my analogue superhet, if I engage the preamp, the signal on the s meter increases, the noise floor goes up.

73 Matthew M5EVT.



Alan Hopper

unread,
Mar 25, 2020, 3:43:57 PM3/25/20
to Hermes-Lite
Hi Matthew,
I simply copied the approach of powersdr, my take is the s meter is a measure of the strength of the signal at the antena input so my feeling is that it is more useful if it does not change with gain i.e. should you give a different report just because you have changed gain.  It makes sense to me this way but had I started with something else it might not and I can see it is not always intuitive.  Spark basicaly un does the gain as the iq enters the software, I guess linhpsdr and powersdr do the same at some point.  The noise floor movement is interesting and you can see when external noise dominates over quantization noise as the movement reduces.  When the quantization noise dominates it rises with reduced gain because the software gain  is increased to cancel out the reduced lna gain, as the lna gain is before the adc it does not affect the quantization noise, so the displayed value is higher, any real signals are reduced by the lna gain so stay a similar height. Sorry,I'm not sure that is particularly well described.
73 Alan M0NNB

Duncan Clark

unread,
Mar 25, 2020, 3:54:39 PM3/25/20
to herme...@googlegroups.com
In message <d7196f0a-7bff-4695...@googlegroups.com>,
Matthew writes
>On my analogue superhet, if I engage the preamp, the signal on the s
>meter increases,

Look at it this way.

I have 50uV(-73dBM) or S9 at my antenna. I switch on a 20dB preamp and
my S meter now says 9+20. My antenna input though is still the same.

That is the norm for most ICOM/Yaesu/Kenwood rigs.

What should happen is that the S meter knows you have switched in 20dB
gain and therefore still only shows S9.

Easy with software so on my G3XJP designed PicaStar, in the DSP code we
have the ability to calibrate the S meter for each individual band so
-73dBm is S9 (assuming accurate sig gen). I can also automatically
compensate for any attenuator value I want to use and any preamp gain I
want to use.

Then there is the standard Smeter code on top. 6dB an S point written in
stone regardless of band and if I go to the external software I can tell
you within 1dB what a signal is.

PicaStar also does some sort of clever gain compensation so although it
is more sensitive as an Rx my general background noise doesn't really
become overly louder.

Don't know how it is supposed to work in a pure DSP only environment
rather than the AD DSP Chip that Peter used for the PicaStar.

Duncan
--
Duncan Clark
G4ELJ

Graeme Jury

unread,
Mar 25, 2020, 6:15:07 PM3/25/20
to Hermes-Lite
Not much to add to the responses from Alan and Duncan except that on conventional radios the S reading is pretty meaningless just like saying a signal is 50 dB without saying what it refers to e.g. 0 dB = 1 mV. It is possible to have a signal at S9 +60 dB so you wind your RF gain back and the S meter now says S5. Do you report S5 to them or S9 +60? both are real readings that you have seen on your S meter. The approach taken by pi/linHPSDR is to adjust the RX gain to match the change in LNA gain so that the input signal reads the correct value regardless. In effect you will hear and see changes in SNR which will enable you to use the optimum LNA gain for the band noise and signal level that you are listening to. Spectrum analysers and the like also use this method which is not more correct than the conventional historic radios just simply the way it is done. Probably the signal changes with gain method is most common because conventional radios would have been too complex to establish the constant signal method.

73, Graeme ZL2APV

Matthew

unread,
Mar 30, 2020, 4:09:55 AM3/30/20
to Hermes-Lite
Thanks all, I've shifted my brain into this way of thinking now!

73 Matthew M5EVT.
Reply all
Reply to author
Forward
0 new messages