Raspberry Pi: the Basics for a Good Pi

LockerGnome reader Robert Higginson writes:

I was thinking of getting a Raspberry Pi module (the one with two USBs), but I don’t know a thing about computer programming or coding. The amount of things that can be done with such a device is amazing.

I pulled in some advice from someone who knows quite a bit more about Raspberry Pi than… I. Lance Seidman was kind enough to write:

If you’re in the tech industry, you’re probably very aware of the words Raspberry Pi. You may not know exactly what the Pi is, but at least you’re part of the select few that know it’s not dessert, which means you’re already doing better than most. Some call it a microcontroller, and it really isn’t, but you can use it like one — even with a breadboard — but it’s really the world’s smallest and cheapest Linux-in-mind PC (yes, a PC can be used in a non-Windows environment).

What really classifies this as a PC? For starters, let’s see if it has every “normal” I/O you’d really need… The Pi has your normal I/O that each one comes with:

  • Broadcom ARM11 700 MHz chip
  • RAM (built-in, non-upgradable; 128 MB (model A) or 256 MB (new model A and B)
  • USB (two; old model A had one)
  • HDMI (video OUT)
  • RCA (video OUT)
  • Audio OUT
  • Micro USB power INPUT (5V/1A DC)
  • GPIO headers for expansion (later could be used for controlling electronics)
  • DSI display connector
  • SD slot (bottom; this holds the boot loader+OS+data)
  • CSI camera connector
  • JTAG headers
  • Ethernet (only model B)

Raspberry Pi: the Basics for a Good PiYou may already know what most of those words mean or, at least, have an idea. You may be wondering where you plug in with your keyboard and mouse. Well, USB. Since you can technically run a chain of devices via USB, I highly recommend you buy a USB hub for your Pi. This way you can have a wireless keyboard, mouse, Wi-Fi adapter, and maybe a Bluetooth adapter (great for home automation). As you noticed, I did say it comes with HDMI; this is usually not a problem for people who have new monitors, but otherwise you can plug it into your TV or enable SSH and remotely tunnel to your Pi or even set up a VNC Server for a graphical display on your other PC/tablet. Unfortunately, you will need to use a screen for the first time to set up your Pi.

So you have a brand new SD card that is at least 8 GB and a fresh Raspberry Pi to play with. What do you do? First things first, like when you buy a computer, you normally pick it based on the OS it comes with. In the Pi world, multiple OSes exist that can run on the ARM architect and they’re all Linux-based, but that doesn’t mean SuSE, Ubuntu, etc. that you normally download will work. ARM is not x86.

So for starters, I assume you’re on Windows. But if you’re a Mac or Linux user, most of the steps are the same, but obviously with different software. I’ll do my best to include you, too.

Now, it’s time to grab the essentials:

1. The OS
I would obtain Raspbian. It’s widely used, extremely stable, and for starters, it’s simple to set up.

2. SD Format/Writer

  • Windows: Win32DiskImager (Graphical; What this tutorial is based on)
  • Mac OS X: RPi-sd Card Builder (Graphical; I expect Novices to be following this tutorial and not experts who could use dd)
  • Linux: ImageWriter (graphical; experts can use dd). Use your Software Center or command line package installer; each distro can differ.

That’s all you have to get to begin!

Set up the SD card for Raspbian (Windows)

Step 1: Choose image file
Once you download the W32DI (above for Windows), you’ll see a window that allows you to input the IMG file you downloaded (if you downloaded the ZIP, UnZip first), which is a section called Image file.

It will have a white box and a little button that has a blue folder image. Go forth and click that button and navigate to where you downloaded your Raspbian ISO file. Once you select it, it’ll bring you back to the same window.

Step 2: Select SD card drive letter (device)
This is very critical. You must be careful as you could accidentally format the wrong SD card. What if you only have one SD card slot? You’re safe, but sometimes other drives could show up in the drop box, like USB sticks.

This is exactly why you need to make sure the drive letter is the proper one. Once you’re 100% sure, make sure you’ve selected it.

Step 3: Write Raspbian to the SD card
Now the hard part is done! Simply select Write and you’re good to go. Now it can stall sometimes, but do not try to kill the program. You can absolutely corrupt your SD card and, a good portion of the time, there’s no chance of recovering it. Once the write is completed, a completion dialog will pop up letting you know that you’ve successfully created the SD card for your Pi!

Set up the SD card for Mac OS X and Linux (advanced)

Step 1: Open a terminal (console)
After you’ve opened your favorite terminal, we need to find out what your device is recognized as on your machine. Run df –h to see what’s currently connected and hopefully spot your SD card (e.g. /dev/sdd[#]).

Tip: Where the # is, is the amount of partitions on the SD card, and normally, brand new ones won’t have a partition (or just one), but it’s entirely possible it could and look like /dev/sdd1 or /dev/sdd2.

Step 2: Unmount the SD card
Now run the command unmount <SD Card path>. Remember the path from above. If the device has any number behind it, you must include it. So you may type unmount /dev/sdd1 — but be clear it’s correct.

Step 3: Unzip the IMG file
You should know where you saved your Raspbian zip file. In the terminal, run the command unzip ~/path-to-zip-file. Once it’s unzipped, go to Step 4.

Step 4: Write the SD card
Now in your terminal, you can clean it up or just go ahead and type in: dd bs=4M if=~/xx-xx-xx-wheezy-raspbian.img of=/dev/sdd.

Let’s talk about this line really quickly. You’ll notice we’re using DD and a 4M block. If for some reason you want to play it really safe, you can change the 4 down to a 1, but just know that the closer you get to 1, the slower the process will be.

Important: You’ll also notice the path of the SD card is strictly the card name.

Now you’ve written your SD Card, put it in your Raspberry Pi, and plugged your HDMI cord into your screen and powered up with your Micro USB power adapter (this power adapter is important; a bad one could ruin your Pi and/or not operate properly or at all).

I have powered mine up using my Windows Phone micro USB cord and wall adapter with success, but also tried the Nokia extra boost power adapter and it worked, too, which gives me a lot of ideas for on-the-go projects for the Pi.

I hope you’ll show off what you’ve done in the comments below!

Image: Raspberry Pi with LEGO Case by /kallu (via Flickr)