AlbrechtL / welle.io

A DAB/DAB+ Software Defined Radio (SDR)
https://www.welle.io
Other
598 stars 115 forks source link

RTL-SDR offset tuning & DC correction #252

Closed beta-tester closed 5 years ago

beta-tester commented 6 years ago

is there a way for "offset tuning" and DC correction? i have an old RTL-SDR dongle (with a E4000 tuner) that has a horrible big peak on the tuning frequency. on other software i enable "offset tuning" for that dongle to don't have that big peak + DC correction, but welle.io don't have such an option (yet?). i can not use automatic (software) gain, because i takes the big peak into account to adjust the gain. i have to turn off that automatic gain option and have to manually control the gain. screenshot from 2018-05-01 12-21-30

Waitsnake commented 6 years ago

It is the same problem with my rad1o (uses HackRF driver over soapysdr). It has this horrible peak in the middle too (with all programs not only with welle.io). I think this could be one reason why auto gain is not working at my device too. So I can only use manual gain at the moment. Second reason for problems with AGC in my case is that m_device->getGainRange() gives a too large maximum that is not accepted by m_device->setGain() later. But I think the second problem looks like an issue in the pothosware/SoapyHackRF and not of welle.io. I need to dig into this later. Anyway I only want to say there are more than one SDR device out there with the same peak.

AlbrechtL commented 6 years ago

Those features could be interesting for the next branch.

Which software provides these features? If one of these software is open source you can check how it is implemented and describe it here, please.

beta-tester commented 6 years ago
mpbraendli commented 6 years ago

The first two references point to functionality in librtlsdr, which are not applicable to the SoapySDR input. I don't know if they are implemented in software or in the rtlsdr dongle itself.

However, gr-correctiq is a software DC offset compensation that we could take into welle-io. It measures I and Q DC offset separately and substracts it. The two offsets are averaged over time using an exponential moving average here: https://github.com/ghostop14/gr-correctiq/blob/master/lib/correctiq_impl.cc#L121

AlbrechtL commented 6 years ago

To use the gr-correctiq sounds the best way to do the correction. I will put this ticket to the next version project page.

beta-tester commented 6 years ago

The first two references point to functionality in librtlsdr, which are not applicable to the SoapySDR input. I don't know if they are implemented in software or in the rtlsdr dongle itself.

yes and no.

yes, i have seen the offset tuning option on RTL drivers only, and i mean the E4000 tuner can do so and the R820T don't. so they do it in hardware on the dongle itself.

but in general, offset tuning is possible on all sdr devices, if you have enough "spare" bandwidth available. lets say you want to tune to a DAB channel, but the sdr device has a big spike on its center frequency, then an option is to set the sdr to a center frequency left or right beside the DAB channel of interes and the bandwidth to twice of the required channel bandwidth. then in software you ignore (cut away/filter out) the center frequency part and lower left part (or upper right) that contains the bandwitch out of interest. that would be kind of a lower/upper side band filter. but to do this kind of "software driven offset tuning" for DAB you need a bandwidth of 4MHz. to have the 1537kHz of interest in the upper/lower side out of the way of the sdr spike on center frequency.

that's how i understood "offset tuning" in theory. if they can not do it in hardware on the device itself, this is not practicable for RTL dongles, because of their limited bandwidth of only 2.4MHz, but HackRF and PlutoSDR can easily have more than 4MHz bandwidth.

but i have no idea/skills of how hard it would be to realize this

mpbraendli commented 6 years ago

Yes, you are right: while the linked references themselves don't apply, the principle still does.

SoapySDR offers the ability to set such an LO offset here. It would be possible to add the LO offset setting to the SoapySDR settings dialog. The good thing is that this does the LO offset in the device, and therefore doesn't increase the sample rate we get from the device.

beta-tester commented 6 years ago

by reading something about DAB signals got the idea, that the bandwidth of a channel is 1537kHz and in that signal there are 1536 subcarriers of 1kHz each. and a Special feature of DAB is, that the carrier in the middle is obmitted. if this is correct, then maybe it is possible to competely ignore and blank out the spike at the center frequency so maybe in the special case of DAB no offsettuning or dc correctrion is necessary to get rid of the spike.

mpbraendli commented 6 years ago

That's correct, there's no data in the carrier k=0. But moving this spike outside of passband will allow us to use the software AGC, and make better use of the dynamic range.

beta-tester commented 6 years ago

... EDIT: i was sleepy and read something wrong... :)

mpbraendli commented 6 years ago

No you're not, your suggestion was good!

andimik commented 6 years ago

Same here. Your idea was good. I had the same wish some time ago, but then I bought an Airspy, which does not have this spike.

mpbraendli commented 5 years ago

Summary of the ticket:

mpbraendli commented 5 years ago

Commit 9ca2fa2 adds this setting, but I'm not currently in a situation where I can properly test.

For the RTLSDR, the offset_tuning is set to true if the LO offset is different from 0, i.e. the slider not in the centre position. @beta-tester could you build latest next and compare with your first test?

beta-tester commented 5 years ago

@mpbraendli i just cloned and build the latest next and tried to turn LO offset up/down to +/-4000. but i still can see the very big peak always in the center of the frequency spectrum. compared to the current master i don't see any differences in the spectrum behavior.

mpbraendli commented 5 years ago

Ok, I wasn't sure if this was the right approach, maybe it using manual gain for such devices is necessary.

I now have access to a rad1o badge, I will quickly try with that.

mpbraendli commented 5 years ago

Well, it seems this LO offset makes no difference :-( On some channels I have a huge centre spike with the rad1o, and LO offset has no influence.

I propose to remove it from the GUI, we cannot compensate for all device limitations.

mpbraendli commented 5 years ago

It seems to have negative effects: also https://github.com/AlbrechtL/welle.io/commit/9ca2fa2bdf2cace339ca9d870ce709bb412e90cc#r30384093

mpbraendli commented 5 years ago

I've reverted the commit adding the LO offset setting as it creates more trouble than it solves.