2013/02/08

Raspberry Pi vs Pandaboard or "The quest for a low-consumption HTPC"

In my latest article, I tested the video output capabilities of the little RPi as a usable HTPC. While it can be used as very efficient and low-consumption movie player using XBMC (no matter what flavour: Xbian, Raspbian or OpenELEC), I found it hard to use it as a download server, since it does not provide enough power to feed external USB drives. Some time ago I bought a Pandaboard ES. It is also a small ARM based computer, quite powerful and, while it was intented to be as an Android sandbox development board, there are Ubuntu distributions that can be used for other purposes (like, creating a download server or media center). So, I decided to give it a try and see if the Pandaboard could substitute the RPi as a tiny and efficient HTPC. Keep reading to check the results.

Raspberries for breakfast!


Setting up the pandaboard

I've used the Pandaboard mainly as a server machine, used to deploy several OSGi bundles we use at work. It performs considerably well as a server, being capable of handling hundreds of connections with no issues. Sadly, at least before I tried more recent images, desktop experience in the pandaboard was a real pain. First image I tried was Ubuntu 11.10 with Unity. The pandaboard was not even able to move windows and drag&drop was totally unresponsive, thus making the user experience a nightmare.

That said, I did a little digging and found a distribution that can be used with the pandaboard in order to unleash its full graphic potential: Linaro. Linaro is a developer community highly active devoted to provide OS operating systems distributions for ARM processors. They have distributions for Android, OpenEmbedded and Ubuntu aiming several developer hardware platforms like Origen, Pandaboard, Snowball and Versatile Express boards. For the pandaboard, there are Android and Ubuntu distributions. I decided to try the Ubuntu one. Follow this steps to get the image flashed in your SD card:

  • Add the linaro repository to your sources list in order to install linaro tools
  • 
    $ sudo add-apt-repository ppa:linaro-maintainers/tools

  • Install linaro-tools, which will help you in flashing the images to the SD card. You can use dd command directly, but I highly recommend this tool, dd'ing didn't work for me
  • 
    $ sudo apt-get update
    $ sudo apt-get install linaro-image-tools

  • Get the latest ubuntu linaro releases for the panda. Both the main image and the hardware pack:
  • 
    $ wget http://releases.linaro.org/13.01/ubuntu/boards/panda/linaro-quantal-developer-20130128-256.tar.gz
    $ wget http://releases.linaro.org/13.01/ubuntu/boards/panda/hwpack_linaro-panda_20130128-58_armhf_supported.tar.gz

  • Insert your SD card reader and check where it was mounted, should be something similar to /dev/sdbX
  • 
    dmesg

  • Unmount the SD card reader, this is always mandatory before flashing!
  • 
    umount /dev/sdbX

  • Use linaro tools to flash both images to the SD card
  • 
    sudo linaro-media-create --mmc /dev/sdX --dev panda --hwpack hwpack_linaro-panda_20130128-58_armhf_supported.tar.gz --binary linaro-quantal-developer-20130128-256.tar.gz
Ready to plug your Linaro SD card and give it a try in the pandaboard! Unfortunately, I never managed to create the image myself with linaro image tools, so I had to use a pre-built image, and here is where the fun begins.

The provided images here are headless images intended for development, thus, no desktop is included. In case you need (that was my case for a HTPC), so what you really need is Linaro Evalution Builds or LEB which include the desktop packages. Funny enough, I also found a 12.06??? ubuntu desktop release for the panda, that oddly, weights about hundred more megs than the "official". That's one of the confusing things about Linaro, there are many hidden URLs that provide different builds, so it can be a bit of a mess. I tried both and they both seem to work fine, so up to you to choose. Let's go with the official one:

  • Get the pre-built image
  • 
    $ wget http://releases.linaro.org/12.11/ubuntu/precise-images/ubuntu-desktop/linaro-precise-ubuntu-desktop-20121124-560.tar.gz

  • Uncompress the image
  • 
    $ gunzip linaro-precise-ubuntu-desktop-20121124-560.tar.gz

  • Flash it to your SD. Remember to unmount first! In my case, sd card is mounted in /dev/sdb
  • 
    $ sudo dd bs=4M if=linaro-precise-ubuntu-desktop-20121124-560.img of=/dev/sdb
Ok, now you can test it in your panda. Plug it in and give it a try. Now you have a few options here. If you have a stable system with this image, go ahead and install XBMC to try the video capabilities of the pandaboard. I did this and found that GPU acceleration was not as close as, to put an example, as with the RPi, resulting in clumsy movie play.

That said, I renounced to used this image and looked for an "already built" XBMC solution for the panda, sort of like Xbian, OpenELEC, etc for RPi. To my dismay, there does not seem to be the same initiative regarding the pandaboard, probably because the GPU capabilities of the panda are not the same, and most important, the guys developing Linaro are not getting all the kernel support from Texas Instruments.

The only available XBMC build I found for the panda is the one created by Ricardo Salveti. Unfortunately, the links provided are broken and no way to found the pre-built images. Lucky you, I managed to get one of those before the links were gone, and I've uploaded the image I have to my dropbox. Process is as before, flash it to your SD card and you'll get a XBMC working in the Panda. Once again, unfortunately, perfomance compared to the RPi when it comes to playing video was way down. Even worst, when trying to login in the undelying OS (precise with Unity AFAIK), never managed to make it work. I wanted to try the pandaboard as a download server + media player, not just the latest, otherwise I'd stick with the RPi, so this image was NOT an option for obvious reasons.

At this point, if you managed to make the panda work with the Linaro desktop images plus installing XBMC and your download stuff, and you're happy with the performance, I'd recommend you to stop reading. What comes next is my struggle to get a decent download server in the pandaboard. 

Going back to origins

Pandaboard performance with FullHD

Playing video files at decent frame rates with high resolutions (720p, 1080p) became an impossible task for me. Thus, I decided to simply download the official Ubuntu release for the panda (not the Linaro one), install p2p related software and attach my external USB drives. Pretty much the same setup I have with my old HTPC, "the mother of all the noises" Asrock ION 330T. The process is very similar to depicted above:
  • Get the latest Ubuntu release for the pandaboard:
  • 
    $ wget http://cdimage.ubuntu.com/releases/12.04/release/ubuntu-12.04-preinstalled-desktop-armhf+omap4.img.gz

  • Uncompress
  • 
    $ gunzip ubuntu-12.04-preinstalled-desktop-armhf+omap4.img.gz

  • Flash the image to your SD card. As usual make sure SD is not mounted already and you that you know drive letter. In my case it was /dev/sdb
  • 
    $ sudo dd bs=4M if=ubuntu-12.04-preinstalled-desktop-armhf+omap4.img of=/dev/sdb

  • Sync
  • 
    $ sudo sync

Now you should be able to plug your SD card and get a fresh install of Ubuntu on the pandaboard. There are a few recommendations on how to improve overall performance. Here is a list and my thougts after trying them:

  • Disable swap. Edit your /etc/fstab file and remove the following line:
  • 
    $ /SWAP.swap  none  swap  sw  0 0

I didn't really see any improvement doing this. This is supposed to be effective if you're experiencing sudden lag because of memory swapping, but that was not my case.

  • Enable tmpfs in fstab. Add these two lines to /etc/fstab:

  • $ tmpfs /tmp          tmpfs nodev,nosuid                  0 0
    $ tmpfs /var/log      tmpfs nodev,nosuid                  0 0
    

Same as before, not feeling any performance boost with this, at least on a X session. Just give it a try.

  • Substitute Unity with Xubuntu or even better, Lubuntu:

  • $ sudo apt-get install xubuntu-desktop
    $ sudo apt-get install lubuntu-desktop
    

Xubuntu works faster than Unity in the panda, and you can get a really good UI performance boost with Lubuntu. No matter what you choose, prepare for a long install (about an hour or so), so grab your mug and go for a coffe :D

Best mug for chilling

  • Install omap4-extras. Additional packages that enable video hardware acceleration (among other things) in the pandaboard:

  • $ sudo add-apt-repository ppa:tiomap-dev/release
    $ sudo apt-get update
    $ sudo apt-get dist-upgrade
    $ sudo apt-get install ubuntu-omap4-extras
    

Get ready for a VERY long install. Besides, I never managed to make this work. NEVER. Actually I did, but it results in a unstable pandaboard that crashes, freezes and hangs every now and then, thus I can't recommend it unless you absolutely plan to use hardware acceleration on the pandaboard. Me, I gave up after 4 or 5 SD flashes and starting from scratch each time.

  • Change default cpu frequency governor policy

  • $ echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
    

Again this resulted in a very unstable system in my case, constant reboots and system freezes. Can't recommend it.

The solution

Just came to the following conclusion: the pandaboard can't be used for streaming FullHD video while the Raspberry Pi is not good enough as a download center, but performs incredibly well playing fullHD videos. So? Why not use the panda exclusively as a download center and the RPi as a movie player? And that's what I did. There are some people that use just a couple of RPi for this, but I already have a couple USB external drives up to 3TB, so I just simply didn't want to throw them away and having to buy a hard drive case with external power supply. This is because, as you  may already know, the RPi is not capable of powering up external USB drives.

Thus, I just installed the official Ubuntu release on the panda with nothing extra besides installing Xubuntu desktop and Xbian on the RPi for playing videos. On the other hand, I have used my already existing Xbian image with the RPi to use as the video player machine. The following picture depicts my layout:

Device layout

As you can see, I'm using two HDMI cables instead of one for the RPi. The reason for this is that there is no way the RPi will be able to send a DTS/DD decoded signal decently, you only get what is known as "downmixed stereo"...plain 2-channel sound, ok if you don''t have 5.1 and DTS receiver, but I have one and REALLY enjoy surround, so this was not an option.

Your only chance then is to send the VIDEO&AUDIO signal directly from the RPi to your AV receiver, and it will responsible of audio encoding/decoding. Besides, your RPi will get a small performance boost, since it does not care any longer about video & audio, just spits it directly from its HDMI out to your AV receiver. The receiver will get the audio signal and based on its properties decide how to decode it. Now to get video out to the TV, you'll need another HDMI that goes from your receiver to your TV/project/whatever (see picture above).

New HTPC in da house

In case you're wondering, the white box is encasing the pandaboard. You can get one here. Or, you can be super cool and build your own (provided you can access a laser cutting printer)...

I had to buy two 10 meter long HDMI cables, not really expensive (about 10€ each), but the pain comes to actually installing them...it takes some time, but it is worth every minute afterwards, when you can enjoy. This is how it looks on the back of my TV:

Keep them tidy
Now let's see how to setup the pandaboard to become a decent download media center


Setup pandaboard as download center

Setting up a download media server is pretty straight forward, but here are some tips in case you miss something (like I did). I'm supposing you're starting from a freshly installed Ubuntu image with Xubuntu or Lubuntu installed.

Static IP on your pandaboard


It is nice to have a static IP assigned to your pandaboard, specially if you plan to access it via ssh or Remote Desktop, like me. Besides, setting a static IP will allow accessing your panda from outside your home network. Always cool to manage your downloads from work :).
  • Modify your network interface configuration
  • 
    $ sudo vi /etc/network/interfaces

  • Delete the contents (make a backup first if you desire) and insert the following:
  • 
    $  # The loopback interface
     auto lo
     iface lo inet loopback
     auto eth0
     iface eth0 inet static
     #your static IP
     address 192.168.1.X  
     #your gateway IP
     gateway 192.168.1.1
     netmask 255.255.255.0
     #your network address "family"
     network 192.168.1.0
     broadcast 192.168.1.255

  • You might have to change eth0 for ethX depending on your ethernet naming. Besides, your home network may differ from 192.168.1.X to something different, adapt it to your needs. The important thing here is that you specify the address you want in the "address" section. Reboot your network interface:
  • 
    $ sudo /etc/init.d/networking restart

  • Specify nameserver for DNS lookup. Don't edit /etc/resolv.conf since it will be deleted after each reboot.
  • 
    $ sudo vi /etc/resolvconf/resolv.conf.d/head 

  • You can use your router IP or an external one like Google nameserver (8.8.8.8)
  • 
    $ nameserver 8.8.8.8 

  • Restart resolv.conf
  • 
    $ sudo resolvconf -u 

  • Check your nameserver is resolving correctly and that you can actually download something...
  • 
    $ nslookup google.com | wget google.com 

 

Installing Samba


My setup required the RPi to access media from a external USB drive that is actually connected to the panda. Thus, I need the panda to share that drive in my home network. You can choose NFS instead of Samba, but I'm used to Samba and find it easy to setup, and besides, it just works, so keep it simple
  • Download and install samba
  • 
    $ sudo apt-get install samba 

  • Add an entry in samba configuration to your new share. In my case, it is a shared folder from my toshiba external USB drive
  • 
    $ sudo vi /etc/samba/smb.conf

  • Add an entry in samba configuration to your new share. In my case, it is a shared folder from my toshiba external USB drive. First edit the global config for samba. Substitute with your desired values
  • 
    $ [global]
    workgroup = [workgroup]
    netbios name = [name of="" server=""]
    server string = [title]
    log file = /var/log/samba/log.%m
    max log size = 50
    map to guest = bad user
    socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
    local master = no
    dns proxy = no

  • Now add an entry for each shared folder you want to serve:
  • 
    $ [public]
    path = [folder to share]
    public = yes
    only guest = yes
    writable = yes

 

Mounting external drive automatically


Previous Samba configuration requires that you have the shared folders you want to share mounted at start-up. Thus, we'll have to modify /etc/fstab file so it does this automatically each time at boot. In my case, I have a external usb drive that will be mounted on startup, where a couple of folders will be shared.

  • Plug your drive and check device name. Should be on of the last entries, something like /dev/sdb1 or similar
  • 
    $ sudo mount

  • Create a folder where the drive will be mounted at startup. Change it to suit your needs
  • 
    $ sudo mkdir /media/toshiba_drive

  • Modify /etc/fstab so it mounts our drive at startup
  • 
    $ sudo vi /etc/fstab

  • Append the following, change it accordingly
  • 
    $ /dev/sdb1 /media/toshiba_drive auto auto,user,rw,exec 0 0
Reboot and check that you can access the shared drive from another computer or even better, from Xbian on the RPi.

 

Installing a remote desktop server


Let's face it, having to switch from one computer to another is annoying. I love the idea of controlling almost every device at home with just one computer. Hence, I recommend you to install a VNC server. There are quite a few options here, the most simple using xrdp, which does not require any configuration and works straight away. It is a shame there are no NX machine binaries for ARM Ubuntu machines, because it is by far the best Remote Desktop server-client in my opinion. Another option that I prefer is x11VNC, mostly because it uses the server X session, not creating a new one. The following instructions work for Xubuntu, but I recon they should also work for Lubuntu.

  • Install x11vnc and openssh server
  • 
    $ sudo apt-get install x11vnc openssh-server

  • Create a password to access your X session. Not mandatory, but recommendable, specially if you plan to access outside your home network
  • 
    $ sudo x11vnc -storepasswd [yourpass] /etc/x11vnc.pass

  • Create a script that will start the x11vnc server even if the X session is not started yet:
  • 
    $ sudo vi /etc/init/x11vnc.conf

  • Append the following, change it accordingly. Change the geometry parameter to fit your client screen resolution. Also, if you plan to access from other networks, use port 80 to tunnel the session. Most likely port 5900 is closed by default in many networks
  • 
    $ start on login-session-start
    script
    x11vnc -rfbauth /etc/x11vnc.pass -rfbport 5900 -display :0 -auth /var/run/lightdm/root/:0 -forever -bg -o /var/log/x11vnc.log -noxrecord -noxfixes -noxdamage -nomodtweak
    end script

  • Reboot
  • 
    $ sudo reboot
    
Now for the client part, I used the default client in many distros, Vinagre. Obviously it is up to you which one to choose. Just remember your IP:PORT and password (in case you specified one) and you should be good.

Accessing your pandaboard from the Internet


If you're willing to access your pandaboard via ssh or remote desktop from other place beside your home network, you're gonna need some service that offers a static IP you can access from a dynamic IP, the one your router has. There are many but I decided to choose No-IP. Create a free account and register your domain. Now its time to install the required client. On older Ubuntu versions this was easier since there was a package, but since Ubuntu 12.04, is a bit more tricky.

  • Download and install latest no-ip client
  • 
    $ cd /usr/local/src/
    sudo wget http://www.no-ip.com/client/linux/noip-duc-linux.tar.gz
    sudo tar xf noip-duc-linux.tar.gz
    cd noip-2.1.9-1/
    sudo make install
    

  • Enter your login information when prompted and get ready to configure the client
  • 
    $ sudo /usr/local/bin/noip2 -C

  • Enter the login information again and follow the instructions to create the initial configuration. The most important bit is the one about the hostname. Once finished, you can start the client
  • 
    $ sudo /usr/local/bin/noip2

  • Include the command to init.d so it starts always on reboot
  • 
    $ sudo vi /etc/rc.local
    

  • Include the following before last instruction "exit 0"
  • 
    $ /usr/local/bin/noip2
    

  • Reboot
  • 
    $ sudo reboot
    

You should have an accessible pandaboard via URL similar to http://yourhostname.no-ip.org and depending on your services, you can access them via ssh, VNC, Apache, whatever you've installed.  NOTE: You will also need to forward ports in your router to your panda to whatever ports you have open, otherwise you won't be able to access them. Since this is highly dependent on the router brand/model, it is useless to point instructions here, just check your router User Manual on how to port forward to the pandaboard static IP.

Final thoughts

I'm quite happy with the transition from my old NOISY Asrock ION to the combination of panda-RPi.

So long, dear friend
Been using both for a week now and I'm not missing any previous functionality, plus having a more energy efficient solution and, above all, a SILENT one. That said, there is one final detail that was not really a complaint, but you know, I don't like having to plug/unplug my panda/RPi each time I want to completely turn them on/off. 

Now for the RPi there are some solutions. One is to create a hand-made micro USB cable with a switcher or just pay for one (a lot in my opinion). For the panda, my case is not letting me access the power button, and I couldn't find any 5V power supply with on/off built-in switcher. Thus, I just came to a much more efficient and cheaper solution.

Living on the bleeding edge, yeeeha!
There are obviously alternatives for US plugs and I'm sure there must be too for UK. Any electronics & hardware store can also have some of those.

Maybe it would have been easier to just buy a Cubox and have a single machine, but hey, then I'd miss the fun :) Hope you find this post useful if you're planning to use the pandaboard or the RPi as a feasible HTPC solution. Enjoy!

13 comments:

  1. I'm to configure the pandaboard as streaming server right now. But the regular pandaboard, not the ES version.

    Hope to find a good distro without X11 server. Just torrent, no-ip and NFS

    ReplyDelete
    Replies
    1. Hey!

      There are many, armstrong or even Linaro, with comes without X11 server by default. Let me know how it goes :)

      Delete
  2. Great post. I too am finally giving up on using my Panda Es as a media center.
    And you are right with the Pi not being good for usage as a server.
    Cheers
    Pranay

    ReplyDelete
    Replies
    1. Yeah, a shame you need external storage for the RPi or a NAS. Still, it is an amazing little one :). Thanks for your comment!

      Delete
  3. There is very good native Pandabord ES support from GeexBox

    http://www.geexbox.org/download/

    XBMC Distro

    ReplyDelete
    Replies
    1. Should add I've only tested 720p 4Mbit mkv's on it.

      Plays smoothly

      Delete
    2. Sounds good! I'll be testing it soon! Thanks for pointing that out!

      Delete
  4. Thanks for a nice post! I was struggling with the same thing over a year ago, and in the end I got it to work. I can now play basically all 720p and 1080p videos without any glitches, and I've set up a xbmc, sickbeard and couchpotato combo for downloading. I don't remember the details, but I used one of the linaro releases and did a work around to remove the stuttering video (had to do with monitor detection I think). I can dig a bit more if someone is interested.

    ReplyDelete
  5. Also, if you have an enormous amount of extra time, you can build your own box for the pandaboard out of wood :) (http://dontbuyjustmake.blogspot.nl/2013/07/box-for-pandaboard.html)

    ReplyDelete
  6. Wow! That's some SERIOUS work, thanks for sharing Ulf! I've found something similar but much simpler, but you needed a laser cutter printer to cut the wood, something not easy to find, ans specially expensive. Thus, I ended buying the standard pandaboard box (the white one). I might give it a try, looks like a good idea :)

    ReplyDelete
  7. Very Good! This is exactly what I want to do. Do you have digital audio working on the HDMI?
    Would it be possible to share the binary images? it could save many time :)

    Many thanks!

    ReplyDelete
  8. Hello David,

    You mean for the panda or for the rpi?

    Regards,
    Alejandro

    ReplyDelete
  9. This comment has been removed by a blog administrator.

    ReplyDelete