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

    How to Add TV Backlight

    Make your home theater look more professional!

     

    I purchased this Antec TV Backlight  on Amazon and applied it to the rear of the TV. It automatically powers on when plugged into the TV’s USB port. It gives a nice glow behind the tv and also supposively makes it easier on your eyes when watching tv at night.

    ————————————————————————————————————————————–
    Moved to small studio in NYC and wanted media center to be clean with no wires and extra storage. Designed it on ikea’s website and built for around $700.

    besta tv media center plan
    First I bought Besta Vassbo Doors with middle square indents. Looking back I could have saved $5 on each door and got the Vara, but I thought the guideline to cut out center would be helpful. I bought Jig Saw from ikea to cut out the inserts on 6 of the doors to give the cabinets room to breathe for my electronics and also for remotes to work through. I then bought speaker fabric from amazon (I bought 3 rolls and used 2). I had sand paper laying around to smooth edges.
     besta vassbo door
    staple gun
    Then cut approximate size of cloth to cover all edges. Take staples gun and start with corners and fill in rest. You can also use glue to keep the edges down in between staples. Just make sure its snug fit but don’t pull to stretch as it might tear.
    besta vassbo door
    Finished look from the front
    besta vassbo door
    What it looks like on the besta unit. I also chose to leave out the back thin inserts in the besta unit to give room to breathe on back side and also give plenty of room for cords.
    Besta Hack - Door
    I have a large media server that fit perfectly into the Besta shelf unit. I cut one large hole on side facing windows to give open space for access to rear panel and fans of server. I covered it partially with our Mohu Leaf OTA Antenna .
    Photo 25
    Photo 24
    I needed airflow coming into the server so I bought 2x Cooler Guys USB 120mm fans with mounting brackets. I also wanted to keep dust out so instead of grill protector from kit I bought these cheap filters on ebay. I then aligned the fans to be exactly where the 2 large fans on server case are. Cut out the holes and mount the fans. Now I have excellent airflow through case.
    Photo 23
    Next issue was the subwoofer. I wanted to keep it hidden so I tried hiding with besta shelf. It wasn’t quite tall enough, but wife was okay with look as its mostly covered. I cut out large insert in back to allow subwoofer to fit through as it was also too long. This gave besta shelf no support and would bend out since its not on the ground. To fix I used one nail to fasten door to both sides and hid them under speaker fabric and it works fine now.
    Photo 26
    Finished product. I liked the look of white cabinets with the black doors. We went with high gloss black doors because I think it looks nicer but you could save money and get plain black/brown. For speakers I sold my surround setup and got lucky on ebay with finding Definitive Technology SSA-50 for $200. It does a decent job in small apartment, but not even close to quality of old 5.1 Polk setup. It looks nice and fits in the media center. Wife added Ikea Fillsta table lamp for extra lightning. For cable management I purchased cable tiessticky mounts for cable ties, and TV wire cover. Too mount the tv one could go with simple mount or one that moves and swivels. I have used both types in past. This time I went with swivel version to be able to slightly move tv towards our couch since they were offset. Its also MUCH MUCH easier to plug cords in.
    Besta TV Hack
    Ikea Shopping list – for those interested in parts I used

    FRIHETEN sofabed/couch Hack – Add bass to your couch for ultimate movie experience!

    FRIHETEN sofabed/couch Hack – Add bass to your couch for ultimate movie experience!



    I live in a tiny studio apartment in NYC and brought a large subwoofer with me. I was able to hide it well with my previous ikea hack. However, its hard to get much use out of it due to the amount of bass it produces (aka neighbors don’t like it).

    I recently went to a movie in NYC with AMC’s new Prime experience. They put a speaker/subwoofer under your seat so you “feel” the bass. I did some research and it seems people have already done this in their home theatres. There are several companies with different products depending on how much money you want to spend. I decided to go cheap since I don’t have a full blown home theater setup.

    I first purchased 2 of these Dayton Puck Tactile Transducers on Amazon for $19 each and later ordered 2 more for my ikea FRIHETEN couch. This couch is perfect because there is already plywood on the back, which allowed me to drill a hole to fit the pucks in without having to purchase 2×4’s and making my own mounts.

    To power the Dayton’s I purchased the recommended Lepai LP-2020A+ Amp on Amazon according to reviews. I went to hardware store and bought 24 wood screws (#6), 4 wood screws with washers (#8), electrical tape, and wire caps. At home I already has some zip ties and sticky squares that I got from amazon for cable management as well as some leftover speaker wire.

    On Amazon I ordered a 15ft serial cable (subwoofer) cable and a serial splitter (you may need 2 of these depending on if your receiver has only 1 subwoofer out port).

    The final touch, which is optional, was to add a 50hz FMOD low pass crossover which I got on Amazon through partsexpress.

    The build

    1. Use the premade cutouts that come with the Dayton pucks to draw onto the wood. I chose to evenly space 3 under the lateral part of sectional and one under the vertical (storage) part.

    2. Use some type of powerdrill to drill out enough wood for the pucks to fit in nicely. (notice on this couch the rear wood is only about 1/2″ thick so I was very close to drilling all the way through)

    3. Using 6 of the #6 screws, screw in the pucks into their holes that you made and make sure they don’t budge.

    4. Use the speaker wire to wire the speakers however you wish (this is the most difficult step and will vary depending on how many pucks you use, what ohm the pucks you got, what ohm your amp will run on). I purchased 4 of the 8ohm pucks. I put each set of 2 in parallel and then connected to separate channels (L and R). This gave me 4ohms into each channel (if speakers are parallel you divide by 2, if series you add them together).

    5. I chose to put Amp vertically under the storage section so it was closest to power outlet (power cord provided for amp is really short). This is also convenient because when you flip up the storage section of couch you can easily flip the power switch and also make adjustments to volume/bass/treble.

    6. Drill hole in bottom of storage area for subwoofer cable and power cord to exit

    7. Drill hole in side to allow speaker wires to connect to amp in storage space.

    8. Connect splitter to subwoofer cable and L and R from splitter to Amp

    9. Connect other end of subwoofer cable to FMOD crossover and crossover to subwoofer out on receiver. The crossover prevents unwanted bass sounds during movies so couch isn’t shaking throughout whole movie and only during scenes that are meant to produce bass.

    10. Power on amp

    11. Test it out by either plugging in serial cable to amp and other end into phone and play music with bass or play movie through receiver. (note when playing music with serial cable through phone you will get actual music + bass out of the pucks, but when connected to receiver you will only receive bass).

    12. Don’t tell your wife what you did and play a movie to see her surprise 🙂

    NOTE: There will be alot of adjusting settings on receiver and amp to get it perfect for movie watching. I leave it off for watching tv but turn it on for playing games or watching movies.

    Test video so you can get an idea on the bass that the couch produces

    Equipment Needed

                         
        

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