Wednesday, September 4, 2013

Multi-flavor Raspberry Pi

In this post I'll  show you how to setup the BerryBoot boot loader.

In a previous post I walked though setting up Raspbian Wheezy. While Wheezy is a great operating system, with plenty of support and flexibility, it isn't the ultimate solution for everyone's needs. For instance, you might want to use your Pi as a media server or home theater PC (HTPC). While you can certainly do this with Wheezy, there are other choices that make this task even easier. So, as previously with Wheezy you'll need to download the new operating system (in this case OpenELEC  might be the OS of choice), then install it on an SD card. That's good, but what about some of those other cool OSs you wanted to check out? Ok, so maybe you should grab a few more SD cards at the store, just in case! Before you clear the shelf of SD cards, there's a better way! A way better way! It's called BerryBoot. BerryBoot is a boot loader. You're probably familiar with this already from Windows or Linux, but if not, a boot loader allows you to install multiple OSs and selectively pick one you wish to load at startup time. The nice part about BerryBoot is that it does this, but also does so much more, as you'll soon see.

First Things First
To begin you'll need to download and install BerryBoot from the link I provided above.  As a basic overview, you need a fresh SD card to which you can download the BerryBoot kernel. This kernel is responsible for loading BerryBoot and displaying the configuration menu. The first time you run BerryBoot you'll see options to verify the screen size and to use either a wired or wireless connection (as seen below). Once you've made the appropriate selections you'll be presented with an option to choose where you'd like to store any operating systems you choose to install. By default you can store them directly on the same SD card where you've installed BerryBoot, but the real power of BerryBoot lies in the fact that you can also choose to install it to other USB devices, such as a USB stick or hard disk.  


Stick To It
If you have a USB stick/external hard disk handy, you can insert it in the Pi and use BerryBoot to install your OSs of choice. Since the Pi only has two USB ports, you obviously may be port challenged. In my case I use VNC and a wifi-adapter, so there's still an available port. My other setup uses Ethernet and a wireless keyboard/mouse adapter, so this combination also gives me a free USB port. But, if neither of these setups work for you there's always the option to add a powered USB hub to one of the Pi's ports. Once you've chosen the setup that's suits your situation you'll want to connect a USB stick/hard disk to one of the available USB ports. Keep in mind that the next step will overwrite all of the data on this USB stick/hard disk. 

The Disk Selection screen presents you with options regarding where you want BerryBoot to store the installed OS's. Typically you'll see the USB stick/hard disk as the sda device (as seen in the screen shot below). Again, please verify the destination carefully because once selected all data is overwritten and cannot be restored. Once you've chosen the appropriate destination, press the Format button. You'll receive a warning...proceed with caution. There's no going back!


So Many Choices
Once formatting is complete BerryBoot presents you with a screen where you can select the OS's you wish to install (something similar to the screen below this section). I mentioned previously that BerryBoot was much more than simply a boot loader and there's the proof! With BerryBoot you can install multiple operating systems simply using point and click, while BerryBoot handles all the tedious details of downloading and installing them to your disk of choice. As with anything, there are some tradeoff's with this approach. BerryBoot maintains its own distribution repositories, since operating systems are stored in a compressed (i.e. squashed) manner. In practice that means you may not get the latest and greatest distros out of the box. But, typically you can still use sudo apt-get dist-upgrade to get them to the latest version after you've installed them.



A New Look
Once you've chosen and installed at least one operating system, BerryBoot is good to go. Now, each time you boot the Pi you're presented with BerryBoot's selection menu (as in the sample seen below). On the screen you can pick the operating system you wish to load and press Boot. Note that the default operating system will load after the specified timeout.


If you wish to change the default settings, timeout and so forth you can do that by pressing the Edit menu button. This presents you with the screen below. To set the default simply select an operating system in the list and press the Make Default button at the top of the menu. Now, when you boot the Pi it will automatically load the default operating system after a timeout. Typically the timeout is 20 seconds. You can change this value by clicking the >> button on the right of the screen and selecting Advanced Configuration. This presents you with a text editor. There you can select the cmdline.txt tab and set the bootmenutimeout value to the number of seconds you wish to wait before loading the default operating system. If you'd like BerryBoot to wait until you make your own selection you can do so by replacing the bootmenutimeout=xx value with nobootmenutimeout.


Add It Up
If you wish to add additional operating systems to your BerryBoot menu you can do so by choosing the Add OS button. This presents you with the screen above where you can select an operating system to install. Again, this list shows all of the available squashed operating system versions available through BerryBoot. For advanced users BerryBoot allows you to install your own squash-file operating system images by clicking on the down arrow next to the Add OS button. Basically, you'll need to create your new image on another Linux computer. I actually attempted creating one on the Pi. I wouldn't recommend it! It took hours and the image it produced was corrupted and unusable (your mileage may vary). But, in theory here's how this goes...use a tool such as Win32DiskImager (as mentioned in my previous posting) to save a current SD card image. Follow the steps on this BerryBoot page and create an image that you can add using BerryBoot. You'll need to place the image on a USB stick to load it (the only option). 

I hope this quick overview of the BerryBoot bootloader is helpful. I've found BerryBoot quite indispensable in allowing me to quickly check out new operating systems. Also, (crossing my fingers here) I've found the USB stick a much less error-prone way to load OSs. I've managed to crash Wheezy many times by overclocking, which often left the SD card with a corrupt filesystem and non-bootable. That hasn't happened yet with the USB stick. Each of the distros I've been testing with are still running well. 

In my next post I'll talk about how to play YouTube videos on the Pi. Until then, happy baking!

Tuesday, August 27, 2013

Beautiful Raspberry Pi


In this post I'll  show you how to remotely connect to your Pi using VNC.

Previously I showed you how to setup an ssh connection to your Pi using Putty. Putty/ssh is a great combination if you want to run terminal commands on your Pi. But, if you're running a graphical desktop you might also want a client that allows you to access the Pi's graphical screen. In the Linux world this type of connection is referred to as a VNC (Virtual Network Computing) connection. At a high level VNC specifies a protocol for transferring screen information and events between a VNC Server and Client. If you're interested in the technical details you might want to look at the Wikipedia overview here. For our purposes, I'll walk you through installing a VNC server on the Pi, then we'll walk through installing a VNC client under Windows and Mac.

Ready To Serve
The first part of setting up VNC for the Pi involves installing server software to allow the Pi to serve up a copy of its graphical desktop. The most popular VNC server for the Pi is TightVNC. It is free for non-commercial (i.e. standalone) use. Please refer to the web site if you have questions about usage. For most of us the free GNU license version is applicable, so we'll look at how to set it up on the Pi.

The first thing we need to do is download and install the server. You can do this by opening a terminal window and entering the following commands:

     sudo apt-get update
     sudo apt-get install tightvncserver

Once you've done this the necessary packages will be downloaded to install the TightVNC server. The next step is to start the server by typing the following command in the terminal window:

      vncserver :1 

This command starts the VNC server and gives the screen a default resolution, in the case of TightVNC the default is usually 1024x768. You can specify your own settings if you wish by adding the geometry parameter as shown below. You can also specify color depth as also shown below.

      vncserver :1 -geometry 1024x800 -depth 24

Unfortunately, if you wish to change these settings again you'll need to reboot (sudo reboot) and enter the command again. There doesn't appear to be and easy way to restart the TightVNC server without restarting Raspbian. For further details regarding command-line options please refer to the TightVNC link I provided previously.

Start Me Up
You'll need to run the vncserver command above each time you start Raspbian, unless you specify a way for this command to automatically run during startup. Fortunately, this is fairly easy to do if you've chosen the configuration option to automatically start the desktop when you startup Raspbian (please refer to my previous post about configuring Raspbian if you have any questions). You can start by opening a terminal window and entering the following commands:

     cd /home/pi/.config
     sudo mkdir autostart
     cd autostart
     sudo nano tightvnc.autostart
     
Add the following lines:
     
     [Desktop Entry]
      Type=Application
      Name=TightVNC
      Exec=vncserver :1
      StartupNotify=false

Then press Ctrl-O write the file, then Ctrl-X to exit. Now when you restart the Pi (sudo reboot) the VNC server should automatically start. 

It's Not Our Policy
You may get the error below when you restart the Pi after entering the VNC startup information. If you do you can resolve this by going to start menu, choosing Preferences  then Desktop Session Settings and unchecking the LXPolKit checkbox. You'll need to restart Raspbian once you do this for it to take effect. If all goes well the error should not appear again once you reboot.


It's Good To Have Connections
Now that we have a VNC server running it's time to install a VNC client so we can connect to the Pi from another computer. There are multiple ways to do this, depending on the operating system you're using. For Windows you can install RealVNC Viewer, which has a 32-bit and 64-bit Windows client.  Another option is TightVNC, which also has a Windows client. In this post I'll focus on setting up RealVNC, which is my preference of the the two because it lets you setup resizeable, scalable windows. For those using a MAC I'll also show you how to use the Mac's built-in VNC client.

Once you download and install VNC Viewer you're presented with a connection screen, where you'll enter the Pi's IP address, along with the port corresponding to the virtual screen you wish to display. For example, you might enter 192.168.1.101:5901, where 5901 is the VNC port used for the first screen (vncserver :1). Once you've specified the appropriate connection information press the Connect button. If all goes well, you should see your Pi's desktop, as shown in the screen shot I've provided below:



Note that by default RealVNC's window uses scrollbars when you resize it, but you can change it to a scalable window by choosing Options from the toolbar at the top of the RealVNC window, then checking the Scale to window size option.

Macs-imize
If you're using a Mac you can also download and configure RealVNC Viewer, as I mentioned above. But, there's really no need to download a VNC client because it is already included with Tiger and later versions of OS X. To connect to the Pi you simply need to right-click on the Finder icon in the dock and choose Connect to Server. In the Server Address field you'll need to enter a connection string similar to the one I mentioned above, but prefixed with vnc://. For example: 

     vnc://192.168.1.101:5901

This instructs the Mac to connect to the VNC server at the specified IP address and display virtual screen 1 (port 5901). If all goes well, you should see something similar to the screen shot below:



The Standard Disclaimer
One thing to keep in mind about VNC, versus remote desktop software is that VNC interacts with a virtual screen. In other words, you get a unique copy of a desktop which you can interact with. So, for example, if you open a terminal window using VNC you'll only see the terminal window in VNC, not on the actual display hooked up to the Pi (assuming you have the Pi connected to a display, which you don't need at all with VNC! More on this below). Obviously, there are some global items that affect both the physical and virtual screens. For example, you might wish to create a new desktop folder like the Tools folder in my screen shot. Items such as a desktop folder show up on the physical display along with any virtual screens you see in VNC. That's because there is only one instance of  the desktop and start menu. Since they're shared, any changes you make to these global items are automatically reflected across all displays.

The Headless Pi
As I previously mentioned, if you're running VNC you don't need a physical display attached to your Pi, nor a keyboard our mouse for that matter! That's because VNC allows you to use the client computer's devices to send these commands to the Pi through its virtual connection. This type of setup (with no display or input devices) is referred to as a headless installation. It's particularly useful in cases where you want to use the Pi remotely or use it as a media server. For most purposes a VNC connection works well, but there are some cases where VNC won't work. These generally involve applications that directly access the Pi's hardware. One such example is the Omxplayer (here's a great overview http://elinux.org/Omxplayer), that uses the Pi's GPU to play MPEG files. You can run Omxplayer as normal from VNC, but you will only see video output on the physical screen. That's because Omxplayer  uses the Pi's GPU for hardware-accelerated graphics. So, a good rule of thumb is that VNC works with most applications.

In my next post I'll talk about using a boot loader and USB stick to quickly switch between multiple OSs. Until then, happy baking!

Saturday, August 17, 2013

Deluxe Raspberry Pi




In this post I'll give you some quick tips and tricks that make Wheezy even better.

In my last post I walked through installing and configuring Raspbian Wheezy. Now that you're up and running, I'd like to show you some cool tricks and provide a couple of scripts to make Wheezy even more useful.

Silly Putty
If you read my previous post you might recall that I recommended enabling an ssh connection to your Pi using the configuration menu. If you did this, now might be a good time to install an ssh client so you can remotely connect to your Pi from another PC. This is also quite useful if you'd like to run your Pi without the need to view it's display. For example, I'm writing this post on a laptop, while my Pi is running in another room. But, that doesn't prevent me from accessing it. I'm simply using the free Putty ssh client for Windows to remotely connect to my Pi and run all of the terminal commands. Setting up Putty is straightforward, you simply need to find your Pi's address to connect, which you can do either from your router's admin page or by running the ifconfig command in the Pi's terminal window and getting the IP address in the inet addr line. Next you'll want to enter this IP address in the Host Name (or IP address) field, as shown below. Press Open and you should see a terminal window where you can enter the user id pi and the password you setup previously during configuration.





Hot Off The Press
Now that you can connect to the Pi (both remotely or directly) it's a good time to make sure the software and firmware are up to date. You can update the Wheezy distribution, along with associated Pi utilities by running the following command in the terminal window. 

      sudo apt-get update && sudo apt-get install raspberrypi* raspi-config

Enter Y when you're prompted to continue. This process will take several minutes or more to complete, depending on the number of updates downloaded.

Next you can update the Pi's firmware by installing a very handy utility called rpi-update. Type the following terminal commands to install the utility and run it:

     sudo apt-get install rpi-update
     sudo rpi-update
     sudo reboot     (if all looks well)

Share And Share Alike
My home setup has a shared network (NAS) drive. I thought it would be handy to connect the Pi to this drive so I could display photos, videos and exchange files between other networked PCs. If you'd like to do something similar you can do so by adding an entry to the fstab configuration file to mount the drive and make it visible to the Pi's file system. The steps below describe how to do this, where the example IP address of the drive is 192.168.1.100 and default directory is /Public. Also, this example mounts the drive at the /mnt/n mount point in the filesystem. Obviously you can use any drive name or letter in place of n, but you should place this under the standard /mnt directory.

Enter the commands below in a terminal window:
      
      sudo mkdir /mnt/n
      sudo nano /etc/fstab 

Add something similar to this line in fstab, where the IP address and default directory refer to your network, or shared drive:  //192.168.1.100/Public /mnt/n cifs auto,password= 0 0

Press Ctrl-o to save the file, then Ctrl-x to exit
Enter this command: sudo reboot

Once you're rebooted enter the df command in a terminal window and you should see output similar to this:

     //192.168.1.100/Public 968428672 290909184 677519488  31% /mnt/n

Information, Please
Perhaps you've wanted to find out information about your Pi's configuration, such as the current firmware version, speed settings, temperature and so forth. Below I've provided a handy script sysinfo that displays all of this useful information. 

In a terminal window enter this command: sudo nano

Then enter each of the following lines:


#!/bin/bash
echo === Current freq / max / min ===
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq
cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq
echo
echo === Temp ===
vcgencmd measure_temp
echo
echo === Version ===
vcgencmd version
echo
echo === CPU Info ===
cat /proc/cpuinfo

Once you've entered the lines press Ctrl-o  and enter the name /usr/bin/sysinfo, then press Ctrl-x to exit
In the terminal window enter: sudo chmod 777 /usr/bin/sysinfo
Now you can run the command sysinfo at the terminal window any time you'd like and you'll see output similar to the following:

=== Current freq / max / min ===
800000
900000
700000

=== Temp ===
temp=47.6'C

=== Version ===
Feb  7 2013 16:46:17
Copyright (c) 2012 Broadcom
version 367974 (release)

=== CPU Info ===
Processor       : ARMv6-compatible processor rev 7 (v6l)
BogoMIPS        : 464.48
Features        : swp half thumb fastmult vfp edsp java tls
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xb76
CPU revision    : 7

Hardware        : BCM2708
Revision        : 000f
Serial          : 00000000xxxxxxxx

Just Chilling
If you'd just like to quickly check the system temperature you can do so using the temp script I've provided below.

In a terminal window enter: sudo nano

Then add the following lines:


#!/bin/bash
/opt/vc/bin/vcgencmd measure_temp

Then press Ctrl-o and name the file /usr/bin/temp, then press Ctrl-x to exit
Then enter the following command: sudo chmod 777 /usr/bin/temp

Now you can simply run the command temp in a terminal window and see the current system temperature as below:

temp=47.6'C

Install Some Paneling
Maybe you'd prefer to see the system temperature all of the time, rather than simply when you run a command. This is especially useful if you're overclocking and using the Pi to do processor intensive activities. Fortunately, this is easy to do. You simply need to add the Temperature Monitor to the status panel at the bottom of the screen. You can do this by right-clicking on an empty area of the status bar. This brings up a menu where you can choose Add/Remove Panel Items. Next, choose the Panel Applets tab and press the Add button. Scroll through the list and find the Temperature Monitor applet then press Add. You can also set the location of the temperature indicator by using the Up and Down buttons. I'd recommend pressing the Up button at least once so the temperature display is to the left of the Shutdown button. You should see something similar to this status bar below:



Time At Last
You may have noticed the clock in my status bar screen shot above shows 12-hour time. If you're like most of us, you're probably used to saying it's 2PM rather for 1400 hours. But, whatever floats your boat. If you fall into the former category then you might find this tip very useful. The panel's clock applet displays the current time using the strftime format string. You can look up the details if you'd like, but here's a handy format string that changes the time and date to a standard US format. Just right-click on the clock in the panel and choose Digital Clock Settings. Enter %l:%M%P (note the first sequence is %lower-case L, case matters) in Clock Format and %D in Tooltip Format (mm/dd/yy). You might also want to select Bold checkbox. Press Close and presto! you can now tell night from day.


In my next post I'll talk about how to remotely connect to the Pi's graphical desktop using VNC. Until then, happy baking!

Monday, August 12, 2013

Cooking Raspberry Pi

In this post I discuss installing and configuring the Raspbian "Wheezy" distribution.

My previous posts discussed the hardware you need to get your Pi setup. Now it's time to focus on installing an operating system on our Pi and configuring it. First, we need to choose which operating system we want to install. As of this writing there are several options, but I'm going to focus on the Raspbian "Wheezy" distribution. Rapsbian is a Debian-based linux distribution that happens to be the most popular OS choice for the Pi.

Pick An OS, Any OS
Installing Raspbian is a two-step process. First, you need to select the appropriate version to download. You can find the link to download Raspbian Wheezy here. On this page you'll find multiple ways to download the distribution. The simplest is to download the NOOBS.zip. You can follow the directions for doing so on the link provided. In this post I'll focus on the second option of installing the raw normal Wheezy image. Note that you'll also see references to a soft-float version of Wheezy. You don't need to be concerned with this unless you plan to use Java with the Pi. In that case you'll need to install the soft-float Wheezy version because it plays nicely with Oracle's Java JVM. I don't recommend using this version otherwise, since its performance isn't as good as the normal Wheezy version.

The Write Stuff
Once you've download and unzipped the distribution you'll need need to use a special tool to transfer the img file to an SD card. Once such tool for Windows is Win32DiskImager . In this post I'll focus on how to create an SD card using Windows. If you're working with a Mac you can find similar instructions for creating SD card images using the Mac's dd Unix command by searching the Internet. The basic concepts are the same, you start by downloading an image file, then use a low-level utility to write the bootable operating system image to an SD card. 

The first step is to start Win32DiskImager. Once the screen appears, you'll see something similar to the image below. Click the Folder icon next to the Image File field and select the .img file you downloaded and unzipped previously. Next you'll want to select the SD card in the Device dropdown. Make sure you select the correct SD card before you begin writing data because this process erases all data from the selected card. Once you're satisfied with your selection, press the Write button to begin preparing the card. This process may take 30 minutes or more, depending on the speed of the SD card you're using and the transfer speed of the card writer.



Give It The Boot
Once card creation is complete you should have a working Wheezy SD that you can place into the Pi and boot with. As the Pi boots you'll see 100's of lines quickly scroll by. These are displayed as part of the normal Linux kernel startup. After a minute or so you should arrive at the Raspi-config screen shown below. The remainder of this post I will walk you through each of these menu options. 



The first option we'll look at is expand_rootfs . As you can probably guess by the name, this is used to expand the root file system. This is very important to do because if you don't do so your Pi will only have disk space equivalent to the Wheezy image you wrote to the card, rather than the entire SD card size. For example, if you install a 2GB Wheezy image on an 8GB SD card the root file system will only be 2GB. You essentially have 6GB of space that isn't available for use since it isn't allocated in the filesystem. So, go ahead and choose this option. Once you do so you'll see a few dozen lines flash by on the console. These are telling us that the partition manager is resizing the root file system. After completion you'll see a screen stating that the resizing was completed and will take effect on the next reboot. Don't worry about rebooting now. We'll finish with the other options and do the reboot last.

The next option we'll look at is overscan. If you're working with an HDMI monitor or TV you can use this option to control the appearance of the screen. You'll want to play around with Enable / Disable  until you find the option that properly shows all of the example content. For most displays Disable is generally the preferred setting.

Next you'll want to use configure_keyboard to select the proper keyboard you're using. Since the Pi is manufactured in the UK the default keyboard selection is an International version (typically the Generic 105-key (Intl) PC). If you're a US user you'll probably want to change this to the Generic 104-key PC keyboard then select English (US). You can take the default for the rest of the options that appear. This seems a bit arcane, but if you don't follow this pattern you'll find some very needed symbols such as the @ symbol won't be mapped properly when you press the key.

You can use change_pass to change the default password for the user pi. I highly recommend doing so, since it provides a measure of security if you're planning to use your Pi to store documents and so forth or to connect remotely using ssh.

Where Am I?
The change_locale options lets you set a default language. You'll only need to change this setting if you don't wish to select English as the default language. Next you can select your current timezone using the change_timezone option. Note that the Pi doesn't have a realtime clock, but the timezone is used to offset the time obtained by Internet-based time services that provide the current time/date in universal time. Users in the US will want to choose the US menu option, then select the appropriate timezone.

The memory_split option allows you to select the amount of memory you wish to allocate for video memory vs. core memory. If you're planning to  to play videos you'll want to allocate at least 128MB for GPU (video) memory. This is typically the fourth option in the menu and begins with 128. The overclock option lets you overclock the Pi's processor, in a somewhat safe fashion. I say somewhat safe because while it's designed to protect the Pi's processor from being pushed too hard, unfortunately it does little to prevent the SD card from being corrupted if the Pi becomes unstable and crashes from overclocking. I found that pushing the overclock above Medium (900MHz) resulted in corrupted SD cards quite often. When this happens you pretty much have to reinstall Wheezy from scratch. All of your configuration changes are lost. Your overclocking mileage may vary. 

The ssh option allows you to setup the Pi for remote access using ssh. I recommend enabling this option to allow an easy way to control your Pi from other computers on your network. In future posts I'll discuss how to use ssh, along with more advanced ways to access the Pi using a VNC client. The start_desktop option lets you control whether the graphical desktop is automatically started when the Pi boots. In most cases you'll probably want this to be the default option. The exception is cases where you use the Pi as a dedicated server that doesn't need a graphical interface.

Almost There
Last, but not least, the update menu option checks for updated versions of the configuration menu (raspi-config) that we've just walked though. It's probably a good idea to do this once in a while. You can do it a couple of ways, first by running the configuration menu again by entering the following command in the terminal window: sudo raspi-config. The second way is by running the following terminal command: sudo apt-get update,  followed by the command: sudo apt-get install raspi-config.

The final step in completing the install/configuration process is to reboot the Pi. You should exit the menu by tabbing to the Finish button and pressing Enter. This takes you to a command prompt where you can type the command: sudo reboot. This restarts the Pi and all of the options you've selected will now take effect.

In this post I went through the most common options for configuring the Pi for first-time use. You can find more detailed instructions regarding each configuration option by referring to the Raspi-config page on the elinux.org site.

In my next post I'll provide some handy scripts and tips to help you find your way around Wheezy. Until then, happy baking!

Wednesday, March 20, 2013

Raspberry Pi Ingredients


In this post I discuss the additional items you need to get your Raspberry Pi up and running.

Previously I gave a brief overview of boards available and recommended that you purchase a Model B Rev 2 board, if you're in the market for a new Raspberry Pi. Once you've purchased your Pi you'll find you also need a few supporting accessories to get it up and running. I'll briefly discussion each of these items below.

Pi Power
The Pi can be powered by the same micro USB adapter that is commonly used with many smart-phones. If you already have one of these adapters it might work okay, but you need to verify the amount of amperage the adapter supplies. The general recommendation for the Pi (according to the the Raspberry Pi foundation) is a minimum of 700ma. Most cellphone chargers have that rated output, but your amperage may vary. Depending on the quality of the power supply, it may or may not deliver the stated output. If it doesn't you'll find that your Pi shuts down or locks up randomly, especially when you plug in a USB device. If you experience any of these issues with your Pi you'll probably need another adapter. You can find recommended adapters from stores such as AmazonMCM or Adafruit (also in the link below regarding verified peripherals). One final consideration: if you wish to over-clock your Pi   (which I'll discuss in the next post) you may experience boot issues (unable to mount root fs) if your power supply isn't up to spec. 

The HDMIs Have It
The Pi has two types of video output - composite and HDMI. Although it's technically possible to use the composite connection to a TV, HDMI is the better choice as far as resolution and pixel density are concerned. Composite, on the other hand, can be quite useful for projects that include their own small form-factor video panel. 

My setup also makes use of an HDMI receiver which handles the sound and TV connection. This setup works well, but sometimes there are quirks - if the Pi is powered on after the receiver I've seen issues where the receiver believes there is no video input. Fortunately that's easy to resolve by simply cycling power to the Pi. This quirk is the result of the Pi attempting to determine the attached display device and set the appropriate output mode. In future posts I'll discuss some of the tricks you can use in configuration to force the Pi to select default video modes, regardless of the type of device connected. This also allows using the Pi without a display -- a so-called "headless" configuration that's useful for remote connections, such as SSH and VNC. Again, I'll discuss how to setup these options in future posts.

It's All In the Cards
The Pi uses a full-sized SD card as its hard disk. Since that's the case you'll want to choose an SD card with plenty of room and fast read/write speeds. I recommend an 8GB card as a minimum. This allows approximately 7GB of extra space with the Raspbian ("wheezy") distribution. According to the foundation the Pi supports card sizes from 2-32GB. It also qualifies this statement by saying that the Pi supports most cards in this range. At the end of this post I'll provide a link to hardware that's been certified to work with the Pi. It's probably best to either look for items on this list, or look for user reviews which indicate a particular item works well with the Pi. As far as speed goes - SD cards are divided into classes, where higher class numbers indicate better read/write speeds. The predominate choices are between class 4 and class 10 cards. Since there's very little price difference you're better off buying the faster class 10 card, if you're in the market for a new one.

Get Connected
You can network your Pi in two different ways: using the built-in Ethernet port, or by purchasing an external USB wi-fi adapter. Obviously there are some tradeoffs with either approach. While the Ethernet port provides the fastest throughput, it limits portability. The USB wi-fi adapter solves the portability issue, but ties up a valuable USB port and delivers a lower throughput, especially when you're more than 10-15 feet away from your router. The ultimate decision between these two approaches is based on how you plan to use your Pi. If you choose the wi-fi route, you'll again want to look at the recommended hardware list or refer to reviews of items you're interested in purchasing. 

The Pi supports most USB keyboards and mice, using either a direct USB connection or a USB-wireless connection. If you're in the market for a new keyboard/mouse I recommend that you look at a wireless combo solution. This lets you use only one USB port to accommodate both inputs. Of course, you can always expand the Pi's USB ports by using an external USB hub. If you do so keep in mind you'll need to use a powered USB hub, since the Pi has very limited USB power output. Also, a powered hub is a necessity if you wish to hookup any high-power external devices, such as a hard drive, to the Pi. One final consideration regarding input devices - the Pi can also support wireless Bluetooth keyboards/mice, but it doesn't do so out of the box. You'll need to install some additional drivers. I'll go through the specifics of how to do this in a future post as well.

Case Closed
Now that we've covered most of the internal requirements for the Pi, it's time to wrap it all up - literally. You'll most likely want to purchase a case for your Pi to protect it from dust, static electricity and so forth (as well as make it easier to transport). While there are likely dozens upon dozens of case choices, in all kinds of imaginable colors, they are divided into two main categories - a molded case or a case kit. The former is typically a case that comes in two halves, where you place the Pi in the bottom of the case and snap on the top. The latter consists of a approximately 6-8 die cut pieces of plastic that you assemble into a case. The image below shows the case kit I built for my Pi. The choice of case type is entirely a user preference. My only recommendation is to make sure the case you choose allows proper ventilation, since the Pi doesn't have any type of heatsink or cooling fan.

Assemble it yourself case kit


Additional Information

You can find a list of tested Raspberry Pi hardware which is maintained by the Embedded Linux Wiki

In my next post we'll talk about installing and configuring the Raspbian OS. Until then, happy baking!


Monday, March 11, 2013

Tasty Raspberry Pi

In this post I provide an introduction to the Raspberry Pi, why you want one and where you can get one.

What is it?
Unless you've been hiding under a rock, I'm sure you're already somewhat familiar with the Raspberry Pi. So, I'll start with a brief introduction and refer to other sources of additional details at the end of the post.

The Raspberry Pi (hereafter referred to as the Pi) is a credit-card sized computer that was originally developed by the Raspberry Pi Foundation in the UK. The foundation's intent was to provide a low-priced, single board computer that could be used for educational purposes. But, since its initial introduction the Pi has also garnered wide-scale interest among hobbyists, looking to experiment with the low-cost computing platform. This interest rapidly gained momentum with the introduction of a second level of Pi hardware, which clearly divided the product line into $25 and $35 tiers.

The $25 versions are less capable than the $35 versions (they lack USB and Ethernet ports, for example). So, for all intents and purposes they are purely to provide a lower-cost alternative where such capabilities are not needed. In this blog I'll focus on the latest iteration of the $35 Pi, which as of this posting is Model-B Rev 2 (see diagram below) and easily distinguished by its 512MB of RAM and two USB ports. If you're in the market for a new Pi, I highly recommend you purchase this latest revision, since it offers the widest range of flexibility.

Model B Layout from http://www.raspberrypi.org/faqs

My Raspberry Pi setup (inside a case)


Why do I want one?
So, the next question you're probably asking yourself is why you'd want one of these tiny computers? What can you possibly do with it? Well, that's a good question and honestly doesn't have a simple answer. But, that's not necessarily a bad thing. The answer isn't simple because the possibilities are rapidly expanding, almost on a daily basis. For example, maybe you'd like to use the Pi to control home automation. Or maybe you'd like to use it as a simple AirPlay® receiver. Or maybe to learn to program. Or maybe as a home theater PC (HTPC). Or maybe to control a robot. Or maybe. Okay, I think you get the idea. Whatever your motivation, I believe you'll find the Pi suitable for many of the tasks you'd like to accomplish. With my subsequent blog posts I hope to introduce you to some of these cool ideas and walk you through the steps to get your tasty Pi baking!

Where can I get one?
The popularity of the Pi caused higher demand than the Raspberry Pi Foundation originally anticipated, resulting in several-month waits to receive purchased boards. Though this wait time has lessened some with the introduction of a new board manufacturer, it still may take several weeks to receive your board. For US customers you can purchase the Pi from the foundation's recommended suppliers, such as Element14 or Allied Electronics. In addition, you can find the Pi at other online suppliers, such as MCM Electronics, Amazon or eBay.

Additional information
If you're interested in finding out more technical details regarding the Pi please refer to the sites below.

Raspberry Pi Foundation
Wikipedia: Raspberry Pi

In my next post we'll discuss the supporting hardware you'll need to get your Pi up and running. Until next time, Happy Baking!