Tuesday, November 1, 2016

Raspberry Pi

Everything You Need to Know About Getting Started with the Raspberry Pi

raspheader1

Now over four years old, 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 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.

Introduced in 2012, the original Raspberry Pi (what we now refer to as the Raspberry Pi 1 Model A) featured a system-on-a-chip setup built around the Broadcom BCM2835 processor–a tiny but fairly powerful mobile processor commonly used in cellphones. It included a CPU, GPU, audio/video processing, and other functionality all on a low-power chip paired with a 700Mhz single core ARM processor. Over the intervening years the foundation has released multiple revisions (switching out the Broadcom chips for improved versions and upping the CPU power with a 1.2GHz quad-core chip).

Although the Pi is an amazing little device that has grown by leaps and bounds since its introduction, 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 (at least not the traditional version of Windows you know), 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 forprogramming lessons and experiments, and other endeavors.

What’s on the Raspberry Pi Board?


LEGO programmer for scale, not included.

In the early years of the Pi foundation, the Raspberry Pi came in two versions at two different price points: the Model A ($25) and Model B ($35). If you needed less hardware (the Model A had one less USB port, no Ethernet port, and half the RAM) you could save ten bucks.

As manufacturing costs fell and the Pi gained more and more attention, they were able to increase the hardware specs of the device significantly while keep the cost the same–eventually unifying all models with the introduction of the Raspberry Pi 2 in 2015 and the Raspberry Pi 3 in 2016. Put another way: the best Raspberry Pi available at any given time has always cost $35. So what do you get when you buy a $35 credit card sized computer?



The current generation Raspberry Pi 3, seen above, sports the following hardware:


  • 1.2 Ghz ARM processor Systems-On-a-Chip (SoC) with integrated 1GB RAM.
  • 1 HDMI port for digital audio/video output
  • 1 3.5mm jack that offers both audio and composite video out (when paired with an appropriate cable).
  • 4 USB 2.0 ports for connecting input devices and peripheral add-ons.
  • 1 microSD card reader for loading the operating system.
  • 1 Ethernet LAN port.
  • 1 Integrated Wi-Fi/Bluetooth radio antenna.
  • 1 microUSB power port.
  • 1 GPIO (General Purpose Input/Output) interface.

What the heck is a GPIO? 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.

Instead, 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 do take advantage of it in other tutorials, like our Raspberry Pi LED indicator build that uses an LED breakout board attached to the GPIO header.

Where to Buy the Raspberry Pi



In the original version of this guide, we strongly cautioned readers against buying from Amazon or eBay. In the early days of the Pi’s skyrocketing popularity, it was really difficult to get your hands on a unit, and if you bought from anyone but an Raspberry Pi Foundation authorized seller, there was a good chance you would either overpay or end up with a very suspect product in your hands.

Today you can still buy from an official Pi reseller, like one of the many companies supplied by the Pi Foundation sanctioned distributor Element14, but the risk of buying from a third party or through Amazon has plummeted. In fact, we’ve bought all our Pi units from Amazon for the last few years without issue.

There are multiple versions of the Pi, but if you’re just getting started, you should absolutely buy the most current generation of the device–the Raspberry Pi 3. Practically every old Pi tutorial on the internet still works with the older models, but many of the projects you may wish to undertake (especially if you want to use the Pi as a video game emulator or the like) really benefit from the newer hardware.

In rare instances, however, you may want to hit up eBay to buy an older and cheaper Pi model. Our tutorial on turning a Pi unit and an LED board into a weather indicator, for example, doesn’t need a beefy new Pi unit and works just fine on the original 2012-era Raspberry Pi 1 Model A.

The Other Stuff You’ll Need

2013-02-17_174732

The Raspberry Pi is just a bare board–it doesn’t come with a case, any cables, or even a power source. So, you’ll have to purchase these things yourself along with your Pi. Here’s the other stuff you’ll need to buy (if you don’t already have it lying around).

A stable power source: The Raspberry Pi draws its power from a microUSB port and requires a microUSB-to-AC adapter. 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 700mA minimum output for older model units and 2.5A for the Pi 3.

Here’s a chart, courtesy of the Pi Foundation, outlining suggested and minimum power requirements.



Using a low-quality or under-powered charger is the number one source of system instability problems and frustration with the Raspberry Pi. You can stave off a pile of future headaches by simply getting a very high quality power source, preferably one designed for the Pi, right out of the gate. We recommend the CanaKit brand 5V 2.5A power supply ($10). It’s built specifically for use with the Pi, it can supply enough stable power for the oldest to the newest units, and it won’t leave you with boot issues or corrupt data like some random cellphone charger from your office drawer might.

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

When you’re shopping, be careful to check you’re purchasing the right case for you model. Significant changes to the Raspberry Pi board over the last few years, including the movement and outright removal of certain ports, means older cases won’t fit newer models.

No particularly picky or flashy? The $8 Raspberry Pi 3 case from the Pi Foundation is a tough value to beat. Want something flashy? The sky’s the limit–Amazon is filled with really cool Pi cases like this laser cut “Bel-Aire” case that looks like tiny artifact from the 1950s.

A 4GB+ SD card: The older Pi units used a full size SD card but the Pi 2 and Pi 3 use microSD cards. The Raspberry Pi Foundation recommends, at minimum, a 4GB Class 4 SD card. But since SD cards are cheap these days, we recommend going for at least an 16GB Class 10 SD card for an older Pi or a 16GB Class 10 microSD card for the newer models. You may have one lying around already, but not all SD cards will necessarily work–check out this table from elinux.org to see a list of tested working (and not working) cards for the Pi.

2013-02-17_175042

Audio/Visual cables: If you’re connecting your Pi to an HDTV or newer computer monitor with HDMI support, you will need an HDMI cable–all PI units support HDMI output. 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).

Some Pis also have analog outputs for older TVs. If you are connecting and older Pi to an 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.

If you need to connect a newer Pi unit to an SD/analog video source you will need to purchase an adapter cable known as a 3.5mm to RCA adapter or a TRRS AV breakout cable. Because such cables are notorious for being out of spec/standard and not working with the device you want, we highly recommend just picking up this cheap and highly reviewed unit that is known to be compatible with the Raspberry Pi.

An Ethernet cable or 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. And obviously, if your project relies on being connected to your network or the internet, you’ll need Wi-Fi or Ethernet.

All versions of the Pi have an Ethernet port onboard, so you can just plug in an Ethernet cable and go. If you want to use Wi-Fi, the Pi 3 has Wi-Fi built in. If you have an older Pi, you can 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 and have used it in multiple builds.

A Mouse and Keyboard: Even if your ultimate goal is to build a headless file server or other no-input-peripherals/monitor device, you will still need a mouse and keyboard 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.

On older Pi units, this extra draw is problematic, as the USB ports were notoriously fussy. If you find that your peripherals are drawing more than 100mAh each, you will need to use a powered USB hub (see below). On newer models this should be less of a problem as the USB ports are significantly improved and the units user bigger power supply units.

You may find it useful to check out this large list of verified Pi-compatible peripherals maintained by eLinux.org.

A powered USB hub (optional): 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 an external USB hub with its own power source.

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.

How to Install an Operating System on the Raspberry Pi

2013-02-17_175245

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. No matter what project you’re doing, installing an operating system on the Pi will generally follow the same procedure.

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

Step One: Choose and Download Your Operating System

If you’re working on a specific project, you may already know what operating system you need to download. If you’re just looking to tinker, you’ll probably want a general purpose Linux distribution for the Pi. While there are a wide variety of Linux distributions available for the Pi, the distribution we are going to use in our example is the best-supported and most stable: Raspbian, a version of Debian Linux optimized for the Raspberry Pi.

For this step, you will need a separate computer with an SD card reader.

First, start by grabbing a copy of Rasbian from the Raspberry Pi Foundation. There are two versions of Rasbian: “Rasbian Jessie with Pixel” and “Rasbian Jessie Lite”. Pixel is the new (and very pretty) desktop interface the Raspberry Pi Foundation released in the Fall of 2016. The lite version does not have the more GPU hungry Pixel desktop and retains the old (and rather ugly) previous Rasbian desktop system. Unless you have older hardware and require the lite version, we suggest you download the “with Pixel” edition.\


Step Two: Write the OS Image to Your SD Card

Now that you’ve downloaded Raspbian, you need to write the image to your SD card. Etcher, a free program for Windows, macOS, and Linux users makes the process simple.

First, plug your SD card into your computer. Next, fire up Etcher.



Flashing Raspbian is a simple three-step process:


  1. Under “Select Image,” point Etcher to the Raspbian IMG zip file you downloaded earlier.
  2. Under “Select Drive,” pick out your SD card from the list of options. Note that your system drives will not show up as an option, but any external hard drives you have plugged in might. If you’re unsure which drive is which, unplug all external drives save for the SD card you want to write to.
  3. Finally, click “Flash!”, and your SD card will be ready for use in no time.

Etcher is a very streamlined program that makes the process a lot easier. Advanced users might prefer the command line method, which is outlined over at raspberrypi.org for curious macOS and Linux users.

Step Three: Put Your SD Card in the Pi and Start It Up

Now, it’s time to start up your Pi for the first time. Attach all the necessary cables and peripherals to your Raspberry Pi except for the power cable—this includes the HDMI or RCA cable, the USB hub, the Ethernet cable, and anything else you’ll need.

Once you have all the cables attached to both the Pi and their respective destinations, insert the SD card. After the SD card is seated firmly, insert the microUSB power cable. There is no power button on the Pi–as soon as you plug in the power cable, it will begin booting up.

2013-02-17_150820

Almost immediately, you will see the boot sequence go scrolling rapidly by—similar to the view above. If you’re running the Pixel version of Rasbian Jessie, however, the view will quickly be replaced by a simple splash screen:



Seconds later, you’ll be kicked over to the Pixel desktop when the boot process is complete.



Congratulations, you’ve successfully booted up your Pi for the first time. For those of you familiar with the early versions of Debian on the Raspberry Pi and its very spartan desktop, you’ll immediately not how nice this looks by comparison. It’s like we’re computing in the 21st century!

No comments:

Post a Comment