Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Request) Adding Soapy support via python bindings #1

Open
alphafox02 opened this issue Nov 20, 2024 · 12 comments
Open

(Request) Adding Soapy support via python bindings #1

alphafox02 opened this issue Nov 20, 2024 · 12 comments

Comments

@alphafox02
Copy link

I haven't even tested with the RTLSDR yet and the project has only been listed for a day, so apologize for immediately asking this question, but are you thinking of adding support of other SDRs via Soapy for example?

Glancing over projects which have added soapy support seem to point at using python bindings to setup and initialize the SDR, pass SDR settings, and starting streams to pull in for processing.

I'll try it out with the RTLSDR. Thanks for sharing!

@xqtr
Copy link
Owner

xqtr commented Nov 21, 2024

Working on it. I don't have another device, except an RTL2832 one to test, but i guess that if it works with that, under SoapySDR, other devices will too... hopefully. :)

@alphafox02
Copy link
Author

Off topic, maybe another ticket, but I was checking things out with the rtlsdr and upon loading it seems like the noise floor is all the way up to the top of the window. Off to the left I think it was saying 10 or 20db? Something didn’t seem right.

@alphafox02
Copy link
Author

Working on it. I don't have another device, except an RTL2832 one to test, but i guess that if it works with that, under SoapySDR, other devices will too... hopefully. :)

There’s a soapy fork of retrogram, might be a good reference?

@xqtr
Copy link
Owner

xqtr commented Nov 21, 2024

Off topic, maybe another ticket, but I was checking things out with the rtlsdr and upon loading it seems like the noise floor is all the way up to the top of the window. Off to the left I think it was saying 10 or 20db? Something didn’t seem right.

Have you "played" with the Auto/Gain controls? Maybe this will reduce the noise. I also improving the script and added PPM correction and some other stuff. Will update soon.

@alphafox02
Copy link
Author

Moved to a different location and messed with gain by raising from 0 on up, as I increased gain it seemed like the noise floor decreased. Seemed odd, but I was able to find signals in the fm broadcast range.

@xqtr
Copy link
Owner

xqtr commented Nov 22, 2024

Moved to a different location and messed with gain by raising from 0 on up, as I increased gain it seemed like the noise floor decreased. Seemed odd, but I was able to find signals in the fm broadcast range.

It't not odd, it's what the Gain function does... it's an amplifier value. That's why noise decreased.

New version uploaded with some fixes/additions :)

@xqtr
Copy link
Owner

xqtr commented Nov 22, 2024

Just added a version that's only for SoapySDR. I tested with my rtlsdr dongle and it runs, even better than the original script. Perhaps it has better drivers. Could you please test it with other receivers?

@alphafox02
Copy link
Author

Absolutely and thank you! I’ll let you know this weekend and test one SDR I have laying around.

@alphafox02
Copy link
Author

alphafox02 commented Nov 24, 2024

I'll have to write separate tickets, but here's some feedback showing that soapysdr is working with some SDRs.

LimeSDR v2 complained that sample rate needed set. I tried to create what seemed like sdr_settings.ini to have settings loaded from file, but same error.


Traceback (most recent call last):
  File "/home/dragon/WarDragon/PySpecSDR/./pyspecsdr-soapy.py", line 1861, in init_device
    self.device.activateStream(self.stream)
  File "/usr/lib/python3/dist-packages/SoapySDR.py", line 1529, in activateStream
    return _SoapySDR.Device_activateStream(self, stream, flags, timeNs, numElems)
RuntimeError: SoapyLMS7::activateStream() - the sample rate has not been configured!

During handling of the above exception, another exception occurred:


Traceback (most recent call last):
  File "/home/dragon/WarDragon/PySpecSDR/./pyspecsdr-soapy.py", line 2482, in <module>
    curses.wrapper(main)
  File "/usr/lib/python3.10/curses/__init__.py", line 94, in wrapper
    return func(stdscr, *args, **kwds)
  File "/home/dragon/WarDragon/PySpecSDR/./pyspecsdr-soapy.py", line 2002, in main
    sdr.init_device()
  File "/home/dragon/WarDragon/PySpecSDR/./pyspecsdr-soapy.py", line 1873, in init_device
    raise RuntimeError(f"Error initializing SoapySDR device: {e}")
RuntimeError: Error initializing SoapySDR device: SoapyLMS7::activateStream() - the sample rate has not been configured!

I then plugged into the RTLSDR which worked fine with Soapy.

Reached over and grabbed the PlutoSDR, it also loaded with Soapy. However, the bandwidth is capped at like 2 from the perspective of the program when it's running. Also, the noise floor still seems to act funny. For example, same SDR in SDR++ the noise floor is roughly about -80 with signals rising above as gain is increased, noise floor increasing as well.

If I open up PySpecSDR and raise gain to the same setting as in SDR++, the noise floor is at like -35 and nearly at the top of the screen. If I raise gain up and up, a fm station will raise from the noise floor and the noise floor will decrease slightly, but still be in the -30 something range.

Maybe I'm looking at things wrong, but it just doesn't seem right to me. I opened up retrogram-soapy on the same SDR and the noise floor is around -80 -90 shown off to the left side.

@xqtr
Copy link
Owner

xqtr commented Nov 24, 2024

I think i found the problem with LimeSDR. I also made some changes for noise levels. Made also some minor fixes and added a center frequency marker.

Could you test it to see if it works with LimeSDR?
Thank you for the feedback.

@alphafox02
Copy link
Author

LimeSDR is now starting just fine, this is a LimeSDR v2.

The noise floor does seem to start a lot lower, still showing about -9dB which now makes me wonder what it's measured in within SDR++ that's showing say -90. Gain seems to work as well, also noticed you must have fixed the setting adjustments to stop immediately upon releasing the keyboard keys. Before it seemed they built up and would continue on after releasing keys, like if I held down raise gain for example.

@alphafox02
Copy link
Author

I'll grab an ettus, bladeRF, RFNM, hackRF, and others later today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants