Auto start your GNU Radio script at boot on any Raspberry Pi
This is going to be a small tutorial that will allow you to run your GNU Radio script automatically at system boot. I am using a Raspberry Pi 4, a Pluto SDR and GNU Radio. You need all sort of flexibility when you are on the field. For example, you created a nice GNU Radio block diagram that processes radio signals. Now, when you go out on the field, you should be actually focusing on testing your script and its performance. Not spend time playing around in the terminal just to fire up your script. On the other hand, this tutorial will come handy when its time for you to launch it on several other devices. In such situations, an application that loads at power on will always be preferable.
GNU Radio script
Fortunately, all versions of GNU Radio generate a python script. You will find it sitting alongside your .grc file or whatever extension they have come up with in the recent version. If you are using a GNU Radio version lower than 3.8, you require Python 2.7. On the other hand, GNU Radio 3.8 onwards, the generated script is run with Python 3.
Working with Linux
Try to fire up your terminal and run this python script. That way you will find that it works just as fine (given that everything else is correctly compiled).
1 |
python /path/to/gnu_radio_blk_script.py |
Now that you are sure of your script, we are fine to move on to further steps. The next step requires you to install a terminal called “xterm”. On Raspberry Pi, we can do this with the following command
1 |
sudo apt-get install xterm |
Once you are done installing xterm, we can configure it to execute our script after boot process. In order to do so, create a new directory as follows and further create a new file.
1 2 |
mkdir /home/.config/autostart sudo nano /home/.config/autostart/lxterm-autostart.desktop |
Inside the newly created “lxterm-autostart.desktop” file, paste the following code.
1 2 3 4 5 |
[Desktop Entry] Encoding=UTF-8 Name=GNU Radio autostart Comment=Execute a gnu radio python script Exec=/usr/bin/lxterm -e 'python /path/to/your/script.py' |
Make sure you enter your script’s path correctly. Simply reboot your Pi board and you should have your script fire up at system startup.
In my case, I had a PlutoSDR attached to the Raspberry pi. The GNU Radio script had a repeating waveform being generated.
Conclusion
To conclude, these set of steps had my job done the way I needed. The usual linux methods such as crontab or running with /etc/rc.local did not work out with GNU Radio and a PlutoSDR attached. If any of you readers find a simpler way, let me know in the comment.
On the other hand, you should also be able to auto-start your GNU Radio application with any other SDR, such as the RTL-SDR or even LimeSDR.
I spent one day looking for a solution to launch GNU Radio. Here an other solution I proposed explained in this post.
https://f1atb.fr/index.php/2021/03/20/launch-gnu-radio-script-at-boot/
Thanks for your comment. I will give that method a try.