Saturday, December 15, 2012

Raspberry Pi purchase & setup guide for developers

Purchase tips, assembly instructions and configuration for remote development

The following are the steps I took to get my raspberry pi set up for development. I like to keep wires to a minimum, so by the end of this you should be able to plug your rPi into an outlet somewhere and connect to it remotely via ssh.

1- Ordering parts

Lets start from the beginning. The following is a minimal list of parts you'll need.

A Raspberry Pi Model B - 35$ - here

Shipping times can vary wildly due to high demand. Mine took 4 months(!) to ship (although I think its down to a couple of weeks now). You can pay more to get it sooner from re-sellers on Amazon/eBay but this  goes against the principles of the raspberry pi foundation.

A micro-usb cable - 4$ - here

Used to power the device

A compatible flash card >2GB  - 5$ - here 

Stores the operating system

Edimax EW-7811Un wireless adapter - 10$ - here

Internet & local wan connection. 

A low amperage keyboard - 12$ - here 

Only needed for setup

HDMI cable - 5$ - here 

Only needed for setup

You probably have some of these parts lying around the house. Its important to check that parts are compatible beforehand; if they draw too much power, they will simply not work with the rPi. For a list of verified peripherals, see this wiki from

2- OS installation

So you received all the parts, now its time to put things together. This section outlines the process for geting an rPi image installed onto an sd card. I'm assuming you're running on a mac (OSX). If you're running linux or unix, steps should be pretty much similar. If you're a windows user, check out this guide.

  1. Stick the flash card into your computer
  2. Download the Raspbian “wheezy” image here and Unzip the image. This will produce a .img file: 
    • (From terminal)> unzip ~/Downloads/
  3. Get the name of your sdcard by running dh command (Ex: /dev/disk3):
    • > df -h
  4. Unmount the sd card so that you will be allowed to overwrite the disk:
    • > sudo diskutil unmount /dev/disk3
  5. Install dcfldd
    • > brew install dcfldd
    • dcfldd is a fancy version of the older dd. You can use either tool(I tested both), but the flashing process takes ~30 minutes and dd does not print any status information. If you have trouble installing dcfldd, dd will suffice for the next step.
  6. Flash the image using dcfldd. This will take ~30 minutes.
    • > sudo dcfldd if=~/Downloads/2012-10-28-wheezy-raspbian.img of=/dev/disk3 bs=1m
    • if = Path to .img file
    • of = Path to sdcard disk
    • Setting 'of' ot the wrong path will do verry bad things to your computer. Be careful.
If you run into any problems, follow this more detailed guide which I abridged here. 

3- Device configuration

Once the flashing process is complete, its time to boot the rPi for the first time and configure things. In this section, we'll enlarge the sdcard partition to make use of all available space and modify boot behavior.

1- Take the sdcard out of your computer and plug it into the rPi. In the two USB slots, place the wireless adapter and the keyboard. Hook the hdmi cable up to a monitor/tv.When you plug the micro-usb cable into the device (from your computer), it will start to boot for the first time. You should see lights start to flash red and green.
2- Once the initial boot sequence is complete, you'll be able to enter raspi-config. This is a configuration utility that allows you to change the settings on the rPi. If prompted for a password, use user:pi, pass:raspberry (defaults for wheezy image).
See here for a full details about each of these options

3- Select "expand-rootfs" and follow the instructions here to enlarge your main partition to take up the entire sdcard. If you don't do this, you'll only have ~200MB of free space to play arround with (regardless of how big your sdcard is). This change will take effect on the next device boot.
4- Select "ssh" and enable the ssh server on the device. We'll need this active so we can later connect to the device remotely.
5- (optional) Select "boot_behaviour" and then select "command line". This will ensure that we always boot into the command line. You can skip this if you want to use the desktop.
6- Once back in the main menu, press the right arrow twice (to select "Finish") and hit eneter. When you get back to the command line, restart your device using "sudo halt" or unplug/re-plug your device.

4- Wi-fi setup
Ok, we're almost done. Its time to get the wifi working on the EW-7811Un wireless adapter. The OS image we installed already comes with the drivers for this device, so this saves us some headache. Follow these steps (borrowed from to complete setup.

1- Check that the wireless adapter is hooked up properly and recognized by the operating system. Execute the following command:
You should see the following:

2- Next check that the driver is properly installed & loaded. Execute the following command
You should see the following:

3- Edit the network interface configuration file for the operating system. You can edit the file with the following command:
sudo nano /etc/network/interfaces
Modify the file to look like this:

4- Next, lets add the login information for your wireless network. Run the following:
> sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
Edit the file to look like this (replace '__SSID__' with your wireless network ssid and '__PASSWORD__' with your password):

5- Restart your network interface:
> sudo ifup wlan0
6- Restart your device. Once you log back in, you should be able to see the wireless adapter connected to your network:
ifconfig wlan0
7- You can test things out by running:
> curl ""
You should see a bunch of html and javascript pop up on your screen if you're connected to the internet.

5- Connect & start developing!
Now that you have a network connection, you shouldn't need the keyboard or hdmi. You can connect to the rPi through ssh and work remotely. Here I am on my laptop connecting to the rPi:

You can also send files to/from you rPi using scp:

Thats it! Hopefully this saves you some time & headaches.


  1. DD takes a long time if you just use /dev/disk, but if you instead use dev/rdisk it's quite a bit faster

  2. dd will print statistics if you send SIGUSR1 to the process.

  3. It only takes about 3 minutes to write the image using Win32DiskImager on Windows 8.

  4. Yeah, use the /dev/rdisk* device and a fast SD card. Something like 100 seconds on my MacBook Air.

  5. When you plug the micro-usb cable into the device (from your ...

  6. Read on as we guide you through everything from buying to powering to running the tiny dynamo