lunedì 20 aprile 2015

How to configure your RaspberryPI (or PC, or a similar hardware) 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=, 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
sudo apt-get install build-essential
sudo apt-get install lame

git clone
cd rtl-sdr
mkdir build
cd build
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:

      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:
      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>
    <svrinfodescription>A description of your stream</svrinfodescription>
    <!-- Turn off YP directory advertising -->

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:

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
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 this address:

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:

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 and set port to 6020, then click on the "Save" button.

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).

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.

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.

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

Link n.1
Link n.2
Link n.3

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

That's all :)


12 commenti:

  1. great nice job . Congratulations!!!! 😊😊

  2. one time the mystream has extension .xlm beneath there it's called .xml

    1. Fixed, thanks a lot (please, check again...)

  3. the file mystream.xml, where should I put?

  4. Mi spiace Michelino, ma il file rtl_udp non viene installato...
    non vorrei magari che fosse un problema di versione aggiornata!

    Mi da questo errore!

    pi@raspberrypi ~ $ rtl_udp -A fast -f 134047985 -o 4 -s 22000 | lame --scale 2 -r -s 22.0 -m m - - | ezstream -c mystream.xml

    -bash: rtl_udp: command not found

    Riesci ad aiutarmi?

    1. Devi copiare il file rtl_udp in /usr/local/bin/ altrimenti non risulta nel path.
      Fammi sapere

    2. Scusa il ritardo ma ho avuto modo solo questa sera di riprovare!
      Il problema è che non è presente alcun file Rtl_udp nella cartella /home/pi/rtl-sdr/build/src !!
      sono presenti rtl_adbs; eeprom; fm; power; sdr; tcp; test!!

      Help me please!

    3. git clone
      cd rtl-sdr
      mkdir build
      cd build
      sudo make install
      sudo ldconfig
      cd ..
      cd ..
      sudo cp ./rtl-sdr/rtl-sdr.rules /etc/udev/rules.d/

      Hai dato questi comandi? Occhio che il repository NON è quello ufficiale ma un fork...quindi se hai già rtl-sdr installato devi COMUNQUE scaricarti quetso repository e compilarlo.

      Scusa del ritardo nella risposta ...mi sono accorto solo ora del tuo commento! :P

  5. Ciao,
    mi chiamo carlo ed ho seguito alla lettera la tua guida per la ascoltare e comandare da remoto la mia chiavetta RTL.
    Nel mio caso essa è collegata ad un PC Linux Ubuntu, su cui girano regolarmente programmi come GQRX e SDRSharp.
    Dopo l'installazione riesco a comandare il dongle tramite la tua app, ma non riesco a ricevere alcun flusso audio su VLC.
    -Ezstream è installato correttamente.
    Dove posso aver sbagliato?
    Ti ringrazio per l'attenzione che vorrai concedermi.

  6. Moin, I just installed the RemoteRadio App and it seems to work fine. Thanks for writing this application. Anyhow, I miss one thing: I use a "HamItUp" converter, that mixes all frequencies 125MHz up. This enable to receive Stations from 0 MHz up to 30 MHz while the RTL SDR is tuned from 125 MHz to 155 MHz. With other SDR receivers like gqrx and SDRSharp it's possible to define this Lo-frequency. It would be very helpfull if you can add such a function to your RemoteRadio App.

    Thanks and vy 73 de dd0ul

  7. 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.