LimeSDR Transceiver control with Python

Hello,

Happy New Year !!

I’m trying to build a transceiver with LimeSDR, Which is working fine. This is a very simple implementation that looks like below

Now , I need some ideas/suggestions to improve it’s functionality. Like, I don’t want the transmitter “ON” all the time and when I need I’ll initiate command. It’s easy to implement If I use two sdr hardware and two separate scripts for rx and tx. But I want to know how to achieve this using 1 limesdr as transceiver, where I can control the receiver and transmitter separately as my need.

Just wondering, has anyone done this type of implementation so far. Could you please share some examples in python or share any links that might be helpful.

Thanks :slight_smile:

GRC is great for prototyping, not so great for building complex applications which have a flexible UI. I suggest you will need to write some custom code to achieve what you want.
You can take a look at the source code of https://github.com/qradiolink/qradiolink which is exactly that (a transceiver usable with the Lime hardware among other things). In my opinion it is best to use gnuradio for DSP only and write the rest of the code yourself.

1 Like

Thanks Adim…I’ll check the code for qradiolink.

so far, I’ve tried few things using python after following this gnuradio tutorial which is very similar to my application https://wiki.gnuradio.org/index.php/TutorialsWritePythonApplications#Multiple_flow_graphs

Still both rx/tx flow graph starts at the same time with gr.top.block() class and I’m unable to stop only the transmitter. Let’s see how far I can go with my basic python skills and reading qradiolink/ other gnuradio implementation for some ideas…

Thanks again for your suggestions :slight_smile:

There have been many complains about not being able to stop the transmitter - the almost solution is to set the transmitter gain to zero.

1 Like

The Python API is not very different to the C++ one. You can create two top blocks in the same Python process, but you need to write your own Python code to wrap the code generated by GRC, and then calll start() and stop() on each of them as you want (clicking a button for instance). If you’re more familiar with Python, there are Qt GUI widgets which can be used in a GNU radio flowgraph. Or you can use PyQt bindings directly.
As you get into more complicated scenarios, you can look into creating hierarchical blocks to structure the flowgraphs.
You can do flowgraph changes dynamically at runtime, all you have to to is call top_block.lock() and connect() or disconnect() the blocks you want.
As long as you don’t write your own DSP in Python blocks, there is no big downside to Python.

1 Like

@RightHalfPlane Thanks for the tips :-D.

I reckon, I need to practice and learn more c++ or python to understand the inner workings of this libraries and add custom logics to set this parameter on/off during run time from cli command.

Hi @adim

I have tried with QT GUI wizards, however I’m trying to learn the efficient way of controlling my radio from terminal dynamically without GUI

Thanks for your suggestions on top_block.lock() and connect() or disconnect() method. I’ll check those functions and will try to implement my logic. I’m far away from writing any dsp code in python/c++ at this stage of my learning :blush: :stuck_out_tongue:

Cheers!!

sdrTest is a command line C++ program that can control any software defined radio in the SoapSDR family (including the limeSDR Mini). sdrTest does CW, AM, FM, NBFM, USB, LSB and can set many of the SDR parameters. The source code is available. A video showing its use is at -

1 Like

That reminds me to a working transceiver I realized some time ogo:

ttps://discourse.myriadrf.org/t/working-nbfm-transceiver-on-gnu-radio/1222

And getting the Tx down is only one of the problems you will be encountered with.

John

You don’t need to stop the flowgraph to stop transmitting. That is a pretty expensive operation in terms of latency (calling stop() and start() ) and you can get some undefined behaviour from the scheduler with the first few and last samples.

You can simply stop pushing samples into it (probably audio samples in this context) and there will be no actual signal anymore. This means having some sort of control over the GNU radio scheduler, and that sometimes means writing your own block for this purpose.

If you’re worried about the LO leakage, you can turn the gain way down as soon as you’re done transmitting the last sample, but usually in semi duplex mode you’d have some sort of programatic mechanism to switch off your external power amplifiers anyway. In full duplex mode the LO oscillator leakage might be a problem but it can be mitigated in various ways, including by turning the TX gain all the way down when there are no samples flowing through.

1 Like

@RightHalfPlane sdrTest is awesome command line tools. I was looking for a such cli tools for a while. I have tried with rx_tools previously but no success with limeSDR and couldn’t get any response from github issues as well…

Thanks for sharing this here…hopefully someone like me stumbled on this thread in future, will be benefitted from this along with your github repo :smiley:

@adim @RightHalfPlane Many many thanks to both of you :clap:t2:

Finally, I got a voice activated transmitter version up and running :blush: not very elegant but serves my purpose for the research I’m working on.

So, I used pyaudio to detect voice from microphone, if there are voice samples then it will set tx_gain=40 otherwise tx_gain=0. So, I don’t have to start or stop top_block_cls() now.

Waterfall after applying this condition. Now signal is visible only when there is voice

Cheers!!