Setting up SDRPlay RSPDX on Armbian running on an ODroid N2+ for network radio tuning.

Today I received my SDRPlay RSPDx device and decided to get it running on my remote radio server. I’m still not sure if I’ll run this remote or locally, but, wanted to have the option for whatever I do decide to do.

The setup is pretty painless and involves a few commands. I’m going to assume you already have your Armbian server setup and can SSH to it and have a special user called ‘radio’ setup to run all of this as. That’s what I do.

First we’re going to want to update the system.

sudo apt-get update
sudo apt-get upgrade

Then install some stuff to have it all ready

sudo apt install cmake g++ libpython2-dev python-numpy swig git
sudo apt install libavahi-client-dev avahi-daemon libnss-mdns

Now, we go to our home directory

cd /home/radio 

Then, do this

mkdir source
cd source
git clone https://github.com/pothosware/SoapySDR.git
cd SoapySDR 
mkdir build
cd build
cmake ..
make -j4
sudo make install
sudo ldconfig

Then, we have to visit the website in order to download the install script. In a browser go to

https://www.sdrplay.com/downloads/ 

Then, select your device, and arm ubuntu, then download the API version 3.x. In my case the file name was “SDRplay_RSP_API-ARM64-3.07.1.run“.

Then continue with;

chmod 777 SDRplay_RSP_API-ARM64-3.07.1.run
./SDRplay_RSP_API-ARM64-3.07.1.run

Now, plug in your SDRPlay RSPDx device via USB and run this

SoapySDRUtil --info

You should see output showing your device now, like so

######################################################
##     Soapy SDR -- the SDR abstraction library     ##
######################################################

Lib Version: v0.8.0-g351896d3
API Version: v0.8.0
ABI Version: v0.8
Install root: /usr/local
Search path:  /usr/local/lib/SoapySDR/modules0.8
Module found: /usr/local/lib/SoapySDR/modules0.8/libLMS7Support.so    (20.10.0-1480bfea)
Module found: /usr/local/lib/SoapySDR/modules0.8/libremoteSupport.so  (0.6.0-c09b2f1)
Module found: /usr/local/lib/SoapySDR/modules0.8/librtlsdrSupport.so  (0.3.1-24b27fa)
Module found: /usr/local/lib/SoapySDR/modules0.8/libsdrPlaySupport.so (0.3.0-208f95d)
Available factories... lime, remote, rtlsdr, sdrplay
Available converters...
 -  CF32 -> [CF32, CS16, CS8, CU16, CU8]
 -  CS16 -> [CF32, CS16, CS8, CU16, CU8]
 -  CS32 -> [CS32]
 -   CS8 -> [CF32, CS16, CS8, CU16, CU8]
 -  CU16 -> [CF32, CS16, CS8]
 -   CU8 -> [CF32, CS16, CS8]
 -   F32 -> [F32, S16, S8, U16, U8]
 -   S16 -> [F32, S16, S8, U16, U8]
 -   S32 -> [S32]
 -    S8 -> [F32, S16, S8, U16, U8]
 -   U16 -> [F32, S16, S8]
 -    U8 -> [F32, S16, S8]

Now, we have to install SoapySDRPlay

cd /home/radio
cd source
git clone https://github.com/pothosware/SoapySDRPlay.git
cd SoapySDRPlay
mkdir build
cd build
cmake ..
make -j4
sudo make install

Now we want to configure SoapyRemote

cd /home/radio/source
git clone https://github.com/pothosware/SoapyRemote.git
cd SoapyRemote
mkdir build
cd build
cmake ../ # -DCMAKE_BUILD_TYPE=Debug
make -j4
sudo make install

And finally, you can test now with

SoapySDRUtil --find

Which, should give you output like this

######################################################
##     Soapy SDR -- the SDR abstraction library     ##
######################################################

Found device 1
  driver = sdrplay
  label = SDRplay Dev0 RSPdx 2005009843

So, lets make the system auto start it with

systemctl enable SoapySDRServer

Now you may (I haven’t fully tested this yet) expand your memory so you get to take advantage of the bandwidth provided by your shiny new SDRPlay device.

sudo nano /etc/sysctl.conf 

put this at the end

net.core.rmem_max=104857600
net.core.wmem_max=104857600

Close and save the file, then reboot your device. Once you have rebooted, you should be able to visit the device from the SDR you’re using (the docs recommend CubicSDR) with the IP of your remote radio server, and port as follows;

192.168.1.100:55132

I’ve found I have to adjust the bandwidth down to get anything usable, but this is because I’m on wifi. I have not fully tested on a wired network [yet].

How to setup a Chromium Kiosk Startup Mode for Raspberry Pi running Raspbian Server in 2021

I was tasked with creating a simple dashboard for a client of ours that auto runs on boot of the computer. This weekend I sat down to work on this and here’s what I found.

First, make sure you go with Rasbian Server edition of the OS. I tried with various other flavours and it was a convoluted process to remove GDM or install LXDE and actually have this run with minimal effort. This method takes around 15 minutes to setup and test, and I’m on a low speed satellite internet link – should be much faster if you have real Internet access!

Here’s how to do it;

The rest assumes you’ve already installed Vanilla Raspbian Server OS, connected to wifi if needed, and are at a shell prompt. Then you can begin by running the following commands

sudo apt-get update
sudo apt-get upgrade

That will get the system upgraded to the latest editions of everything you’re going to need next. Now let’s install the apps we need

# sudo apt-get install --no-install-recommends chromium-browser 
# sudo apt-get install --no-install-recommends xserver-xorg
# sudo apt-get install --no-install-recommends x11-xserver-utils 
# sudo apt-get install --no-install-recommends xinit 
# sudo apt-get install --no-install-recommends lxde
# sudo apt-get install lightdm screen aptitude rpd-plym-splash

Now you can go ahead and run raspi-config to edit some settings

# sudo raspi-config 

Here you’re going to want to do the following;

- setup the localization and timezone 
- setup splashscreen if desired 
- setup automatic login to x11 as the user 'pi' 

Then exit and save the settings.

Now you’re going to want to edit the xsession file so you can include the auto start of the browser

# sudo nano /etc/xdg/lxsession/LXDE/autostart

Then you’re going to want to make sure it looks like this (usually the top three lines will already be there on a typical install)

@lxpanel --profile LXDE-pi
@pcmanfm --desktop --profile LXDE-pi
@xscreensaver -no-splash
/usr/bin/chromium-browser --kiosk  --disable-restore-session-state https://google.ca

Then exit, and save the file (ctrl+x, enter to save).

Now we’ll go ahead and install unclutter, this will make sure the mouse pointer doesn’t display after a few minutes of inactivity.

# sudo apt-get install unclutter

Now we’ll remove anything we don’t need, just for good measure!

# sudo apt autoremove

And now you can reboot and wait a few seconds for it to boot into X11 and then start Chromium and display the site you listed above.

# sudo reboot

If you want to change the url to something else, just edit the autostart file again and change the url at the end of the line, exit, save, and reboot again to see the changes.

How to setup remote website deployment using git the proper way

Years ago I set this up with a bunch of convoluted scripts, and etc. No fun.

Today I did a bit of research and found out how to easily setup your web server to pull updates from your git repo anytime you publish to it – the proper way.

Here’s how to do it.

First, connect to your remote web server

ssh youruser@yourserver.com

Note, we make some assumptions that you host your site in /var/www/html and that you’ve already added your ssh keys to your git server for both master, and production web server.

Next you’re going to want to issue the following commands

cd /var/www
git init --bare /var/www/theproject.git 
cd theproject.git/hooks/
nano post-receive 

Then you’re going to want to paste this in, shamelessly stolen from this site.

#!/bin/bash
TARGET="/var/www/html"
GIT_DIR="/var/www/theproject.git"
BRANCH="master"

while read oldrev newrev ref
do
    # only checking out the master (or whatever branch you would like to deploy)
    if [ "$ref" = "refs/heads/$BRANCH" ];
    then
        echo "Ref $ref received. Deploying ${BRANCH} branch to production..."
        git --work-tree=$TARGET --git-dir=$GIT_DIR checkout -f $BRANCH
    else
        echo "Ref $ref received. Doing nothing: only the ${BRANCH} branch may be deployed on this server."
    fi
done

Edit the TARGET, and GIT_DIR then save and exit the file, and then make it executable.

chmod +x post-receive 

Now you’re ready to test it all out.

Go back to your development machine (laptop, whatever) and issue the following commands.

cd /path/to/git/repo
git remote add production user@yourserver.com:/var/www/theproject.git

Note, you need to edit the username, server, and project name and path that coincide with your settings, and, whatever has a shared ssh key with your git server.

Now you just need to commit your changes, and then push to master and to production and you’re done!

cd /path/to/git/repo
echo "test" >> index.html 
git add -A . 
git commit -m "adding test html"
git push origin master
git push production master

Refresh your website and you should see the changes!