Raspberry Pi 2 as Plex Media Player with RasPlex – Complete Guide and Setup


Background

       Currently I am using a custom windows HTPC for main media player and whs 2011 server hosting Plex Media Server. It plays everything I throw at it flawlessly and you can see previous posts on that setup. I do have a few issues with display and sleep/wake issues where it doesn’t all show up on screen. This isn’t a big issue for me as I know a couple of buttons to try that will wake it up, but the wife gets confused sometimes and complains. I will probably work on that in the future, but with the new raspberry pi 2 I decided to give it a go and see how well it works. We are moving shortly and will add second tv in bedroom so this would be perfect device to add to second tv.

What parts to order

Buy a preconfigured Kit

    

Or

    

Optional Remote

        

Optional for initial Setup (USB Keyboard)

  • You can choose to stick with the bare Raspberry Pi 2 (make sure its the newer 2 version). To be honest, for all you get with the kit its worth it even if you don’t end up using all the parts they give you. I went with Canakit because of the black case. 
  • Of the optionals I added the FLIRC so I could use it with the Logitech Harmony Smart Remote. This is optional based on your setup because some people will be able to use CEC with their TV’s. The CEC path was just too laggy for me, however the power management would have been nice that comes with CEC. I will discuss how to setup with FLIRC to work with Harmony remote below. Some people go with a Windows MCE Remote USB dongle which would work as well. I already have one connected to my HTPC so I didn’t want interference of signal and difficulty of setting up 2 MCE remotes in harmony software. 
  • You will need basic usb keyboard for the initial setup, but won’t need it again after that
  • The Canakit comes with a cheap class 6 8GB microsd card that seems to be working fine with my setup, but I am planning on upgrading to a class 10 16GB/32GB card
  • It also comes with a cheap wifi usb dongle. If you want a faster/better dongle than you can upgrade to Panda 300Mbps here
————————————————————————————————————————–

1. Go to this website and download RasPlex for whatever you operating system you will be using to install Rasplex. I have a mac so chose OSX.

2. Open up GetRasPlex program

3. Enter your computer’s password into the terminal window that opens up. This will open up a graphical interface of RasPlex

4. Insert your microSD card into an adaptor and plug it in to your computer

5. Under ‘Select Your Device’ choose Raspberry Pi 2

6. Under ‘Select Version’ choose 0.5.1 (currently the most current build)

7. Under ‘Select Device to Flash’ choose your memory card that you inserted

8. Click Download (this will download the version you selected)

9. Once its done downloading you should be able to select ‘Write SD Card’

10. Once its done you can remove the SD card and put it in the Raspberry Pi memory card slot

————————————————————————————————————————–

11. Go to this FLIRC website to download the software to program remote

12. Open up FLIRC

13. Now you need to choose how complex you want your remote to be. The basic standard setup would be useful is you want to use an Apple Remote (from Apple TV). I chose to use Kodi as it is similar to Plex. Go to Controllers at the top of the screen from menu bar and select which device you want to use.

NOTE: Before you continue you should have already programed your harmony remote to use with Plex and have that activity working and active when setting up FLIRC remote. Harmony has a special device for plex so when setting it up choose Plex as the manufacturer as well as the model.

14. Grab your harmony remote (make sure the plex activity is active on the remote) and program the remote by selecting the button with the software and then pressing the corresponding button on the remote. Their should be feedback from the software that says pairing complete.

        – I paired Up, Down, Left, Right, Enter/Select, Fast Forward, Rewind, Info, Back, Home (Exit)

15. Unplug FLIRC from computer and plug it into USB port of Raspberry Pi

————————————————————————————————————————–

16. Use Plex app instead of remote control

  • The Plex app is available for iOS, Android and even Windows Phone. It is both a Plex client (so you can stream movies to your mobile if you wish) and a remote control for other Plex clients. 
  • Tap the Choose Player button — it’s the rectangle with the WiFi symbol in one corner — and select the player you want to control; in my case it’s plexhometheatre on rasplex. If I had Plex running on any other device it’d also appear on this list.
  • Once you’re connected, if you select a movie or TV show in the Plex app on your mobile, it will play on your Raspberry Pi. You’re also able to pause, fast forward, rewind or change what you’re watching from the app.

————————————————————————————————————————–

17. Network – You can plug in Wifi adaptor that comes with canakit or use ethernet for better performance. Note-I have read of usb issues when using wifi adaptor and other usb devices at same time

————————————————————————————————————————–

18. Power on raspberry pi by plugging the power cord in

19. Go through initial RasPlex Setup

  • Select your regional settings (most likely ‘English’ if you are reading this!)
  • Setup networking – you will need to select you wireless network and login. Wired networks should not need any configuration. If all is working well, you should be assigned an IP address by your router or DHCP server
  • Calibrate your screen – You will be asked to setup the corners, subtitle location, etc.
  • Login to your ‘My Plex’. You will be asked to use your computer (or any device with a web browser really) to navigate to plex.tv/pin and input you pin and connect.
  • Pre-caching – you will be asked to ‘pre-cache’ much of the meta data from your Plex server to improve performance. You will need to reboot after install is complete for this to take effect.

20. Optional – Overclock Raspberry Pi to speed things up. 
         There are two ways to do this. Locally with microSD card attached to computer or through ssh. 

  • SSH
    • Make note of your Raspberry Pi IP address which can be found in “System Settings – > Connections”
    • Use your choice of program to ssh into your raspberry pi (I prefer terminal in OSX)
    • type ‘ssh root@(ip address of raspberry pi)’ without quotes 
      • ex. ssh root @192.168.1.12
    • Enter your RasPlex password (default is rasplex)
    • type  mount -o remount,rw /flash
    • edit /flash/config.txt using nano: nano /flash/config.txt
    • I chose to go with High settings (don’t mess with turbo). Look for the image below and replace with what level you choose
    • Hit ‘control + X’ on keyboard
    • Type ‘Y’ to save file
    • Hit ‘Enter’ on keyboard to confirm overwrite
    • Type reboot and hit enter in terminal to reboot raspberry pi


overclock

  • Local
    • With the MicroSD card still connected to your computer, navigate to it using Windows Explorer or Finder.
    • Change the arm_freq, core_freq, sdram_freq and over_voltage to match the recommend values you want (see image below).
    • Open the file config.txt in a text editor. Under Overclock mode settings you’ll see the recommended overclock configurations. Beneath them is where you change the settings. I set mine to High.
    • Eject the MicroSD card and insert it in the Raspberry Pi.
    overclock


    21. For some reason the CEC adaptor and my FLIRC were being interfered and the responsiveness of the remote just wasn’t up to par. So if you are having remote issues and you see a CEC adaptor enabled when loading RasPlex I recommend going disabling CEC.

    • Go to Preferences of RasPlex
    • Go to input devices
    • Select the CEC adaptor
    • Turn off all functions of CEC by unchecking all items
    22. Other options for speeding up RasPlex

    • Precaching – HIGHLY RECOMMENDED
      • Precaching is recommended by RasPlex. It copies a cache of images, thumbnails, and metadata to the client side in order to speed up menu browsing. To ensure that all the images, thumbnails and meta data is copied to your Raspberry Pi, you can force ‘precaching’.
      • To do this browse to the left to access the settings menu. There will be an option to ‘control precaching’ then select yes to begin the global precaching. Note that if you are connected to Plex servers with large libraries or to remote Plex servers, it will take sometime to download all of the images and metadata. Once this is complete, you should notice browsing your libraries to be quite a bit faster.
    rasplex performance
    • Disable Background Slide Show
      • I’ve find that while all the media displayed in the background looks pretty good, it does tend to slow browsing the menus and your media down. To disable the slide show go to: “Preferences -> Appearance -> Advanced -> Settings -> Disable All Slide Shows”.
    rasplex performance
      • It is also possible that you can switch to a lighter weight skin, but this is not something I’ve explored. 
    • Disable Unwanted/Unused Services
      • Many users have reported that disabling some of the services you are not using, like samba, SSH, cron, etc can speed up RasPlex. I’m not sure I noticed much difference, but if you aren’t using these services anyway it certainly can’t hurt to disable them. You can review the services running by navigating to the left and then selecting “System Settings – > Services”. There are also some other services such as AirPay and UPnP which can be disabled if you are not using them under “Preferences -> System -> Services”.
    rasplex performance
      • It has also been reported that disabling sending anonymous performance data might help performance. Again, there wasn’t a perceptible difference for me. You can disable by clicking left and going to: “Preferences – > System – > Advanced – > Allow Plex collect anonymous data to improve your experience”. But if you don’t see an improvement and don’t mind sending some data back to Plex you may contribute to the project by leaving it on.
    24. Install Media Codecs (If needed to play some content on Plex)
    • What You will Need 
      • An MPEG-2 (~$4)and/or VC-1 license(~$2) purchased from the Raspberry Pi store.
      • Access to the command prompt on the Raspberry Pi 
    • First, I will walk you through getting the serial number off the board and purchasing the licenses you need. After that, I’ll show you how to manually add the licenses to your Pi.
    • Purchasing the Licenses
      • In order to purchase the licenses you need, you will have to retrieve the unique serial number for your Raspberry Pi board. This number is not printed anywhere on the circuit board but is instead stored in the hardware; it must be retrieved using the command prompt.
      • Retrieving the Serial Number: First, visit the command prompt via an SSH tool such as Terminal. 
      • The default password for RasPlex is rasplex.
      • Once at the command prompt enter the following command: cat /proc/cpuinfo
      • Your Pi will spit back 11 lines of text, but the only one of interest to us is the last line labeled Serial. Copy the unique 16 digital serial number (partially obfuscated in the screenshot here).
      • Because the license is granted to each specific Raspberry Pi board, repeat the above process for all Raspberry Pi boards you wish to purchase a license for.
      • Once you have the the serial number for each individual unit, it’s time to purchase the licenses from the Raspberry Pi foundation.
    • Purchasing the License: Visit the Raspberry Pi foundation’s purchase page for the MPEG-2 license and/or VC-1 license.  Enter your Raspberry Pi serial number in the appropriate blank beneath the price. Add the license to your cart. Repeat this process for all the licenses on all the units you wish to add the codecs to.
    • Although the foundation indicates that it could take up to 72 hours for your license to arrive via email, we received ours in about 24 hours. When your email arrives it will include a code for each license formatted like such:
      • decode_MPG2=0000000000
      • decode_WVC1=0000000000
      • The 0000000000 portion of the license is your unique 10-digit alphanumeric license code.
    • Installing the Licenses
      • Now that we have the license codes, it’s time to add them to your Raspberry Pi and get to enjoying enhanced media playback.
      • type  mount -o remount,rw /flash
      • edit /flash/config.txt using nano: nano /flash/config.txt
      • Cut and paste the formatted license entries you received in your email below the lines that include the # (This denotes a note in computer code so the OS knows to ignore anything after this point. Therefore when you copy the licenses make sure there is no # before them.)
      • Hit ‘control + X’ on keyboard
      • Type ‘Y’ to save file
      • Hit ‘Enter’ on keyboard to confirm overwrite

      • Type reboot and hit enter in terminal to reboot raspberry pi

      • You can verify that the licenses are installed correctly by ssh into your pi and type the following
        • vcgencmd codec_enabled MPG2 
        • vcgencmd codec_enabled WVC1 
      • Should say license is enabled

    Apple Airport Time Capsule/Extreme vs Netgear R7000 Nighthawk Router Speed Tests (DDWRT)

    I recently switched routers to Apple Airport Time Capsule (AC version) and I wanted to do a couple speed tests with my previous Netgear R7000 Nighthawk running DDWRT. I tested 2 versions of DDWRT and the most uptodate firmware of Time Capsule. I only tested 5.0GHz network so when I get time I will go back and test the 2.4GHz as well. I would also like to run stock firmware on the Netgear and test that as well.


                  



  • 1st test was Upload/Download speeds to see if there was a difference which depends on what internet speed you have with ISP (I have TWC and 100Mbps/5Mbps in NYC.
  • 2nd test was wireless thoroughput vs gigabit landline

  • Equipment



    This is the chart I made in excel with all the numbers. I then made graphs, shown below, out of the data


    1st Test



    For some reason my iphone much preferred AC with time capsule




    Can be misleading the changes as they are actually minimal. I have 5Mbps upload so they are all above what I should be getting

    2nd Test



    Not sure why such a big discrepancy using gigabit ethernet, but obviously Im getting much faster read speeds with time capsule




    Again, not sure why speeds differe with gigabit ethernet, but time capsule write speeds doubled the Netgears



    I posted below my previous speed tests of Netgear Nighthawk stock vs Nighthawk DDWRT vs Asus RT-N66U


                         


    Decided to upgrade router to Netgear R7000 AC1900 router due to good newegg deal and I tested the speeds on iPhone 5S, 13″ Macbook Pro and Hackintosh Desktop. I used speedtest.net for all measurements. Tests were done in Phoenix, AZ with Cox Internet in apartment complex (lots of interference). I tested 2.4 and 5.0 GHZ for all + Powerline on Hackintosh

    Some errors to point out – for some reason forgot to test 2.4GHz on Asus N66U DDWRT

    First going to start with Netgear R7000 – DDWRT 23550M-R01

    Hackintosh 2.4GHz


    Hackintosh 5.0GHz


    Hackintosh Powerline


    iPhone 5S 2.4GHz


    iPhone 5S 5.0GHz


    Macbook Pro 2.4GHz


    Macbook Pro 5.0GHz



    Next Netgear R7000 Stock – V1.0.3.24_1.1.20 (Latest firmware)

    Hackintosh 2.4GHz


    Hackintosh 5.0GHz


    Hackintosh Powerline


    iPhone 5S 2.4GHz


    iPhone 5S 5.0GHz


    Macbook Pro 2.4GHz


    Macbook Pro 5.0GHz


    Lastly, Asus N66U with DDWRT installed


    Hackintosh 5.0GHz


    Hackintosh Powerline


    HTPC LAN


    iPhone 5S 2.4GHz


    iPhone 5S 5.0GHz


    Macbook Pro 2.4GHz


    Macbook Pro 5.0GHz



    I then put all the data into Graph. For some reason stock R7000 2.4GHz were much faster than others. I rarely use 2.4GHz and the options of DDWRT are necessary for my setup so I will stick with DDWRT on R7000. I don’t have any AC devices to test that function yet.




    How to Add Wake On Lan (WOL) to Apple Time Capsule – Airport Extreme Routers

    I have been using DDWRT for a long time now and the last thing holding me back from moving to Apple router was the ability to remotely wake up my server/htpc. I found an excellent guide for using a raspberry pi to do this for me. This way I can save power and not run my htpc or server 24/7 and combine my home router and time capsule into one device.

    • I began using DDWRT in Asus N66U and it was one of my favorite routers. The pain of isntalling ddwrt back then was a major headache, but those troubles are gone now and it is super simple. 
    • I decided to upgrade to the Netgear R7000 Nighthawk once it had DDWRT capabilities because I wanted to take advantage of the AC speeds.
    • I added an older time capsule to use as a time machine device for our Imac, Macbook Pro, and Macbook air. This worked great for the most part but it seemed silly to not even use the router capabilities of the device. I also had trouble remotely connecting to it using Back to My Mac because of the Netgear router. 
    • Once I found that I can use my pi to remotely wake up my computers and also use the pi as a dyndns updater I no longer needed DDWRT.
    • Bought the new Apple Time Capsule (2TB) with AC networks capabilities and decided to test the speeds compared to the Nighthawk. 
      • Now I can remotely wake up my computers
      • My dyndns is updated automatically so I don’t have to worry about my external ip
      • Back to My Mac works perfectly
      • I am selling my Nighthawk and older Time Capsule and replaced with new Time Capsule and raspberry pi (save alot on energy)
      • Stability of stock firmware and Apple routers without sacrificing speed/coverage

    Raspberry Pi Remote Wake-On-LAN Server

    This guide was taken from here and edited to fit my needs. Credit to Jeremy Blum

                

    I have a very power hungry desktop computer for HTPC and a server for large file storage. When I’m travelling with 
    my laptop, I obviously can’t carry all my files and data with me, so I occasionally use “remote desktop” to access 
    my desktop from the road. I also use a Plex Media Server to stream content from my server. However, the computer
     has to be on for me to be able to do this. This means I need to leave the computer on all the time, just in case I 
    need to access it. This wastes power, costs me money, and harms the environment. My Raspberry Pi, on the other
     hand, consumes a minuscule amount of power, and is always on anyways, serving other purposes.
    In this tutorial, I’ll show you how to run a simple mobile-friendly website from your Raspberry Pi that will allow you 
    to remotely wake up your power-hungry computer, so you can remotely access it. When you’re done, just put it 
    back to sleep from within the remote desktop service (or use the mobile app plus a small background server running
     on your desktop to put it back to sleep – this is described below). The app pings the computer from the Raspberry
     Pi to inform you of when the computer has woken up and established network connectivity. Follow along after the 
    break…

    When you’re done, here’s how this will work:

    1. From wherever you are in the world, navigate to your unique, dynamically updating URL 
      1. (example.dyndns.org:5000)
    2. You’ll be presented with a screen that looks like this:
      Remote WOL Wake-Up Screen
    3. Next, you’ll enter a passphrase that you’ve pre-allowed. If the wrong phrase is entered, a “denial” note will pop                       up, and you’ll be able to try again. If you enter the right phrase, the Raspberry Pi will send a Wake Up                     command to the network interface of the computer that you want to wake up. It will then ping that computer                     and display the results in real-time, so that you know when the computer has finished booting and is                     accessible. That screen looks like this:
      Remote WOL Feedback Screen
    4. Once you’ve received confirmation that the computer is alive, you can access it as you normally would,                   depending on what you’re doing (via SSH, FTP, or Windows Remote Desktop, for example).

    For the purposes of the following explanation and tutorial, I’ll define a few terms:

    • Remote Computer: This is the “power-hungry” computer located on the same network as your                     Raspberry Pi. I’m assuming you are using a hardwired Ethernet connection, since Wake-On-LAN                               (WOL) does not work over Wi-Fi.
    • WOL Sever (Raspberry Pi): This is the low-power, always-on, micro server that will be running on the                  same network as the remote computer. You don’t have to use a Raspberry Pi; any low-power platform                 capable of serving up web pages, running PHP, and sending Wake-On-LAN magic packets will work fine.
    • Client: This is the computer, phone, or other web-connected device that will view the WOL control                   webpage.
    • Router: I assume you are using a home router with a fairly standard feature set, and that you have                   administrative access to it. It should support DHCP address reservations, NAT port forwarding, and                       ideally support for a dynamic DNS updating service (like DynDNS or NoIP).
    • Dynamic DNS Service: This is a service that handles redirecting a URL to your home’s dynamic IP                     address. Since most ISPs assign dynamic WAN IP addresses, you need to use a service like this to                     ensure you can maintain access to your home network, even when the externally-facing IP address                 changes.

    Here’s what you need to do to get this working:

    • Ensure that the remote computer supports Wake-On-Lan (WOL) functionality. You may need to boot into the                 BIOS and permit the computer to be woken up via the network interface. This will look different on nearly                    every BIOS. LifeHacker has a good tutorial showing how to enable WOL functionality. For a shortened                         version specifically for this tutorial go here

    • Setup your Raspberry Pi with a linux distribution if you haven’t already, and get it connected to your network.               Adafruit has a great set of tutorials that can help you do the initial setup for your Raspberry Pi. I made a                  condensed version on one webpage here. (Note: some instructions are for older version but I was able to find                my way through everything ).

    • Log into your Router’s administration panel (in most scenarios you can do this by visiting your Gateway IP              from your browser). Find the status page and locate the listing of attached clients. Identify your Raspberry                 Pi and your computer by their hostnames, and copy down their MAC addresses, and IP addresses. In the                  screenshot below, the hostname of the computer I want to control is “PHOENIX” and the Pi’s hostname is, appropriately, “raspberrypi.” This will vary by router, but the listing will look something like this (Note: I blurred             out some of my personal info):
    LAN Client LIsting
    1. Now, find the “DHCP Reservation” or “Static Leases” list in your router’s administration panel. You’ll configure                        your router to always assign your remote computer and the raspberry pi the same IP address every time they                     connect to the network. This ensures that you’ll be able to reliably forward data to them through the router.                             It will look something like this:
      Assigning Static Leases
    2. Next, find the port forwarding configuration screen in your router’s administration panel. You’ll want to route                    HTTP data to the raspberry pi, and any remote service ports that you want to access to the remote computer.                    Importantly, many ISPs will block incoming traffic on port 80, the default HTTP port, to prevent customers                            from hosting websites from their residences. But, you’re smarter than they are! Simply route an arbitrary                              external port, to the internal port 80 on your Raspberry Pi. In the screenshot below, you can see that I am                        routing external port 5000 to internal port 80. This means that when you eventually access the WOL server,                          you’ll need to specify the port, like this: . Route the appropriate port for whatever services you want to access                      on the remote computer. In the screenshot below, I’ve routed port 3389, which is what Window’s uses for                  Remote Desktop. If you wanted to access an SSH server or SFTP server running on the remote computer,                        you could additionally route port 22. You can find a listing of ports used by various services on wikipedia.
      Port Forwarding
    3. Next, you’ll want to sign up for a dynamic DNS updating service that your router supports. Different routers                           support different services and most likely will require DDWRT installed to configure. If you have an Apple                               Airport Extreme or Time Capsule then this is not an option. That is why I chose to create this tutorial since I                         got rid of my router with DDWRT. 
      1. Follow my guide here if you want to also use your raspberry pi to configure and autoupdate your                             DynDNS.
      2.  Sign up for a free account, and get a URL that looks something like this: yoursite.no-ip.org. NoIP                              even supports port 80 redirects, so you can configure your account to not require appending the                                non-standard port number to the end as described in the last step. Once you’ve got your dynamic                              DNS account, find the Dynamic DNS (DDNS) updating screen in your router’s administration panel,                            and enter your account info. Now, you’ll always be able to access your home network, without                          knowing the IP addresses, and the router will handle automatically updating where the URL directs                             when your dynamic IP changes!
        DDNS
    4. Now that your router is all set to handle everything, it’s time to get the Raspberry Pi setup. Access your                   Raspberry Pi over SSH and log in with the username (pi) and the password that you configured when you                         followed the setup tutorial linked from step 2 (ssh pi@192.168.1.132). You’ll need to install WOL software                         and a webserver. Enter this command at the terminal to do so:
      pi@raspberrypi ~ $ sudo apt-get install wakeonlan apache2 php5
      Now, navigate to the webserver directory (/var/www) and clone my Remote WOL software from my github                 repository:
      pi@raspberrypi ~ $ sudo apt-get install git
      pi@raspberrypi ~ $ git clone https://github.com/sciguy14/Remote-Wake-On-LAN-Server.git
      pi@raspberrypi ~ $ sudo chown pi /var/www
      pi@raspberrypi ~ $ sudo chgrp pi /var/www
      pi@raspberrypi ~ $ mv Remote-Wake-On-LAN-Server/* /var/www
      pi@raspberrypi ~ $ rm -rf Remote-Wake-On-LAN-Server/
      pi@raspberrypi ~ $ rm -f /var/www/index.html
    5. Now, you’ll need to adjust the configuration settings so that they work with your particular network setup.                   Rename config_sample.php
      to config.php. Then, open it for editing with a terminal editor such as nano or vim:
      pi@raspberrypi ~ $ mv /var/www/config_sample.php /var/www/config.php
      pi@raspberrypi ~ $ nano /var/www/config.php
      Follow the instructions in the file to set your passphrase hash, the local IP/MAC for the computer to wake up                       , and the ping retry value. When you’re done, save and close the file.
    Notes for the config.php file. You can add as many computers to the list that you want. For some reason to work                         with mine I had to included a space after mac address and ip address for it to work.
         eg. “BC:5F:3T:33:44:6F ” and “192.168.1.132 ” notice a single space after mac/ip and before quotation

    Update (7/15/2013):

    If the remote computer is Windows 8, you will need to change some settings to make it reply to ping requests                             (or else you won’t know when it has woken up). By default, Window 8 does not reply to pings. Follow these                       instructionsto make it reply.

    Update (7/20/2013):

    I’ve added the ability to put the computer back to sleep using the mobile webapp. The new version of the code                         can still be found on GitHub. Follow the same instructions from above to copy it into /var/www on your Pi. For it                           to work, you’ll need to ensure that Curl is enabled for your PHP installation, and that your computer is running                           the Sleep-on-LAN application server:
    1. Install Curl on your Raspberry Pi for PHP
      pi@raspberrypi ~ $ sudo apt-get install php5-curl
      If it doesn’t work, you might need to update your repositories first:
      pi@raspberrypi ~ $ sudo apt-get update
    2. Download the Sleep on LAN software and run it on your windows computer. Set it to launch at boot so that                         it will always be ready to go.
    Note, with this updated version of the webapp, it will now ping the computer to check if it’s awake or not to decide                          if it should present you with a “Wake Up” or “Put to Sleep” button on the interface.
    Update (12/15/2013):
    The app now includes a dropdown that allows you to pick a computer. The config file has been updated to include                         lists for computer names, IP addresses, and MAC addresses. You can now Wake/Sleep as many computers as                         you want! Thanks to GitHub user ahodgey for submitting a Pull Request with most of this functionality (I made                           some updates to his pull request, and merged it into the master repository branch).
    You’re done! Put the computer to sleep, visit the dynamic URL that you chose, and you should be presented with                         the screen that was shown earlier in the tutorial. When you input your passphrase, it will be compared with the                             hash by the PHP script. If it is approved, the Raspberry Pi will send a command to the remote machine to wake                           it up. The display will update in real time to show you when the machine has woken up and successfully joined                              the network. You can then access it using any program whose ports you’ve forwarded. Enjoy!

    How to Setup Dynamic DNS / DynDNS for *FREE* on Raspberry Pi / Ubuntu

    Setup Dynamic DNS / DynDNS for *FREE* on Raspberry Pi / Ubuntu

    Guide taken from here and modified.
    You might have recently setup your Raspberry Pi or your Linux box as a 24 x 7 torrent downloader, or a small Web server to host your own website. And just then you realize that your ADSL or Cable Internet connection has a dynamic IP address which changes frequently and every time you reconnect. Thus, it becomes hard to access your box with a fixed Domain name or IP address.
    To solve this problem you can setup a Dynamic DNS which will update your IP to a DNS name everytime it changes and you can access you hosted website, or ssh into it to monitor torrent downloads with ease.
    While there are many paid dynamic dns service providers available, but here you will see one way to do it for **FREE** [Thanks to freedns.afraid.org]
    Step 1
    Register for a Free domain at http://freedns.afraid.org/signup/
    [We will take techhome.homenet.org in this guide]

    Step 2
    Logon to FreeDNS (where you just registered) and gotohttp://freedns.afraid.org/dynamic/
    Or, simply click on “Dynamic DNS” link from the left navigation menu

    Right click on “Direct URL” and copy the URL and paste it somewhere. 

    You should notice a large and unique alpha-numeric key in the URL, make a note of it as shown below:
    http://freedns.afraid.org/dynamic/update.php?[alpha-numeric-key]
    for example (akhdjfgashdiqyetrakhjsdf==)

    Step 3
    Either log on to raspberry pi desktop using LXTerminal or ssh into your raspberry pi from your computer.
    On mac open terminal, type
    ssh “username”@ip address
    where username is what you setup pi with and ip address is that of your pi
    eg. ssh pi@192.168.1.132
    it will ask you for permission the first time and password that you setup your pi with

    Step 4Install inadyn using the following command:
    sudo apt-get install inadyn

    Step5
    Configure inadyn using the below steps:

    sudo nano /etc/inadyn.conf

    And add the following contains in it replacing the actual values: (mine was blank so your can copy and paste what is below and change the things in red. Username and password are what you used to sign up for freedns)

    --username techhome
    --password mypassword
    --update_period 3600
    --forced_update_period 14400
    --alias techhome.homenet.org,alphanumeric key
    --background
    --dyndns_system default@freedns.afraid.org
    --syslog

    Step 6
    Now, we need to ensure that the DNS updater (Inadyn) runs automatically after every re-boot

    export EDITOR=gedit && sudo crontab -e

    Add the following line below all the text:
    @reboot /usr/sbin/inadyn

    Step 7
    Reboot system and then run the following command to ensure inadyn is running:

    ps -A | grep inadyn


    DONE
    Now your host is ready and up for accessing from internet…

    You can trying ssh-ing from another computer over the internet
    ssh username@techhome.homenet.org

    Or, if any web server is running, then simply browse to  http://techhome.homenet.org

    Or, you can just ping it to test ping techhome.homenet.org

    To check the logs you can use this:
    more /var/log/messages |grep INADYN

    This has been re-tested to be working perfectly with inadyn 1.96.2-1 on Raspbian 3.12.22+

    How to Install and Set Up Raspian on Raspberry Pi

    This is a condensed version from adafruit website (simon monk). I made this so everything is on one webpage and is easier to navigate.

    Overview
    When you buy a Raspberry Pi, it may or may not be sold with an SD card. The SD card is important because this is where the Raspberry Pi keeps its operating system and is also where you will store your documents and programs.  
    learn_raspberry_pi_overview.jpg
    Even if your Pi came with an SD card with the operating system on, it is a good idea to update it to the latest version, as improvements and bug fixes are going in all the time. Since putting the operating system onto an SD card wipes everything else off the card, it is worth considering using a USB flash drive for your documents, so that when you install a new version of the operating system, you don’t have the complication of copying them off somewhere safe before reformatting the SD card.
    If your Pi did not come with an SD card then the minimum size you should get is 4GB, but buy a bigger SD card if you think you will need the space.
    This lesson shows you how to create an SD card for your Raspberry Pi.


    You Will Need

    To prepare an SD card for your computer, you will need:

    A ‘regular’ computer with a built-in SD card reader, or an add-on USB SD card reader. The instructions here are for Windows and Mac. You can pick up a tiny microSD card reader/writer that is nice and fast and works with all USB-ports at the Adafruit shop. Please check what version of raspberry you have. The older version uses regular SD card. Newer B+ model uses microSD.

    learn_raspberry_pi_ID939_LRG.jpg
    learn_raspberry_pi_SD102_MED.jpg

    Downloading an Image

    The operating system that will be installed onto the SD card must be downloaded from the Internet. This will usually be a zip file that then extracts to a file of type .img an image file. Whatever image file you download, the actual installation process is the same.

    Choose your Operating System

    There are a bewildering number of operating systems that you can install on your Raspberry Pi, if you are a beginner, then do not consider anything except one of the Linux distributions, and if you are an advanced user, then you probably won’t be reading this anyway.

    Choose your Distribution

    Having decided you want to install Linux, that is not the end of the story. You now have to decide which distribution or ‘distro’ of Linux you want to install. Being an Open Source operating system, anyone can take one of the existing distributions an add things to it or configure it in a certain way before packaging it up as another distribution option for anyone to use. This is how the most common Raspberry Pi distribution ‘Raspbian’ came into existence. The ‘Debian’ distribution was configured and kitted out with useful things like IDLE (a python-programming language development editor) and Scratch (a learn-to-program gaming system) to make it suitable for the Pi. Adafruit have then taken Raspbian and configured it to make it as easy as possible to use the GPIO connector to attach DIY electronics to the Pi.
    All of the Adafruit tutorials (and nearly every other tutorial online) will work with either so we suggest picking one of the two:
    In fact, if like me, you decide to keep your documents on a separate USB Flash drive, it is no bad thing to buy two SD cards and try both.
    In appearance, there is very little to choose from between the two. When it come to how it behaves, then ‘Raspbian’ is the more ‘standard’ distribution, but then Occidentalis is more electronics-hardware ready.
    Having said that, both distributions are regularly updated and each will no doubt incorporate features found in the other.
    Incidentally, the name Occidentalis come from the Latin name for the raspberry (Rubus Occidentalis).
    So, having made your choice, download the zip or img file and if it is in a zip file unzip it onto the Desktop.


    Making an SD Card Using a Windows Vista / 7

    There is a very useful utility that we can use to write a SD card available for Windows 7 and Vista. It is not unfortunately available for Windows XP.
    Step 1.
    Step 2.
    This will download a zip file that you must extract. The result will be a folder called ‘faii-1.0.2-3-x32’. If you keep this outside of the Program Files area then you will be able to run it without changing its privileges. You can just leave it on your Desktop.
    Step 3.
    Eject any external storage devices such as USB flash drives and backup hard disks. This makes it easier to identify the SD card. Then insert the SD card into the slot on your computer or into the reader.
    Step 4.
    Right click to run the file fedora-arm-installer.exe as an administrator. This will launch the following application.

    learn_raspberry_pi_fail1.png
    Step 5.
    Select the image file and device.
    To do this, click the Browse button and navigate to the .img file for the distribution that you want to install and the select the device from the drop-down.  
    learn_raspberry_pi_fail2.png
    Check that you have the right device, as it will be reformatted, and then click Install.
    It will take a few minutes to install, but once the SD card is ready, you will see the following.
    learn_raspberry_pi_fail4.png
    That’s all there is to it. Your SD card is ready for use in your Raspberry Pi.

    Making an SD Card Using a Mac

    Ray Vijoen has created a useful script that makes it really easy to make an SD card using a Mac. It is a shell script that takes all the necessary steps to create the SD card, including formatting it. You still have to run it from the command line.
    Step 1.
    Download Raspberry-PI-SD-Installer-OS-X fromhttps://github.com/RayViljoen/Raspberry-PI-SD-Installer-OS-X
    Look for the ‘zip’ button at the top and download it as a single zip file.

    Step 2.
    Extract the zip file. It will expand into a folder called ‘Raspberry-PI-SD-Installer-OS-X-master’.

    Step 3.
    Use Finder to move the img file that you downloaded earlier into the Raspberry-PI-SD-Installer-OS-X-master folder.
    You can see here that I have both the Occidentalis and Raspbian images in the folder. That is fine, you can have as many images as you like in the folder.
    learn_raspberry_pi_00_screen_folder_contents.png
    Step4.
    Open the Terminal app – you will find this in the Utilities folder of your Applications folder on your Mac.
    Then type the command ‘cd’ followed by the path of your Raspberry-PI-SD-Installer-OS-X-master folder.
    learn_raspberry_pi_01_screen_cd.png
    Step 5.
    Eject any external drives that you have connected to your computer. This just makes it easier to identify the correct drive that corresponds to your SD card.
    Insert the SD card that you want to use. Note that all data on this card will be erazed.

    Step 6.
    Run the Pi Installer by typing the following command into the Terminal:
    > sudo ./install Occidentalis_v02.img
    ‘Occidentalis_v02.img’ is the name of the img file for the distribution that you want to install.
    You will be prompted for your Mac password and then should see this:
    learn_raspberry_pi_02_screen_select_drive.png
    Step 7.
    Enter the number next to the SD card drive. Make sure you get this right, because whichever drive you select will be erased.
    It is then just a matter of waiting until all the image file is installed. This will take a few minutes. You can check on the progress by pressing ctrl-T
    When everything is complete, you should see this:
    learn_raspberry_pi_04_screen_complete.png
    Thats all there is to it, the SD card is now ready to use with your Raspberry Pi.

    Test & Configure

    learn_raspberry_pi_overview.jpg
    If you plan to use multiple SD cards, it is not a bad idea to label them. Put the label on the side that shows when the SD card is inserted into the Pi.
    Testing the card is easy – insert it into your Pi, then connect a keyboard to the USB port and a NTSC/PAL TV to the composite port or an HDMI monitor to the HDMI Port. Then power it by connecting a Micro USB cable to the Pi and powering it via a computer or a USB wall charger
    You should see something like the following, an Adafruit/Raspberry logo in the top left, and a ton of text filling up the screen
    learn_raspberry_pi_adafruit_833.jpg

    In the next tutorial, you will find out how to configure your Raspberry Pi the first time you boot it up.

    Overview

    In the first lesson of this series, we showed you how to prepare an SD card containing an operating system for your Raspberry Pi. In this lesson, we will show you how to setup your Raspberry Pi the first time you boot it up.
    learn_raspberry_pi_raspi-config_main.png
    We do this using a tool called Raspi-Config that runs automatically the first time you boot your Raspberry Pi. This starts before the windowing system and so you have to use the cursor keys and Return key to navigate the menu system.

    It is a bit like adjusting the BIOS settings on a PC, once you have things right, you probably won’t need it again. We will start with the options that are most important and then look at some of the other options that you may wish to configure.

    Using the Whole SD Card

    This may seem a bit strange, but by default the Raspberry Pi only uses as much of the SD card as the operating system requires. This means that even though you might have used a large SD card, the operating system won’t use it.
    learn_raspberry_pi_raspi-config_expand_1.png
    To fix this so that all the space on the SD card can be used, use up / down cursor keys to select the ‘expand_rootfs’ menu option and hit return. 

    Once you do that, there will be some screen flashing as a script is run and then you will see the following confirmation.
    learn_raspberry_pi_raspi-config_expand_2.png
    Press Return again to return to the main menu.

    Using the Whole Screen

    Being designed to work with TVs, you may find that your Pi is only using the middle portion of the screen and there is a big unused area all round the screen.
    learn_raspberry_pi_raspi-config_overscan1.png
    This is not true of all TVs and monitors, but if its happening for you then selecting the option to Disable Overscan may fix this for you.
    learn_raspberry_pi_raspi-config_overscan2.png
    Use the left and right cursor keys to make your selection and then hit Return. 

    If after disabling overscan, you cannot see the left edge of the screen then see the section ‘Running Raspi_Config After Booting’.

    Changing Timezone

    Skipping past a few options for a moment, the next thing that you almost certainly need to do is (unless you live in the GMT timezone) is to change the timezone.
    learn_raspberry_pi_raspi-config_timezone1.png
    From the options, first select the Geographic Area, then the Timezone within that area.
    learn_raspberry_pi_raspi-config_timezone2.png
    learn_raspberry_pi_raspi-config_timezone3.png

    Booting into Desktop

    By default, when the Raspberry Pi boots, you just get a command line. No windows just a terminal where you can login and type commands. 

    The final configuration that you definitely want to make, unless you don’t like windowing environments is to change the boot behaviour so that it automatically starts the windowing system and logs you in.
    learn_raspberry_pi_raspi-config_boot_1.png
    Select the sensible option and hit Return.
    learn_raspberry_pi_raspi-config_boot_2.png

    Other Options

    The options described above are those which could pretty much be considered essential when running your Raspberry Pi for the first time. There are some other options listed that are worth describing briefly.
    • configure_keyboard – as it implies allows you to chose from a long list of keyboard layouts.
    • change_pass – allows you to change the system password for the user ‘pi’ the default user on the system. By default, this password is ‘raspberry’ so those preoccupied with security may wish to change the password.
    • change_locale – For non-English speakers, you can select which locales should be available on the system and which should be the default for the operating system.
    • memory_split – allows you to adjust how much of the shared system memory is available for graphics and how much for the main processor. If you plan to run graphics hungry games, or video playback, then you may decide to alter these settings.
    • ssh – in a later tutorial we will look at remote controlling your Pi from another computer using ssh. This option allows you to enable ssh so that you can do that.
    • update – this option tries to find a newer version of Raspi_Config and download it. It is possible that new options will be added to the system in the future, so you may wsh to do this.

    Running raspi-config After Booting

    You can run raspi-config any time you like, if you find that there are some settings that you need to make.
    Click on the desktop icon ‘LXTerminal’ to open a terminal session.
    learn_raspberry_pi_terminal.png
    Then enter the following command and hit return:
    Copy Code

    1. sudo raspi-config


    Test & Configure

    learn_raspberry_pi_reboot.png
    Reboot your Pi – click the icon bottom right – and this time you should boot straight up into the windowing environment.
    In the next tutorial, we will look at configuring WiFi and finding the IP address of your Pi.

    Overview

    One of the first things that you will want to do is to get your Raspberry Pi connected up to the Internet.
    In this lesson, you will learn how to:
    • Connect using an Ethernet cable
    • Use a WiFi adapter with both Raspbian and Occidentalis
    • Find out the IP address of your Raspberry Pi
    learn_raspberry_pi_network_LEDs.jpg

    Using a Wired Network

    The quickest way to get your Raspberry Pi connected is to use an Ethernet patch cable and just plug it into the back of your home network router.
    learn_raspberry_pi_router_connection.jpg
    As soon as you plug your Pi in, you should see the network LEDs start to flicker.
    learn_raspberry_pi_network_LEDs.jpg
    For most home networks, you should also be able to connect to the Internet without any further configuration. For this to work, your router should be configured for DHCP (Dynamic Host Configuration Protocol). This service runs on your home network router, dishing out IP addresses to any device that connects to it either through WiFi or by cable.
    If DHCP is not turned on, on your home network router, then connect to its management console using a different computer that is already connected.
    You should be able to find a setting somewhere that turns it on.
    learn_raspberry_pi_router_admin.png

    Buying a USB WiFi Adapter

    Look for a WiFi adapter that supports the RTL8192cu chipset, as both the latest Raspbian and Occidentalis distributions both have support for this built-in and we’ve found its much faster than the Ralink chipsets
    If you already have a WiFi adapter, just give it a go, even a lot of the very low cost budget adapters will work without any trouble.
    learn_raspberry_pi_wifi_adapter.jpg
    WiFi does however use quite a lot of power, so check the power rating of your power supply. Some WiFi adapters require an external power supply to work well. We suggest the 5V 1A power adapter in our shop if this is the case. All of the WiFi adapters we have in the Adafruit shop will work just fine this way.
    If you have a WiFi adapter plugged in, then you no longer have two free USB sockets available for your keyboard and mouse, so you may also need a powered USB hub.

    Setting up Wifi with the Graphic Interface

    Setting up WiFi requires that your router is broadcasting the SSID. Make sure you have “Broadcast SSID” set up on your router! This will not work with “private” SSID setups
    Raspbian releases after 2012-10-28 include a WiFi configuration utility. You will find the shortcut for this on the Desktop. If you are using command-line tools or are logging in over Ethernet, check the next page for how to edit/etc/network/interfaces by hand
    learn_raspberry_pi_wifi_config_icon.png
    Step 1.
    Double-click the icon and this is what you will see.
    learn_raspberry_pi_wpa_gui_1.png
    Step 2.
    Click on the Scan button and a second window will open. Find your Wireless access point in the list and double click on it. This will open another window.
    learn_raspberry_pi_wpa_gui2.png
    Step 3.
    Enter your password in the PSK field and then click Add. When you look at the first window, you should see that the connection is all set up for use. You can connect or disconnect using the buttons. Notice also the IP address of the Pi is shown at the bottom of the window.
    learn_raspberry_pi_wpa_gui5.png

    Setting up Wifi with the Command Line

    This tutorial works best if your router is broadcasting the SSID. Make sure you have “Broadcast SSID” set up on your router! This may not work with “private” SSID setups
    Setting up WiFi in Occidentalis, is also pretty straight forward. You just need to add the name of your wireless network (its SSID) and your password to a configuration file.
    Step 1.
    Boot the Raspberry Pi without the WiFi adapter plugged in.
    Step 2.
    Open a Terminal session by clicking on the LXTerminal icon, and enter the following command into it:
    Copy Code

    1. sudo nano /etc/network/interfaces


    learn_raspberry_pi_occ_1.png
    Copy Code

    1. auto lo

    2.  

    3. iface lo inet loopback

    4. iface eth0 inet dhcp

    5.  

    6. allow-hotplug wlan0

    7. auto wlan0

    8.  

    9.  

    10. iface wlan0 inet dhcp

    11. wpa-ssid "ssid"

    12. wpa-psk "password"


    If you are using a ‘hidden’ SSID, try the following (hat-tip tohttp://www.dafinga.net/2013/01/how-to-setup-raspberry-pi-with-hidden.html)
    Copy Code

    1. auto lo

    2.  

    3. iface lo inet loopback

    4. iface eth0 inet dhcp

    5.  

    6. auto wlan0

    7. allow-hotplug wlan0

    8. iface wlan0 inet dhcp

    9. wpa-scan-ssid 1

    10. wpa-ap-scan 1

    11. wpa-key-mgmt WPA-PSK

    12. wpa-proto RSN WPA

    13. wpa-pairwise CCMP TKIP

    14. wpa-group CCMP TKIP

    15. wpa-ssid "My Secret SSID"

    16. wpa-psk "My SSID PSK"

    17.  

    18. iface default inet dhcp


    Step 3.
    This opens an editor screen of the wifi configuration file you need to change.
    learn_raspberry_pi_occ_2.png
    The two places where you need to make a change are on the last two lines. Change the file so that it looks like this:
    learn_raspberry_pi_occ_3.png
    Of course, you should put in your network and password! Note that you need to keep the double-quote characters around your wireless network name and password.
    This kind of editor does not let you use the mouse. Instead, use the cursor keys to move around the file.

    Step 4.
    When you have finished press [ctrl]x. This will ask if you want to save the modified files.
    learn_raspberry_pi_occ_4.png
    Press ‘Y’ and then Return to save the file with the same name.

    Step 5.
    Shut down your Raspberry Pi, plug the WiFi adapter in and start it up again. You should find that the Raspberry Pi connects using the WiFi adapter as it boots up.

    Finding Your Pi’s IP Address

    You can find the IP address of your computer, either by opening the WiFi setup tool again. The IP address will appear at the bottom of the Window.
    If you are using Occidentals, or you want to do this over a command line terminal. Open up a LXTerminal window and type the following command:

    Copy Code

    1. sudo ifconfig


    learn_raspberry_pi_ifconfig.png
    Next to the wlan0 entry you will see inet addr: 192.168.1.10which is the IP address of the Raspberry Pi.

    Remember! If your IP address starts with 192.168 or 10.0 then its an internal address – that means you can get OUT to the Internet but you cannot have someone outside your home or network reach your Pi via the IP address. This is important if you want to have a webserver running on a Pi that outside people can reach. In general, its much safer to keep your Pi on an internal network so it can’t be hacked as easily!

    Test and Configure

    If you have X running, open the Midori web browser and navigate to the URL of your favourite electronics supplier.
    learn_raspberry_pi_browser.png
    If you are using a command line, the ping command can be used to see if you are reaching the internet. Try ping google.com or ping adafruit.com to check if you can reach those sites!

    Fixing WiFI Dropout Issues


    If you find your module ‘drops out’ from time to time, you can fix it fairly easily with a command line fix (thanks perseus286!)

    Create and edit a new file in /etc/modprobe.d/8192cu.conf

     sudo nano /etc/modprobe.d/8192cu.conf

    and paste the following in

     # Disable power saving
    options 8192cu rtw_power_mgnt=0 rtw_enusbss=1 rtw_ips_mode=1

    Then reboot with sudo reboot