Over the last year the Raspberry Pi, a cheap credit-card sized computer, has taken the computing and DIY world by storm. Read on as we guide you through everything from buying to powering to running the tiny dynamo.
What Is the Raspberry Pi?
The Raspberry Pi is a credit-card sized general purpose Linux computer designed and manufactured by the Raspberry Pi Foundation, a non-profit organization dedicated to making computers and programming instruction as accessible as possible to the widest number of people.
Although the original mission of the Raspberry Pi project was to get inexpensive computers with programming capabilities into the hands of students, the Pi has been embraced by a diverse audience. Tinkers, programmers, and DIYers across the globe have adopted the tiny platform for projects ranging from recreating retro arcade cabinets to controlling robots to setting up cheap but powerful home media devices.
The Pi features a system-on-a-chip setup built around the Broadcom BCM2835 processor (a tiny but fairly powerful mobile processor commonly used in cellphones) that includes a CPU, GPU, audio/video processing, and other functionality all on a low-power chip.
Although the Pi is an amazing little device, before we proceed it’s important to emphasize what the Raspberry Pi is not. The Raspberry Pi is not an outright replacement for your desktop computer or laptop. You cannot run Windows on it (its ARM-based processor doesn’t support x86/x64 code), although you can run many distributions of Linux—including distributions with desktop environments, web browsers, and other elements you would expect in a desktop computer.
The Raspberry Pi is, however, an astoundingly versatile device that packs a lot of hardware into a very inexpensive body and is perfect for hobby electronics, DIY projects, setting up an inexpensive computer for coding/programming lessons and experiments, and other projects.
What’s On The Raspberry Pi Board?
The Raspberry Pi comes in two versions, Model A ($25) and Model B ($35). As the Model B—seen above—is the most popular model we’ll start by outlining what you’ll find onboard and then highlight the differences between the Model B and Model A.
What’s the Difference?
The Model B ships with the following hardware/ports:
- 700 Mhz Systems-On-a-Chip (SoC) with integrated 512MB RAM.
- 1 HDMI port for digital audio/video output
- 1 RCA video port for analog video output.
- 1 3.5mm stereo headphone jack for analog audio output.
- 2 USB ports for connecting input devices and peripheral add-ons.
- 1 SD card reader for loading the operating system.
- 1 Ethernet LAN port.
- 1 microUSB power port.
- 1 GPIO (General Purpose Input/Output) interface.
The Model A is identical save for the following modifications:
- 1 USB port instead of 2 USB ports.
- No Ethernet port (users must add a USB Wi-Fi or Ethernet adapter if they need network connectivity)
- 256MB RAM instead of 512MB (chipset otherwise the same)
What the heck is a GPIO? While the majority of these hardware specs are familiar to most people, for those without previous hardware hacking experience the GPIO will be new. The Raspberry Pi comes with a set of 26 exposed vertical pins on the board. These pins are a General Purpose Input/Output interface that is purposely not linked to any specific native function on the Raspberry Pi board.
The GPIO pins are there explicitly for the end user to have low-level hardware access directly to the board for the purposes of attaching other hardware boards, peripherals, LCD display screens, and other hardware devices to the Pi. For example, if you wanted to take an old arcade controller and wire it directly to your Raspberry Pi to give your arcade a more authentic feel, you could do so using the GPIO interface.
Although we will not be using the GPIO header in today’s “getting started” tutorial, we’ll definitely be taking advantage of it in future Raspberry Pi hacking how-to guides.
Where Can I Buy the Raspberry Pi?
In the first few months after the Pi’s release it was nearly impossible to get your hands on one. The Raspberry Pi Foundation greatly underestimated how popular the little computer would end up being. They anticipated selling a few thousand of them world wide; they sold over a million units in the first 12 months. Fortunately they have ramped up production and expanded their supply chain which means long wait times and having to bid fiercely for units on eBay is behind us.
Where do I go? The current official distributors of Raspberry Pi hardware are:
We would strongly recommend against purchasing your Raspberry Pi boards from Amazon, eBay, or other locations where people are simply buying up boards and flipping them for a profit. Now that production levels have increased there is no need to pay a premium to get your Pi from a third party.
Which model should I buy? While there are definitely uses for the lighter weight Model A (applications where the Ethernet port is unnecessary and the extra RAM will go unused), if you’re just getting started with the Raspberry Pi it makes more sense to buy the Model B and be prepared for any project you may wish to undertake than it does to shell out $35 more to buy another board in the future.
What Else Do I Need?
Part of the keep-costs-low mission of the Raspberry Pi Foundation hinges on the end user purchasing pieces to round out their Raspberry Pi build (such as a case).
Aside from the specific-to-the-Pi case, the rest of the required parts are common, generic cables and peripherals that most people will likely have laying around the house—the Pi Foundation, for example, opted to use the ubiquitous microUSB charger as a power source. Let’s take a look at the hardware you need to get started.
A stable 5v 700mAh+ power source: The Raspberry Pi draws its power from a microUSB port and requires a microUSB charger. Because the Pi is a micro computer and not simply a cellphone getting a battery topped off, you need to use a high quality charger with stable power delivery that provides a consistent 5v with at least 700mAh of output. Using a low-quality/under-powered charger is the number one source of system instability problems and frustration with the Raspberry Pi.
Using a power source rated for over 700mAh won’t hurt your Pi but it won’t necessarily provide any benefit either. The reason that many people recommend 1000mAh chargers is that 1000mAh is so far above the required 700mAh that even if your charger is slightly out of spec it won’t come close to dropping below the Pi’s required power threshold.
There are plenty of different microUSB chargers out there but we have been very pleased with the Motorola microUSB (SPN5504) and use it for all our Pi projects— for the curious, it outputs 850mAh.
Feel free to try out chargers you may have laying around the house but, should you run into any issues with uptime stability or peripherals attached to the Pi not working as expected, the first thing you should upgrade is the power source.
A case: The Pi ships naked; you are going to need a proper case to enclose it. You can pick up an acrylic/plastic case for around $10-25 or go the more creative route and craft your own case (as many did shortly after the Pi was released and it was nay impossible to get a commercial case). Here are several suggestions for your consideration:
- Built-to-Spec’s Acrylic Cases ($12.50): We’re big fans of the Built-to-Spec cases and have all of our current Pi projects enclosed in one. You can order a case or, if you have access to a laser cutter at work, can even download the design files and cut your own case.
- Adafruit Pi Box ($14.95): Also made from laser-cut acrylic, this compact little case snaps together with no additional tools or standoffs.
- SB Components Pi Case ($13.90): Another snap-together acrylic case, offers plenty of large cut-outs for access to the Pi board. Good choice for a Pi setup intended for use with DIY electronics projects.
A 4GB+ SD card: Per the Raspberry Pi Foundation the minimum card recommended is a 4GB Class 4 card (the class speed indicates how fast it can read/write). Since SD cards are cheap these days, we recommend going for at least an 8GB Class 10 card.
Audio/Visual cables: If you are connecting the Pi to an SD/analog television set you will need an RCA cable for the video and a 3.5mm stereo cable for the sound. You don’t need to purchase a specific RCA cable for the task, you could even use a yellow-red-white tri-cable you have laying around—just make sure to match up the colors on both ends of the cable when you plug it in.
For digital video/audio output to an HDTV or monitor with HDMI support, you will need an HDMI cable.
For digital video to a standard computer monitor that lacks an HDMI port, you will need an HDMI to DVI cable for the video signal and a 3.5mm stereo cable for the sound (as you’ll lose the sound in the HDMI to DVI conversion).
Mouse/Keyboard: Even if your ultimate goal is to build a headless file server or other no-input-peripherals/monitor device, you will still need input devices to get your Pi up and running.
Any standard wired USB keyboard and mouse should work without any problems with your Raspberry Pi. There is one caveat to that statement, however. Per USB design specifications USB-based keyboards and mice should draw less than 100mAh of power but many models disregard that specification and draw more. If you find that your peripherals are drawing more than 100mAh each, you will need to use a powered USB hub.
You may find it useful to check out this large list of verified Pi-compatible peripherals maintained by eLinux.org.
Ethernet cable/Wi-Fi adapter: Network connectivity isn’t an absolute necessity for the Pi but it makes updating (and downloading) software so much easier and gives you access to a wide variety of network-dependent applications.
You can either hook your Pi up to a hardwired LAN via Ethernet or buy one of the many micro Wi-Fi adapters compatible with the Pi. We have had great success with the tiny Edimax EW-7811Un adapter.
(Optional) powered USB hub: If your peripherals are out of spec or you need to attach more than two devices (such as a keyboard, mouse, and USB Wi-Fi adapter), you will need a powered external USB hub.
We tested all the powered hubs we had laying around the office with the Pi—from nice brand-name Belkin powered hubs to no-name hubs—and had no problems with any of them. That said, we would recommend checking your existing hub or potential purchase against the hub section of the aforementioned eLinux peripheral list. Definitely check out the notes on the various hubs in the eLinux list, as some users report the ability to power the Pi itself off the port of high-quality USB hubs—such as the D-Link DUB-H7—which is a rather handy trick.
Creating a Bootable OS Image
Now that we have assembled all the requisite hardware, Pi and peripherals alike, it’s time to get down to the business of loading an operating system onto your Pi.
Unlike a traditional computer where you have a BIOS, a drive that supports removable media (such as a DVD drive), and a hard drive inside the computer, the Raspberry Pi simply has a small solid state drive (provided via the SD card and the SD card reader). As such you are not going to follow the traditional computer-setup route of inserting a boot disk and installing your operating system to an internal storage device. instead, we are going to prepare the SD card on a traditional computer and load it into the Raspberry Pi for further unpacking/tweaking.
Selecting the Distribution: While there are a wide variety of Linux distributions and variations available for Raspberry Pi, the distribution we are going to use today is the best-supported and most stable: Raspbian—a Debian distribution optimized for the Raspberry Pi.
Once you get your Raspberry Pi up and running it will be a completely independent machine, but in order to start the process you will need another computer to create the operating system image on the SD card.
First, let’s start by grabbing a copy of Rasbian from the Raspberry Pi Foundation. The image you want is Raspbian “Wheezy”.
Selecting the Disk Imaging tool: Once you have finished downloading the disk image it’s time to extract the image onto the SD card. For this tutorial we’ll be using a Windows machine to extract the image but it’s easy to perform the same action on Linux and OS X machines. Here are our recommended tools for all three operating systems:
Note: You can always use the DD command on both Linux and OS X to write your image. Given how powerful DD is (and how terribly wrong things can go if it is used incorrectly) we’re leaving it at the discretion of the users whether they are comfortable using the DD command to image their Raspberry Pi SD card under Linux/OS X. The GUI-driven disk image tools supplied here are much safer for those unversed in DD.
Imaging the SD Card: Now that we have a copy of the Raspberry Pi Raspbian distribution and Win32 Disk Imager we can get started creating our operating system disk.
Insert the SD card you wish to use for the project into your SD card reader. We recommend double checking the drive letter at this time in Windows Explorer. It’s wise to remove any flash media, thumb drives, or tethered smart phones/devices before continuing—Win32 Disk Imager won’t hurt any hard drives attached to your system but it will offer up any flash-based media connected to your PC as a viable target for installation.
Extract the .IMG file from the Raspian .ZIP file you downloaded. Note the location you extracted the file to. Win32 Disk Imager is a portable application, so extract the contents of the .ZIP you downloaded from the link above and run Win32DiskImager.exe.
From within Win32 Disk Imager, select the image file and the appropriate drive letter, like so:
Press the Write button to write the contents of the Raspbian image to your SD card. Win32 Disk Imager will ask you to confirm the overwrite, click Yes. The actual write process should take only a few minutes. Once the application indicates the write has been successful you can safely eject the SD card from your system.
Next, we’ll teach you how to configure Raspbian on your Pi.