ViewRF software – RTL-SDR Spectrum Analyzer for BeagleBone Black

In my previous blog entry I demonstrated my RTL-SDR based spectrum analyzer running on the BeagleBone Black (BBB) with a 7-inch touchscreen LCD.

In this entry I’ve provided instructions on how you can run this software on your own BeagleBone. I’ve released the software – ViewRF – under the GPL license. You can download the source code hosted on GitHub.

The hardware you need (other than the BeagleBone itself) is the RTL2832U based DVB-T (digital TV) USB dongle. See RTL-SDR wiki for a list of supported hardware. I’ve tested the software with dongles based on the Elonics E4000 tuner and also the Rafael Micro R820T tuner. These dongles are available from various online shops.

The software has been designed to run on a 800×480 resolution screen, ie the resolution of the 7 inch LCD cape.

Instructions:

  1. Download and unzip (using 7-zip) this microSD image:
    Angstrom-Cloud9-IDE-GNOME-eglibc-ipk-v2012.12-beaglebone-2013.06.20.img.xz. Then copy this unzipped image using Win32 Disk Imager to a microSD card.
  2. Insert the microSD card to your BBB and power it on.
  3. After you are logged in, open a terminal, then disable X Windows autostart using the command:
    systemctl disable gdm
  4. Reboot:
    /sbin/shutdown -r now
  5. At the console, login as root, then calibrate the touchscreen
    ts_calibrate
  6. Install these Angstrom packages:
    opkg update
    opkg install qt4-embedded --force-depends
    opkg install libqtsvge-dev --force-depends
    opkg install libqtguie-dev --force-depends
    opkg install qt4-embedded-dev --force-depends
  7. Set the following environment variables:
    export OE_QMAKE_CXX=/usr/bin/gcc
    export OE_QMAKE_CXX=/usr/bin/g++
    export OE_QMAKE_LINK=/usr/bin/gcc
    export OE_QMAKE_INCDIR_QT=/usr/include/qtopia
    export OE_QMAKE_MOC=/usr/bin/moc
  8. Download, compile and install QWT:
    wget http://jaist.dl.sourceforge.net/project/qwt/qwt/6.1.0/qwt-6.1.0.tar.bz2
    tar -xjvf qwt-6.1.0.tar.bz2
    cd qwt-6.1.0

    Edit qwtconfig.pri, remove QwtOpenGL, QwtDesigner
    Edit ./src/src.pro, change TARGET to:
    TARGET = $$qwtLibraryTarget(qwt$$QT_LIBINFIX)
    Continue with the compilation process:
    qmake
    make
    make install
  9. Download, compile and install RTL-SDR library:
    cd
    git clone git://git.osmocom.org/rtl-sdr.git
    cd rtl-sdr
    autoreconf -i
    ./configure --enable-driver-detach
    make
    make install
    make install-udev-rules
  10. Edit /etc/profile, add the line:
    export LD_LIBRARY_PATH=/usr/local/lib:/usr/local/qwt-6.1.0/lib
  11. Edit /etc/profile.d/qte.sh, if using touchscreen add the line:
    export QWS_MOUSE_PROTO=LinuxInput:/dev/input/touchscreen0
    or if using a mouse, add the line:
    export QWS_MOUSE_PROTO=MouseMan:/dev/psaux
    Logout, then log back in again.
  12. Download and run ViewRF software
    cd
    git clone git://github.com/stephenong/ViewRF.git
    cd ViewRF
  13. To run the pre-built binary (don’t run the git checkout command if you are building from source)
    git checkout 9b4d425331
    ./ViewRF -qws

I hope this software is useful to you. Let me know what you do with it. Feel free to donate :), link on the sidebar.

58 thoughts on “ViewRF software – RTL-SDR Spectrum Analyzer for BeagleBone Black

  1. holiman

    Nice work!

    Would it be possible to tweak this setup for use with a Funcube Dongle Pro+ ? I have one of those and a BBB lying around – do you have any idea about difficult it would be?

    Reply
    1. stephen Post author

      Thanks holiman. I’m afraid I don’t know how difficult it would be to interface the Funcube dongle with the BBB. I suggest buying a RTL-SDR dongle as they are quite cheap.

      Reply
  2. Alan

    Is there anything BBB specific?
    I have an older Beaglebone, and the big differences are the HDMI output on the new BBB, and the RAM config. If I can get away with “just” using the old BB, this project could become the resting home for the old board.

    Reply
    1. stephen Post author

      It should work on the older BeagleBone. The screen update rate could be lower due to the slightly slower processor. Give it a try.

      Reply
  3. JC

    Is there anything that mandates the use of the LCD? I have a couple BBB’s I haven’t done anything with, but I’d like to avoid dropping $150 on the LCD, plus they seem to be out of stock.

    Reply
  4. Andrew

    Hi
    I’m very glad to see this and thank you for share this. I have a question! Can we use any other boards it can be run linux? like cubeboard – this boards very faster than BBB.

    Reply
  5. stephen Post author

    The software should be able to be compiled for both the cubieboard and the rpi. The RTL-SDR libary make use of the libusb library. Make sure that libusb can be installed.

    As for the screen, it doesn’t have to be the same one. If your screen have a different resolution, you might want to adjust the GUI elements size and position in the source code. It is currently only optimized for 800×480.

    Reply
  6. James

    great work! Very nice project. I can run the precompiled binary, but unfortunately I cannot build the project myself on the BBB. Giving the qmake command, I get a
    sh: -d: command not found

    I went through the ViewRF.pro file and made sure the library paths (and any other path) are all good, but still I am getting stuck with quake giving this error, and producing a Makefile that if I try to make it, it gives
    dialog.ui -o ui_dialog.h
    make: dialog.ui: Command not found
    make: *** [ui_dialog.h] Error 127

    any ideas please?

    Reply
    1. stephen Post author

      Something not quite right there. That line should go like:
      uic dialog.ui -o ui_dialog.h

      The uic executable is part of the Qt toolchain.

      Reply
      1. Andy

        There are quite a few problems with the instructions
        For my /etc/profile I have
        export LD_LIBRARY_PATH=/usr/local/lib:/usr/local/qwt-6.1.0/lib
        export OE_QMAKE_CC=/usr/bin/gcc
        export OE_QMAKE_CXX=/usr/bin/g++
        export OE_QMAKE_LINK=/usr/bin/gcc
        export OE_QMAKE_INCDIR_QT=/usr/include/qtopia
        export OE_QMAKE_MOC=/usr/bin/moc
        export OE_QMAKE_UIC=/usr/bin/uic

        Also – with the latest version of angstrom – I needed to add -lm and -lstdc++ to the libraries , and remove avresample
        I can’t seem to get the touchscreen working – thats the next job.

        Reply
  7. Tony Faiers

    I’ve been out and purchased the kit to do this project as it was down my avenue of interest, however, when I run the ./configure –enable-driver-detach it runs through but gives me an error at the end which says “No package ‘libusb-1.0’ found” Consider adjusting the PKG_CONFIG_PATH environment variable.

    Should I just start from scratch again or do you think I’ve missed something somewhere?

    Reply
    1. Tony Faiers

      I may have resolved the problem by adding the command:

      #opkg install libusb-1.0-dev

      during the installation of the other packages, hopefully this will help if anyone else is experiencing the same problem

      Reply
  8. tom

    Dear folks what is the auto login command for the installed ViewRF on my BBB.
    Now i start manuell with:
    root
    ViewRF
    ./ViewRF -qws

    Thanks for Help!

    Reply
    1. tides

      Hi,

      Thanks for stephen for his guide in this website. Does anyone manage to start the program when Beaglebone Black boot up? Could anyone please share the step to auto start the process at boot process?

      Thanks

      Reply
  9. Simon - vk4tsc

    When I run the ‘./configure –enable-driver-detach’ command in stage 9, the response is ok on everything except libusb-1.0. System says it is not found. Obviously it is there but no corresponding .pc file exists in pkgconfig that I can ascertain. Since I am fairly new to any sort of Linux, I’m in the dark as how to fix this problem.
    If I attempt to run the next command ‘make’. ‘*** No targets specified and no makefile found. Stop.’ is the terse reply. Is this associated with the libusb problem or are there other dark forces at work?
    Hope you can help this newbie!

    9. Download, compile and install RTL-SDR library:
    cd
    git clone git://git.osmocom.org/rtl-sdr.git
    cd rtl-sdr
    autoreconf -i
    ./configure –enable-driver-detach
    make
    make install
    make install-udev-rules

    Reply
  10. Simon - vk4tsc

    Seems I jumped the gun on this. I was using an older saved copy of the page and when I posted my reply it updated the page and I saw the other comments.
    My thanks to Tony Faiers for “#opkg install libusb-1.0-dev”. It seems to have done the trick and all later commands work properly. Software locks up/fails but as I do not yet have my RTL dongle I can understand it.
    Many thanks to Stephen for his instructions/comments, Tony and everyone else who has commented, it has made it all worthwhile.

    Reply
  11. Peter

    Very good project !!! Is there a Software version for LCD 7-inch 1024 x 600 pixels resolution (with capacitive touch) (Found at TIGAL-Shop http://www.tigal.com/product/3527 ) ? What will happen to the GUI-elements with your 800×480 pixels optimized Software Version? Will the 1024 x 600 pixels LCD work ?

    A second question: Is the frequency span of the spectrum-analyzer always 2,0MHz or can it be changed ???

    Thank you for reply, Peter.

    Reply
  12. Pierre Martel

    Nice project. For Peter, the frequency span of the spectrum-analyzer is based on the actual span the rtl-sdr can give. So no it wont bea ble to do more then 2 mhz. But if the software could be run on a hackRF device it would be able to display the 20 mhz that the device can spit at a time.. But it would take MUCH more cpu power to do so..

    Reply
  13. Klaus

    after some problems I got everything installed. I now tried to start ViewRF in a VNC session, I get the info that the Tuner is found but nothing else, I expected to get the screen in the X window

    is it possible to run ViewRF for test on an VNC?

    Klaus

    Reply
  14. Ken

    I’m trying to compile ViewRF on Fedora 19.

    I get errors when trying to compile spectrumplot.cpp (qwt is version 6.0.1 on Fedora 19, whereas it’s version 6.1.0 on Angstrom, so perhaps that’s the problem. Error messages :


    /usr/bin/qmake-qt4 -o Makefile ../ViewRF.pro
    g++ -c -pipe -D__STDC_CONSTANT_MACROS -Wno-psabi -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4 -grecord-gcc-switches -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables -O2 -Wall -W -D_REENTRANT -DQT_SHARED -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -I/usr/lib/qt4/mkspecs/linux-g++ -I../../ViewRF -I/usr/include/QtCore -I/usr/include/QtGui -I/usr/include -I/usr/include/ffmpeg -I/usr/include/qwt -I/usr/include/QtSvg -I/usr/include -I/usr/include/libusb-1.0 -I. -I. -I../../ViewRF -I. -o spectrumplot.o ../spectrumplot.cpp
    ../spectrumplot.cpp: In constructor ‘SpectrumPlot::SpectrumPlot(QWidget*)’:
    ../spectrumplot.cpp:30:34: error: no matching function for call to ‘QwtPlotCanvas::QwtPlotCanvas()’
    setCanvas( new QwtPlotCanvas() ); ^

    Reply
    1. Choukoumoun

      I have that error :

      root@beaglebone:~/ViewRF# make
      dialog.ui -o ui_dialog.h
      make: dialog.ui: Command not found
      make: *** [ui_dialog.h] Error 127

      But I do :
      uic dialog.ui -o ui_dialog.h

      Anybody ?

      Reply
  15. dave

    Great project Stephen

    Got the code up and running at start of October. Couldnt wait or the LCD7 to become available so bought myself a 7″ lcd kit from China. It doesnt have touch screen for $45 but i can live with that!

    finally got it boxed up and running portably off a 12v supply tonight

    One thing i noticed was that if i tap plus0.1MHz or minus 0.1MHz it actually moves 0.2MHz… am I the only one seeing this?

    Reply
    1. stephen Post author

      Great to hear that you got it working, Dave.

      The change of 0.2 MHz is a side effect of the press-and-hold code that scrolls the display. I can get it to change by 0.1 MHz if I do a really short tap.

      Reply
    1. andrew

      +1 per the previous request for 4″ screen optimization. I’m guessing that such a configuration might be more common considering the price range. I’m currently running the 4.3″ Cape which has a 480×272 resolution. I’d be happy to fork and add the necessary changes myself if I had any idea of where to start…

      Reply
  16. dan

    If I manually made changes to the dialog.ui file to hopefully make the GUI scale correctly for the 480×280 touchscreen, what all will I need to compile/run to see those changes take effect? (please include commands) Thanks for any help!

    Reply
  17. Mikko

    Hello, would it be big effort to optimize this for beaglebone LCD-cape (3.5″) also? would save up a bit on energy consuming and easier to recase for portable use 🙂 Thanks for the nice app!

    Reply
  18. Ken

    I got ViewRF running on Fedora 20 Beta, with a few changes to the project file:

    diff –git a/ViewRF.pro b/ViewRF.pro
    index deb43ff..dbf0752 100644
    — a/ViewRF.pro
    +++ b/ViewRF.pro
    @@ -7,9 +7,8 @@
    QT += core gui

    # Comment this out to build on x86 or other !NEON platforms
    -CONFIG += neon
    +#CONFIG += neon

    -include (/opt/qwt-6.1.0/features/qwt.prf)

    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

    @@ -40,11 +39,13 @@ HEADERS += dialog.h \

    FORMS += dialog.ui

    -INCLUDEPATH += /opt/rtl-sdr/include
    -LIBS += -L/opt/rtl-sdr/lib -lrtlsdr -L/opt/libusb-1.0/lib -lusb-1.0 -L/opt/libav/lib -lavdevice -lavfilter -lavformat -lavresample -lavcodec -lswscale -lavutil

    -INCLUDEPATH += /opt/libav/include
    +CONFIG += link_pkgconfig
    +PKGCONFIG += libavcodec
    +PKGCONFIG += qwt
    +PKGCONFIG += librtlsdr
    +PKGCONFIG += libusb-1.0
    +PKGCONFIG += libavutil

    OTHER_FILES +=

    -QMAKE_CXXFLAGS += -Wno-psabi
    +QMAKE_CXXFLAGS += -Wno-psabi -D__STDC_CONSTANT_MACROS

    Reply
  19. Kostas

    Hi there,

    I applied the commands as described above and until stage 7 everything works smoothly. For stage 8 I managed until just before thee qmake. When I run qmake I get the following error:

    QMAKESPEC has not been set, so configuration cannot be deduced.
    Error processing project file: /home/root/qwt-6.1.0/qwt.pro

    I am new with all these including linux. Many thanks fo the interesting project.

    kostas

    Reply
  20. Dave L.

    Great project Stephen, thanks for sharing your efforts.
    I am having a problem starting ViewRF. I get an error “Error while loading shared libraries: libqwtE.so.6: cannot open shared object file: no such file or directory”

    I had a clean install and compile of the libraries. even figured out the Libusb0-dev requirement on my own (linux newbie), but can’t figure out which area to look at to resolve this error. Is it with the QT portion or the ViewRF?

    Your help is greatly appriciated!
    Dave L.

    Reply
  21. Ken Harris

    FYI, to compile on Fedora 20, install these packages :

    yum install qt-devel ffmpeg-devel qwt-devel libusbx-devel rtl-sdr-devel

    “ffmpeg-devel” requires adding the “rpmfusion” repo : http://rpmfusion.org/

    Also, as with all RTLSDR apps, you need to blacklist the DVB module :

    echo blacklist dvb_usb_rtl28xxu > /etc/modprobe.d/50-rtlsdr.conf

    Cheers!

    Reply
  22. Maximilian Arnold

    Hi ,
    I get an error while loading shared libraries: libqwtE.so.6 cannot open shared project. I dont knoe whats wrong. Everthing went fine through Installation.

    Thank you for responding

    Reply
  23. Nathan

    I am trying to do this build and I am stuck on

    Edit qwtconfig.pri, remove QwtOpenGL, QwtDesigner
    Edit ./src/src.pro, change TARGET to:
    TARGET = $$qwtLibraryTarget(qwt$$QT_LIBINFIX)

    after cd qwt-6.1.0 . I am running the build in Angstrom after opkg upgrade . I am ssh into BBB and it is giving me “-sh: Edit: command not found”. Is Edit a package to be installed or am I just not doing this right? As you can tell I am kind of a newbe. can any bode steer me in the right direction so I can finish my build. thanks

    Reply
    1. Ryan

      Nathan:
      Edit means you need to open the program and manually edit. You can use a pre-installed text editor like Vim (use command vi ) and the file name. Take a few minutes and look up a Vim tutorial to get yourself started if you’ve never used one before.

      Reply
  24. Eric

    I too am getting the” libqwtE.so.6: cannot open shared object file: No such file or directory” error. Can anyone assist?

    Reply
  25. Mike McPherson

    Thanks for this very cool and useful project, Stephen! I was happy to see the announcement that the new BeableBone Black will ship with Debian instead of Angstrom, so I decided to have a go at building my ViewRF spectrum analyzer on the beta Debian image now available on the BeagleBoard site. I’ve documented my build on my Web site at http://kq9p.us/index.php/projects/13-projects/17-building-a-viewrf-bbb-sdr-spectrum-analyzer.

    The only thing I haven’t been able to get working is the touchscreen. ts_calibrate works, but it doesn’t work in the ViewRF application. If anyone has ideas I’ll be grateful.

    Mike

    Reply
    1. Mike McPherson

      Problem solved! (What would we do without Google?) Turns out that tslib support is not the default when you build QT4 from source. Rebuilt it with tslib support and I now have a fully functional ViewRF spectrum analyzer! Thanks again, Stephen!

      73, Mike KQ9P

      Reply
      1. Jeff

        I know this is an old post, but I am trying to get ViewRF to work on my BBB with Debian, and I ran into the same problem as some previous posters: error while loading shared libraries: libqwtE.so.6: cannot open shared object file: No such file or directory. I think that means that it is looking for an embedded version of libqwt. I have tried a few ways of getting around it, but can’t seem to get it to work. Any suggestions?

        Reply
        1. Milan Morávek

          Any luck with this Jeff? I wrote a service to launch ViewRF after boot, but it always says it can’t find libqwtE.so.6
          Launching the app manually or through bash script works just fine. Launching the app or the bash script returns the error.

          Reply
  26. Simon Chantrill

    Have just tried reinstalling this software (with libusb-1.0-dev also) and using it on a 4D Systems 7″ LCD cape for the BBB. Seems to work even better that the CircuitCo unit and it only cost $130.50 from littlebirdelectronics.com out of Sydney. Now I can finally make the portable field system I’ve been wanting.
    Simon
    vk4tsc

    Reply
  27. Mike433

    Hi
    I can see that u were able to scan the spectrum and view Analog (PAL) as well as Digital TV stations (DVB-T).
    How did u manage to do so given that the device is capable of outputting an approximated 2.5 MSps in maximum?
    I am also interested in knowing the demodulation scheme that you used for the PAL and the DVB-T, because I have seen people doing only AM and FM scanning in their projets and u are the first which i saw (yet) capable of viewing the spectrum of the TV signal.
    Any clarification on that would be super helpful.

    Once again congratulations for the amazing work.
    Thanks and regards.

    Mike.

    Reply
  28. Justin

    Stuck on step 8.
    Edit qwtconfig.pri, remove QwtOpenGL, QwtDesigner
    Edit ./src/src.pro, change TARGET to:
    TARGET = $$qwtLibraryTarget(qwt$$QT_LIBINFIX)
    Continue with the compilation process:
    qmake
    make
    make install

    I do the make command, and I get “/bin/sh -DQWT_NO_OPENGL: command not found” then some stuff about error 127 and 2 lines later it ends with error 2. I edited qwtconfig.pri with nano, and deleted the entire line:
    QWT_CONFIG += QwtOpenGL
    and the same with the QwtDesigner. Am I doing something wrong?

    Reply
  29. Don

    Wow , what a great project. I went looking for a DIY spectrum analyzer and found your project.
    It took me a little while to get thru the software but I finally did. Works like a champ.
    The only thing I wish would be some kind of zoom function so I could look closer at
    narrow band signals. Thanks again for such a valuable project.
    Don B in PA

    Reply
  30. Mike

    While I am still somewhat new with the beaglebones I am picking up pretty quickly. I am trying to use this with a Chipsee 7″ display. I follow the directions with no problems that I noticed. However after I hit power my touchscreen is still not turning on. Can anyone point me to where to look or how to troubleshoot this?

    Reply
  31. John Lannigan

    Hello Steven,
    Your Spectrum analyzer project is quite simply, brilliant. I have the basics up and running and its very impressive. I have a small question to ask. I am not a software expert by any means, but i wondered what is involved in using hardware connected switches to select the frequency steps and other things? I plan to use this for amateur radio and i want to build this as a portable device without the use of a mouse or touch screen. Can this be done?

    John G8TDU

    Reply
  32. egbert

    I have been trying to get QT to cross compile on BBB for about a year—- no success
    I have been trying to write to LCD 7 —— no success

    It appears you have done both, could you steer me in both directions ? Need help
    !! thanks

    Reply
  33. Milan Morávek

    Hello everyone. Does anyone have an idea on how to start ViewRF right after boot like Stephen has it in his video?
    I wrote a service, troubleshooted for about two days before finally getting it to start (had to copy libraries to system loactions, it doesn’t find libqwtE), however the axes of touchscreen are swapped. When I run it manually it behaves just fine, no swapped axes, no problems with libraries not found. I can’t seem to figure it out on my own (I’m a linux noob).
    Using BB-View 7″ LCD Cape from Element 14 on BBB with Angstrom 2013.09.04 (BBB-eMMC-flasher-2013.09.04), patched according to Element 14’s instructions. Touchscreen works fine in gdm, ts_calibrate works as well, manually running ViewRF works fine too, only running it through service makes it swap axes.

    Reply
  34. ben

    Anyone try this using the debian for the Beagle Bone Black?

    Also could the video be streamed from the BBB to be viewed from anywhere on the network (x11 forwarding)? Or would the latency and refresh rate make it unusable as a spectrum analyzer?

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *