Configure your RaspberryPI to use “Remote RTL_UDP” Android App by MichelinoK

First of all….what can i do with the app “Remote RTL_UDP” by MichelinoK?
Simple…control your remote dongle and listen with your Android phone (or anything else that support realtime MP3 stream) to the tuned frequency, change modulation,change frequency,enable/disable agc,control squelch and gain, store frequencies in a databse and select them to easy tune your dongle,import SDRSharp’s database (.XML).

This manual is written using a RaspberryPI as the primary hardware where the dongle is connected, but you can use any hardware capable of running rtl_fm and icecast at the same time (icecast can run on external hw, at home I use a QNAP that run icecast).
If not specified, don’t logout from the RaspberryPI during the installation process.

So…let’s start!

I’ll assume that your RaspberryPI has IP=192.168.2.60, during this tutorial, change the IP to match yours.

First step: Install dependencies and rtl_udp onto your RaspberryPI

– login remotely into your RaspberryPI with a standard user (I use putty to connect and have a simple terminal); usually use pi/raspberry as username/password (if not changed).
– clone the external repository of rtl_udp and install it using these commands:

sudo apt-get install git
sudo apt-get install cmake
sudo apt-get install libusb-1.0-0.dev
sudo apt-get install build-essential
sudo apt-get install lame

git clone https://github.com/sysrun/rtl-sdr.git
cd rtl-sdr
mkdir build
cd build
cmake ../ -DDETACH_KERNEL_DRIVER=ON -DINSTALL_UDEV_RULES=ON
make
sudo make install
sudo ldconfig
cd ..
cd ..
sudo cp ./rtl-sdr/rtl-sdr.rules /etc/udev/rules.d/

If you already have rtl-sdr installed on your system (maybe a more recent version), you can skip the last two commands and copy the rtl_udp executable just generated in your existing /usr/local/bin/ folder.
Reboot your RaspberryPI (sudo reboot)

Second step: Install ezstream
– login remotely into your RaspberryPI with a standard user (I use putty to connect and have a simple terminal); usually use pi/raspberry as username/password (if not changed).

– execute this command:

sudo apt-get install ezstream

Now, using your favourite text editor (i love the “nano” editor) create a file called mystream.xml and paste this text into it:

<ezstream>
<url>http://192.168.2.60:8000/live.mp3</url>
<sourcepassword>raspberry</sourcepassword>
<format>MP3</format>
<filename>stdin</filename>
<!–
Important:
For streaming from standard input, the default for continuous streaming
is bad. Set <stream_once /> to 1 here to prevent ezstream from spinning
endlessly when the input stream stops:
–>
<stream_once>1</stream_once>
<!–
The following settings are used to describe your stream to the server.
It’s up to you to make sure that the bitrate/quality/samplerate/channels
information matches up with your input stream files.
–>
<svrinfoname>Your Radio</svrinfoname>
<svrinfourl>Radio di test</svrinfourl>
<svrinfogenre>Rock_HipHop_Swing</svrinfogenre>
<svrinfodescription>A description of your stream</svrinfodescription>
<svrinfobitrate>128</svrinfobitrate>
<svrinfoquality>2.0</svrinfoquality>
<svrinfochannels>1</svrinfochannels>
<svrinfosamplerate>44100</svrinfosamplerate>
<!– Turn off YP directory advertising –>
<svrinfopublic>0</svrinfopublic>
</ezstream>

You now have ezstream installed and configured.
Notice the password “raspberry” (third line), this is the password to be used later during the configuration of icecast.
Logout from the RaspberryPI.

 

Third step: Install icecast server

If you already have icecast running on external hw, you can skip this step and modify the previuos file to point to the icecast server you’re already running (change IP,port and password to match your configuration).

– login remotely into your RaspberryPI with a standard user (I use putty to connect and have a simple terminal); usually use pi/raspberry as username/password (if not changed).
– execute this command:

sudo apt-get install icecast2

During the installation, it will ask you if you want to configure the Icecast2, answer “yes”.
When asks for hostname, leave it to “localhost”.
When asks for password, change it to “raspberry” without quotes.
When asks for relay password, change it to “raspberry” without quotes.
When asks for administration password, change it to “raspberry” without quotes.
Logout from the RaspberryPI.

Final steps:

– Open with a web browser from your pc this address:

http://192.168.2.60:8000

You should see the admin interface of icecast (you can close the browser).

– login remotely into your RaspberryPI with a standard user (I use putty to connect and have a simple terminal); usually use pi/raspberry as username/password (if not changed).
– execute this command:

rtl_udp -A fast -f 134047985 -o 4 -s 22000  | lame –scale 2 -r -s 22.0 -m m – – | ezstream -c mystream.xml

You should see this in the terminal:

Found 1 device(s):
0:  Realtek, RTL2838UHIDIR, SN: 00000001

Using device 1: ezcap USB 2.0 DVB-T/DAB/FM dongle
Found Elonics E4000 tuner
ezstream: Connected to http://192.168.2.60:8000/live.mp3
ezstream: Streaming from standard input
Oversampling input by: 12x.
Oversampling output by: 4x.
Buffer size: 7.76ms
Tuned to 134311985 Hz.
Sampling at 1056000 Hz.
Output at 22000 Hz.
Exact sample rate is: 1056000.010071 Hz
Tuner gain set to 42.00 dB.
Main socket started! 🙂 Tuning enabled on UDP/6020

Now run VLC from your pc or open a webbrowser capable of playing a realitme mp3 stream and open the address  “http://192.168.2.60/live.mp3”

You should hear some “noise”.

If you want to terminate the stream from the RaspberryPI, simply CTRL-c on the RaspberryPI console.

Once everything is ok, you can run “rtl_udp –help” (again…without quotes) and see a lot of options.
Modify the above provided command to match your configuration (for example you can add the -p switch and set the ppm correction). There’s a lot of options to play with!.

The “–scale 2” is the audio multiplier, usefull if you’re gonna listen to AM stations (you’ll notice that when switching to FM, your audio volume will be much stronger than in AM mode).

The RaspberryPI configuration is terminated.

Let’s move to the Android App.

To use the app, the RaspberryPI server must be running!

Install VLC on your Android phone and run it then open the stream at this address:   http://192.168.2.60/live.mp3

You must hear noise, put VLC to the background (keeping it running!).

Install the Android app (from the provided links at the end of this post) and run it for the first time (be sure to have wifi enabled and connected to the same lan of the RaspberryPI).

Set hostname with the IP of the RaspberryPI (in our tutorial 192.168.2.60) and set port to 6020, then click on the “Save” button.

 

screenshot_2015-04-19-20-13-16

Now move to the “Commands” section.

It is VERY important to keep in mind that the app doesn’t know the actual state of the server (frequency,agc,modulation,and so on), so the values you see every first time you run the app are not true. You can however start rtl_udp with the correct parameters to match the initial setup of the app.
In this section you can change modulation,enter the frequency,change squelch,agc and gain.
To manually enter a frequency, just tap the “frequency display” then you must click on “SET” button to tune to the frequency you’ve entered.
You can fine tune using the provided buttons below the frequency display.
If you click on “ADD DB”, the app will store the actual frequency and modulation onto the internal database (it will ask you for a description).

2

Now move to the “Database” section.

Once you’ve added some frequency from the “Commands” section, you can easily tune to the stored frequencies by just double tapping the interested one.
I’ll notice that the icon near the frequency will change, meaning that you’ve tuned to that frequency.
Long pressing a frequency will let you delete the stored frequency.

3

 

You can see every operation of the app on the RaspberryPI console.

Importing SDRSharp .XML frequencies

Move to the SDRSharp section.
Enable the receiver and if you want to overwrite the current database, switch the “Overwrite” switch too.Run the Windows executable “RTL_UDP_Frequencies_Uploader.exe” and click on “Search phone”.
When the app will find the phone, click on “Load and send…” and select your SDRSharp .XML file (where frequencies are stored).
On the phone you’ll see a progressbar while importing the frequencies.
You can now turn off  “Enable receiver” switch on the app.

 

4

 

Final consideration:

You can use the Android App outside your lan, you just have to port forward the 6020 and 8000 port to your RaspberryPI’s IP

Here are the links to the Android App + Windows App

Download : Remote RTL_UDP

I’m the developer of the Android App and this tutorial, but not the developer of rtl_udp,icecast,ezstream,lamemp3.

That’s all 🙂

 

If you like this article, please consider donating by clicking on the Paypal button on the top right.

This entry was posted in Radio. Bookmark the permalink.

4 Responses to Configure your RaspberryPI to use “Remote RTL_UDP” Android App by MichelinoK

  1. Ian Atkin says:

    Hello
    The app crashes whenever I try to add a DB entry and then will not open again until I clear data? I am running Android 7.1.1 on a Nexus 6P.
    Thanks
    Ian

  2. jason says:

    Hi i would like to try your software but all the links are broke. Could you please update a link.
    many thanks jason

  3. jason says:

    thanks dude

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.